From: Hidetoshi NAGAI Date: 2006-08-08T01:58:47+09:00 Subject: Re: Ruby/Tk : How to show tooltips (please correct my ugly implementation) From: Ronald Fischer Subject: Re: Ruby/Tk : How to show tooltips (please correct my ugly implementation) Date: Mon, 7 Aug 2006 19:45:21 +0900 Message-ID: <1154947375.72@user.newsoffice.de> > tried to adapt it to my case (the example uses a timer to > show and hide the tooltip, while I am using Enter and Leave > events - but these seem only minor differences, aren't they?). Hmm... Then you have to give attention the position of the toplevel widget. If it is placed under the mouse cursor, you'll see the flicker of the toplevel widget. > what it actually does. (In particular, I did not understand > the reason for the variables @path and @epath). @path is a widget path which used on many of Tcl/Tk commands except geometry manager commands. @epath is used for geometry manager commands. Those are useful for mega-widget class (e.g. a class which includes TkComposite module). Usually, a mega-widget is constructed on a base frame. Please think about a mega-widget which is a text widget with scrollbars. Many of Tcl/Tk commands are called for the text widget, but when it is placed by a geometry manager, the path of the base frame must be used. > Could you please show me what I did wrong? Where is `initialize' method? When did you set the value of @self, @frame and @label? On your code, @self is an uninitialized instance variable. So, "parent = @self" means "parent = nil". And then, TkWinfo.toplevel(parent) means TkWinfo.toplevel(nil). Ruby/Tk passes an empty string for a nil to the Tk interpreter. Therefore, TkWinfo.toplevel(nil) is same as TkWinfo.toplevel(""). An empty string is not a widget path. That is the reason why you get an error. -- Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)