Jannis Pohlmann
2005-Apr-22 14:19 UTC
[fxruby-users] Re: [Foxgui-users][beginner] [ruby] connect problem
Daniel W. schrieb:> Jannis Pohlmann wrote: > >> Daniel W. schrieb: >> >>> Hi, >>> >>> I''m new to FOX and first I try to use it in ruby (using rubyfx). >>> >>> I have a simple and small file in which a Tabbook and a Tabitem was >>> created. >>> In this item I create a label and I wanna catch the >>> SEL_LEFTBUTTONPRESS message >>> for it. >>> >>> Here is the source. >>> >>> @tab1 = FXTabItem.new(@tabbook, "&Standard", nil) >>> tab1frame = FXHorizontalFrame.new(@tabbook, >>> FRAME_THICK|FRAME_RAISED) >>> FXLabel.new(tab1frame, "just testing", nil, >>> FRAME_RAISED).setBackColor(@col_bg_widget) { |w| >>> w.connect(SEL_LEFTBUTTONPRESS) { >>> print "Hit\n" >>> } >>> } >>> >>> It don''t works (and I''ve played a lot to try it). >>> Does a Label don''t get the message or what''s wrong? >>> >>> greetings, >>> daniel >> >> >> >> Hi. >> >> If it doesn''t work with FXLabel try to use FXButton with FRAME_NONE. >> It''s better since a button >> is concepted for this case (action-on-click). >> >> Regards, >> Jannis > > > > Now it works. > The ''setBackColor'' doesn''t return the Button object. > > I have to > w = create button > w.setBackColor > w.connect... > > Now it works, > > thank you! > daniel >Ah, yes, I had overseen that. Of course only the constructor returns the FXlabel instance, not the setBackColor() method. - Jannis