Thread: [Fxruby-users] Strange Behaviour under Win32 with FXRuby
Status: Inactive
Brought to you by:
lyle
From: Stef T <st...@ch...> - 2003-12-10 02:07:51
Attachments:
one_big_widget5.rb
|
Hello everyone, well, the subject sort of says it all really. Below is my code, and it works flawlessly under linux, however, when it runs under Win32, two things happen. Firstly, the window appears at a size of about 20 high by 80 wide. Secondly, the first button (called 'Store') doesnt appear at all. Apart from obviously the logic behind the buttons missing, and obviously the 'myFoxCal' logic isnt there, but apart from that can anyone tell me what else is 'missing' as it were or what i am doing wrong ? thanks Stef (ps also the variable names and class names probably could be better, i know ;) |
From: Lyle J. <jl...@cf...> - 2003-12-10 14:57:06
|
Stef T wrote: > well, the subject sort of says it all really. > Below is my code, and it works flawlessly under linux, > however, when it runs under Win32, two things happen. > > Firstly, the window appears at a size of about > 20 high by 80 wide. Secondly, the first button (called > 'Store') doesnt appear at all. > > Apart from obviously the logic behind the buttons > missing, and obviously the 'myFoxCal' logic isnt there, > but apart from that can anyone tell me what else is > 'missing' as it were or what i am doing wrong ? I don't *see* anything that looks wrong, but it's hard to tell without having all of the code in hand and thus being able to reproduce the problem(s). If you'd like to send the rest of the code (everything needed to run it), I can take a look. [Probably best to send it off-list.] |
From: Stef T <st...@ch...> - 2003-12-10 19:03:49
|
Lyle wrote: > I don't *see* anything that looks wrong, but it's hard to tell without > having all of the code in hand and thus being able to reproduce the > problem(s). If you'd like to send the rest of the code (everything > needed to run it), I can take a look. [Probably best to send it off-list.] > Actually, i went back to a tried and tested debugging technique called 'remarking' :) Basically, an earlier version was working as expected under Win32, so checked it out from CVS, compared the differences and one by one remarked out the bits and re-ran it. Not the most scientific approach, granted, but i narrowed it down to the 4 buttons newly added at the bottom. Here is one of them: XButton.new(bot2_hform, "Store", nil, self, 0, FRAME_RAISED|LAYOUT_FILL_X) for some reason, i was passing in 'self' instead of 'nil'. Changing that fixed it all up and now the program is layed out as desired. FXRuby is not my usual widget toolkit (i am a glade/gtk person by nature) so sorry if this is also causing some confusion with my code :) (of course, for Win32, gtk is jst awful, whereas Fox works very well :) One last teeny tiny probably stupid question, which i know breaks OO design but, how would i tie a 'connect' onto a button from another class ? Can you typecast the connect so that it knows its going onto a FXButton in an instance variable or is there a 'widget controller' which i can query to get an FXButton 'handle' passed to me ? (i have a single login/password dialog, and depending on where the person 'okays', i want to run a different method in different classes, if you see what i mean :) Sorry for the really 'clumsy' way of doing this :) Many thanks and best regards Stef |
From: Hugh S. S. E. E. <hg...@dm...> - 2003-12-10 19:19:31
|
On Wed, 10 Dec 2003, Stef T wrote: > One last teeny tiny probably stupid question, which i know > breaks OO design but, how would i tie a 'connect' onto a > button from another class ? Can you typecast the connect > so that it knows its going onto a FXButton in an instance > variable or is there a 'widget controller' which i can > query to get an FXButton 'handle' passed to me ? Excuse me jumping in. Though I'm not sure I understand the above... > > (i have a single login/password dialog, and depending on > where the person 'okays', i want to run a different method > in different classes, if you see what i mean :) ...Then just use the block to send appropriate messages to the desired destination objects. Or have I really missed something big? I think encapsulation means being clear about your interfaces, not complete isolationism... > > Sorry for the really 'clumsy' way of doing this :) > Many thanks and best regards > Stef > Hugh, who doesn't consider himself fluent in FXRuby matters yet. |
From: Lyle J. <jl...@cf...> - 2003-12-10 19:42:25
|
Stef T wrote: > Actually, i went back to a tried and tested debugging > technique called 'remarking' :) Basically, an earlier > version was working as expected under Win32, so checked > it out from CVS, compared the differences and one by > one remarked out the bits and re-ran it. When you referred to it as "remarking", I thought for a moment that you were referring to the technique in which the bug disappears as soon as you tell someone else about it ;) > One last teeny tiny probably stupid question, which i know > breaks OO design but, how would i tie a 'connect' onto a > button from another class ? Can you typecast the connect > so that it knows its going onto a FXButton in an instance > variable or is there a 'widget controller' which i can > query to get an FXButton 'handle' passed to me? If I understand what you're asking, I think I would just second Hugh's recommendation of putting whatever code is necessary in the block to call the desired method on the other button, e.g. button1.connect(SEL_COMMAND) { button2.doSomething } Lyle |
From: Stef <st...@ch...> - 2003-12-10 20:45:31
|
Lyle wrote: > When you referred to it as "remarking", I thought for a moment that > you > were referring to the technique in which the bug disappears as soon as > you tell someone else about it ;) > Hah! no, not quite that unlucky, although i do 'fondly' remember the days of C programming and the ever so fun problem of 'it works when i remove my comments' ;) > > One last teeny tiny probably stupid question, which i know > > breaks OO design but, how would i tie a 'connect' onto a > > button from another class ? Can you typecast the connect > > so that it knows its going onto a FXButton in an instance > > variable or is there a 'widget controller' which i can > > query to get an FXButton 'handle' passed to me? > > If I understand what you're asking, I think I would just second Hugh's > recommendation of putting whatever code is necessary in the block to > call the desired method on the other button, e.g. > > button1.connect(SEL_COMMAND) { > button2.doSomething > } > I understand that this is probably the way that is simpliest however I also believe that reductionism is 'good'. It is preferable in my eyes not to have the same code repeated multiple times in different classes, when it should (in my eyes) belong in the 'parent' class. Imagine this example: class Funky < FXDialogBox def initialize accept=FXButton.new(buttons, "&Accept", nil, self, ID_ACCEPT, FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y) end end class Mojo < FXMainWindow def initialize @lp_dialog=Funky.new(self) end end now, from inside the Mojo class, how would I go about tying the connect on the accept to a procedure/method or callback ? I know it may sound crazy, but if i can do one line such as '(FXButton)@lp_dialog.accept.connect(SEL_METHOD... etc) surely that has to be better than the 20 or 23 or so lines that I need to do to create my 'Funky' dialog in the other classes ? Thanks for the pointers (no pun intended) though, most helpful and glad to see that there is a 'live community' that I can learn and support. Lack of arrogance also seems to be a 'Fox Community' strongpoint (unlike certain other Toolkits developers :D regards and thanks Stef |