help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] Subclassing GTK "Classes" possible?


From: Joachim Jaeckel
Subject: [Help-smalltalk] Subclassing GTK "Classes" possible?
Date: Sun, 24 May 2009 23:56:41 +0200
User-agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103)

Hello,

I'm currently trying something like
"GTK.GtkWindow subclass: MainWindow"

But maybe, that is not possible, because GtkWindow is no real class, but a binding?

The reason, why I come to the question is, if I try the following code in the open-method:

GTK.GtkWindow subclass: MainWindow [
      MainWindow class >> open [
              | r |
              <category: 'user interface'>

              r := self new: GTK.Gtk gtkWindowToplevel.
              r initialize.
              r show.
              ^r
      ]

       initialize [
                ...
       ]
]

The VM errors out that "initialize" is not understood from GtkWindow.

I know I have a lot to learn, currently I'm a bit confused about the fact, that "new" is a class-method and with the things that have an association with that.

In Java I would call in the constructor of a subclassed class e.g. super(bla); to initialize the object. How could that be done in smalltalk?

E.g. in my class, a class-method new could for instance call the super new ... but would that not result in a new object?

MainWindow class >> new: aType [
        super new: aType
]

Thanks in advance,
Joachim.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]