Menu

#245 error cannot inherit from "itk::Toplevel"

4.0*
closed-duplicate
None
5
2014-09-19
2013-06-23
EL
No

Here is a small script, which creates a (nonsense) widget that is derived from ::itk::Toplevel. In Itk3.4 (for ::tcl_version <= 8.5) this used to work, but in itk4.0.0 (for ::tcl_version >= 8.6) it doesn't.

if {$tcl_version <= 8.5} {
    package require Itk 3.4
} else {
    package require itk 4.0.0
}

namespace import ::itcl::*
namespace import ::itk::*

class Test {
    inherit itk::Toplevel

    constructor {args} {
        eval itk_initialize $args
    }
}

Test .t

When I run the script with tclsh8.6, I get the following error:

cannot inherit from "itk::Toplevel" (can't create object "itk::Toplevel": command already exists with that nameITCL: cannot create Tcl_NewObjectInstance for class "::itk::Toplevel")
    while executing
"inherit itk::Toplevel"
    (class "Test" body line 2)
    invoked from within
"class Test {
    inherit itk::Toplevel

    constructor {args} {
        eval itk_initialize $args
    }
}"
    (file "tt.tcl" line 5)

What is wrong here?

Discussion

  • Don Porter

    Don Porter - 2013-06-24
    • assigned_to: Arnulf Wiedemann
     
  • Arnulf Wiedemann

    • status: open --> closed-duplicate
     
  • Arnulf Wiedemann

    same problem as in # 182

     

Log in to post a comment.