fxruby-users Mailing List for FXRuby (Page 9)
Status: Inactive
Brought to you by:
lyle
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(75) |
Jul
(90) |
Aug
(61) |
Sep
(56) |
Oct
(56) |
Nov
(39) |
Dec
(83) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(56) |
Feb
(45) |
Mar
(61) |
Apr
(40) |
May
(95) |
Jun
(79) |
Jul
(63) |
Aug
|
Sep
(4) |
Oct
|
Nov
|
Dec
|
From: Adam W. <ad...@ta...> - 2004-05-18 05:20:05
|
At 2:01 PM -0800 3/17/04, Oliver Smith wrote: >As to removing the children, this also works for me under Win2k: ... > popup.children.each { |child| popup.removeChild(child) } It now works for me as well. The problem that I had thought was caused by removeChild was in fact caused by the fact that I had not reset FXOptionMenu.current. This must have caused a stale reference -- it was left pointing to one of the children I had removed. Thanks again! -- Adam Wildavsky Extreme Programmer Tameware, LLC ad...@ta... http://www.tameware.com |
From: Hal F. <ha...@hy...> - 2004-05-17 21:12:41
|
Are there general rules for setFocus that I need to know? Frequently I find that I call it and nothing happens, notably when I show a modal dialog and try to give focus to one of its fields. Thanks, Hal |
From: Adam W. <ad...@ta...> - 2004-05-17 21:12:05
|
At 4:02 PM -0400 5/17/04, Adam Wildavsky wrote: >The class takes care of selecting the appropriate item automatically >when the user clicks it -- it becomes the item displayed when the >user lets go of the mouse button and menu pops closed. I should have >been clearer about what I want to do, which is to select an item in >the same way, but programmatically. Something like this seems to do the trick: myOptionMenu.current = myPopup.children[0] I'm still trying to figure out how to remove the "empty" slots taken up by FXOption items I've destroyed. More generally, I'd like to know the proper fxruby way to remove a component FXWindow from a FXComposite. -- Adam Wildavsky Extreme Programmer Tameware, LLC ad...@ta... http://www.tameware.com |
From: Oliver S. <ol...@mo...> - 2004-05-17 21:01:37
|
> Thanks for the quick reply! > [snip] Oh, I see, after looking through the dialog.rb sample some more. Have you tried the FXOptionMenu class attributes for setting the currently selected option? This works for me: popup = FXPopup.new(self) thing1 = FXOption.new(popup, "thing 1") thing2 = FXOption.new(popup, "thing 2") menu_button = FXOptionMenu.new(self, popup) menu_button.currentNo = 1 # could also do menu_button.current = thing2 As to removing the children, this also works for me under Win2k: FXButton.new(self, "click me").connect(SEL_COMMAND) { |sender, message, data| popup.children.each { |child| popup.removeChild(child) } thing3 = FXOption.new(popup, "thing 3") thing4 = FXOption.new(popup, "thing 4") thing3.create thing4.create # note - the menu text doesn't seem to update itself, so you have to click # on a new item...don't know what's wrong there } After testing, the children.each thing seems to work...I remember it screwing me up once, but I think that was with a tree list and I may have been doing something weird. Anyway, I hope this is a little more useful. :) Sorry if I'm still off-base. Oliver |
From: Adam W. <ad...@ta...> - 2004-05-17 20:05:05
|
At 10:45 AM -0700 5/17/04, Oliver Smith wrote: > > 1. How can I remove all items from a FXPopup? I've tried destroying >> its children, but then I get empty menu items: >> > > myPopup.children.each { | option | >> option.destroy >> } > >You should probably use 'myPopup.removeChild(child)'. I believe the destroy >function is always handled by Fox or FXRuby internally, so you don't ever >need to call it. Watch out for 'children.each', though...the iterator can >screw up when you remove a child from the array in the middle of recursing >through it. You may want to duplicate the array first. Thanks for the quick reply! I used children.each instead of each_child for that reason. children.dup.each doesn't seems to behave any differently. As for removeChild, I should have mentioned that I had tried it. The result is a Segmentation Fault (in Windows 98) when I click on the popup. I tried rewriting the loop to avoid the iteration issue, with no better results: while myPopup.children.length > 0 myPopup.removeChild myPopup.children[0] end > > Now I'd like to choose which one is selected. How can I do that? > >I'm not sure what FXOption/FXOptionMenu are...I thought FXOption was a radio >button at first, but now it looks like something else. If what you want is >a radio button in a menu; i.e. you have a few options and the selected one >has a little circle next to it, you should do: The class takes care of selecting the appropriate item automatically when the user clicks it -- it becomes the item displayed when the user lets go of the mouse button and menu pops closed. I should have been clearer about what I want to do, which is to select an item in the same way, but programmatically. That said, checkRadio and uncheckRadio might be the way to do it -- I'll experiment! >So I guess I don't know what FXOption is, but the sample program dialog.rb >seems to use it, if that helps. I cribbed my initial code from the samples, as usual... -- Adam Wildavsky Extreme Programmer Tameware, LLC ad...@ta... http://www.tameware.com |
From: <ly...@kn...> - 2004-05-17 19:41:27
|
On Mon, 17 May 2004 12:26:20 -0400, Tom <tku...@so...> wrote : > BitTorrent, anyone? Good call. I'd host one if I had downloaded the code myself, yet. ;) I'm going to try to grab the tarball tonight, and I should be able to kick off a torrent after that. Of course, it may be irrelevant by that point anyways. |
From: Oliver S. <ol...@mo...> - 2004-05-17 17:44:58
|
> 1. How can I remove all items from a FXPopup? I've tried destroying > its children, but then I get empty menu items: > > myPopup.children.each { | option | > option.destroy > } You should probably use 'myPopup.removeChild(child)'. I believe the destroy function is always handled by Fox or FXRuby internally, so you don't ever need to call it. Watch out for 'children.each', though...the iterator can screw up when you remove a child from the array in the middle of recursing through it. You may want to duplicate the array first. > 2. I am able to add new FXOption items to the popup: > > opt = FXOption.new(myPopup, ...) > opt.create() > > Now I'd like to choose which one is selected. How can I do that? I'm not sure what FXOption/FXOptionMenu are...I thought FXOption was a radio button at first, but now it looks like something else. If what you want is a radio button in a menu; i.e. you have a few options and the selected one has a little circle next to it, you should do: opt = FXMenuCommand.new(myPopup, "a fun radio button") opt.checkRadio It looks like you have to manually uncheck the other options: opt.connect(SEL_COMMAND) { |sender, message, data| # uncheck other options here with uncheckRadio... sender.checkRadio } So I guess I don't know what FXOption is, but the sample program dialog.rb seems to use it, if that helps. -- Oliver |
From: Adam W. <ad...@ta...> - 2004-05-17 16:35:24
|
Hi everyone -- I'm new to Fox and fxruby, and I like what I've seen so far! These questions may not be specific to fxruby -- please let me know if I should post to the foxgui list instead. 1. How can I remove all items from a FXPopup? I've tried destroying its children, but then I get empty menu items: myPopup.children.each { | option | option.destroy } Alternatively I'd be happy to destroy the FXPopup and associated FXOptionMenu and create new ones, but my attempts to do that were unsuccessful. 2. I am able to add new FXOption items to the popup: opt = FXOption.new(myPopup, ...) opt.create() Now I'd like to choose which one is selected. How can I do that? I've checked the Fox FAQ and the mailing lists archives to no avail. Any tips will be appreciated! -- Adam Wildavsky Extreme Programmer Tameware, LLC ad...@ta... http://www.tameware.com |
From: Tom <tku...@so...> - 2004-05-17 16:27:13
|
BitTorrent, anyone? ly...@kn... wrote: > primary web site (http://www.fox-toolkit.com) is being hit pretty hard right > now, and so you might as well wait a few days for the dust to settle before > trying to check it out. ;) |
From: <ly...@kn...> - 2004-05-17 16:11:16
|
On Mon, 17 May 2004 11:44:17 -0400, Jamey Cribbs <cr...@oa...> wrote : > So, Lyle, what time today will the 1.2 version of FXRuby be available? Jeroen's announcement (*) caught me off-guard, although I do understand why we decided to go ahead and pull the trigger. For crying out loud, I just had lunch with him last week and he didn't even hint that this was on his mind. ;) So, the short answer is, I don't yet know when I'll have a first cut at FXRuby 1.2. It is true that the development version of FXRuby has been tracking the changes for FOX 1.2 pretty closely over the last year, but I do have some catching up to do. I think the best I can shoot for at this point is "sometime in June" for an FXRuby-1.2.0 release. Thanks in advance for your patience. ;) (*) For those of you not subscribed to the foxgui-users mailing list, Jeroen announced over the weekend that he's officially declared FOX 1.2.0 the stable version. I am also seeing reports that due to the announcement the primary web site (http://www.fox-toolkit.com) is being hit pretty hard right now, and so you might as well wait a few days for the dust to settle before trying to check it out. ;) |
From: Jamey C. <cr...@oa...> - 2004-05-17 15:44:24
|
So, Lyle, what time today will the 1.2 version of FXRuby be available? Just, kidding! :) P.S. Ok, I'm not kidding, but since I realize how unrealistic my question is, I'll act like I'm kidding. Confidentiality Notice: This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and/or privileged information. If you are not the intended recipient(s), you are hereby notified that any dissemination, unauthorized review, use, disclosure or distribution of this email and any materials contained in any attachments is prohibited. If you receive this message in error, or are not the intended recipient(s), please immediately notify the sender by email and destroy all copies of the original message, including attachments. |
From: Rich <ri...@li...> - 2004-05-15 05:05:48
|
> > If this works for you, that is of course great. It seems to me that a less > haphazard way would be find some way to leverage the information contained > in the existing RDoc documentation. For example, use RDoc to generate XML > output (instead of the standard HTML) and then write a little program using > REXML to extract the messages sent by each widget. > > Just my $0.02, > > Lyle > Taking Lyle's $0.02 and investing it in Ruby, I've produced a list that might help everyone. ( FYI: I'm working on a GUI Builder too... hence my motivation. ;-) ) The list is at http://www.lithinos.com/fxruby/the_list.txt Have fun! -Rich |
From: meinrad r. <mei...@gm...> - 2004-05-14 18:05:18
|
ly...@kn... wrote: > On Fri, 14 May 2004 16:48:30 +0200, meinrad recheis <mei...@gm...> > wrote : > > >>many people including myself have asked on this list for a method to >>find out what messages a widget handles. > > > Here, "many" people means "two" people. hmpf > > >>i have written a simple script that does the job. >> >>the script is not perfect and i can not guarantee that the result is >>exact, but it seems fairly ok to me. > > > If this works for you, that is of course great. It seems to me that a less > haphazard way would be find some way to leverage the information contained > in the existing RDoc documentation. For example, use RDoc to generate XML > output (instead of the standard HTML) and then write a little program using > REXML to extract the messages sent by each widget. ok. > > Just my $0.02, > > Lyle > > |
From: <ly...@kn...> - 2004-05-14 16:02:53
|
On Fri, 14 May 2004 16:48:30 +0200, meinrad recheis <mei...@gm...> wrote : > many people including myself have asked on this list for a method to > find out what messages a widget handles. Here, "many" people means "two" people. > i have written a simple script that does the job. > > the script is not perfect and i can not guarantee that the result is > exact, but it seems fairly ok to me. If this works for you, that is of course great. It seems to me that a less haphazard way would be find some way to leverage the information contained in the existing RDoc documentation. For example, use RDoc to generate XML output (instead of the standard HTML) and then write a little program using REXML to extract the messages sent by each widget. Just my $0.02, Lyle |
From: meinrad r. <mei...@gm...> - 2004-05-14 15:34:29
|
moin! many people including myself have asked on this list for a method to find out what messages a widget handles. i have written a simple script that does the job. the script is not perfect and i can not guarantee that the result is exact, but it seems fairly ok to me. a handful of messages cause segfaults or typeerrors (maybe because the handler expects specific message data instead of nil) so they were excluded. as soon as i have time to continue work on my gui builder, i will test all fox widgets and make the results publicly available. until then the attached script should help you to test any fox widget. have fun! - henon here comes the script: #fxruby message tester by henon require "fox" include Fox $stdout.sync=true $messages=Fox.constants.grep( /SEL_/).sort-[ "SEL_ENTER", # segfault "SEL_LAST", # segfault "SEL_LEAVE", # segfault "SEL_NONE", # segfault "SEL_PAINT", # segfault "SEL_SIGNAL", # type error - expects integer "SEL_VERIFY", # type error - expects string ] def test_widget( w) raise TypeError unless w.kind_of? FXWindow # or even FXObject ? # provide a receive callback for each message $messages.each{|c| const = Object.const_get(c) w.connect(const) { puts "received message: #{c}" } } # send all messages puts "Testing #{w.class}:" $messages.each{|c| #~ puts "sending: #{c}" w.handle(w, MKUINT(0, Object.const_get(c)), nil) } puts "finished!!" # remove the callbacks $messages.each{|c| const = Object.const_get(c) next if c=="SEL_UPDATE" w.connect(const) { 0 } } end application = FXApp.new("Hello", "FoxTest") main = FXMainWindow.new(application, "Hello", nil, nil, DECOR_ALL) w=FXButton.new(main, "the widget to be tested") application.create() test_widget(w) #main.show(PLACEMENT_SCREEN) #application.run() |
From: meinrad r. <mei...@gm...> - 2004-05-14 14:17:13
|
ly...@kn... wrote: > On Wed, 12 May 2004 07:41:32 -0700 (PDT), Vladislav Guzov > <vl...@ya...> wrote : > > >>I know about documentation but a tool like GUI builder >>is not. Is it possible to get list using method or >>some other way? > > > No. > > well, i think there is a (rather complicated) way! i have thought about this too, because i wrote a gui builder and i think i have an idea how to do it. first you need a list of all messages that exist. that is fairly easy with ruby: messages = Fox.constants.grep /SEL_/ # or something like that second you need to generate connectors for all messages in your widget that you want to test. for instance: b = Button.new( parent, "text", ... ) messages.each{|const_string| const = Object.const_get(const_string) b.connect(const) { puts "received message: #{const_string}" } } third, test to which messages your widged responded as far as i know, it is possible to send messages programmatically to a custom fox widget of your choice (lyle will correct me if i am wrong.), but unfortunately i don't have a piece of code ready here. if you really managed to do this, i would be very interested in the script to use it for my gui builder. cheers, - henon |
From: Lyle J. <ly...@kn...> - 2004-05-14 13:41:33
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On May 13, 2004, at 10:32 PM, Hal Fulton wrote: > Well, it's not a matter of needing it, but deserving it. There is a > Biblical proverb which says, "Do not bind the mouths of the cows who > tread the grain." :D So, now I am reduced to a cow. ;) > Many times in the last ten years I have called for commercial tech > support. Often it was $30 or more per call, and was lower quality than > the help I've had from you. > > And you've assisted me at least eight times if not more. So why > shouldn't I drop fifty bucks on your desk? Forget Ruby Central, take > your wife to dinner. Hey, don't get me wrong, I'm not turning away anyone who wants to give me money. I do have a PayPal account (under my e-mail address, ly...@kn...). But I still reserve the right to donate to Ruby Central. Or maybe I should just invite Ruby Central to go to dinner with us. >> Now, Hal, in your case, if you just promise to dedicate the next >> edition of >> "The Ruby Way" to me, I think we'll call it even. ;) > > Haha, dream on. Do you know how tickled my mother was to see the > dedication? :) I had to go find my copy to remind myself of what the 1st ed. dedication was ;) Well, maybe I can get a footnote or something in the 2nd. ;) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin) iD8DBQFApMNbFXV/hD6oMd0RArhnAKCVLIECtJIpzrPDVu/sQPAyv7ihyACghmjL lZE02HjCbPZzVMhT6Rea8ks= =VII+ -----END PGP SIGNATURE----- |
From: Hans F. <fu...@cs...> - 2004-05-14 13:27:59
|
Alas I don't have a moment to try this and help debug right now (in the middle of moving), but I do have a commonality. > 2. Also: Clicking around in the tree gives me errors like > FXRbGetRubyObj(this=3D0x08eff288) returns non-Qnil > over and over -- once per click maybe? What's wrong here? I get similar messages since I updated fox and FXRuby to the most recent versions (fox is the most recent 1.0 release in Debian Testing, actually). My code is in CVS on sourceforge http://sf.net/projects/neelix --=20 .O. Hans Fugal | De gustibus non disputandum est. ..O http://hans.fugal.net | Debian, vim, mutt, ruby, text, gpg OOO | WindowMaker, gaim, UTF-8, RISC, JS Bach --------------------------------------------------------------------- GnuPG Fingerprint: 6940 87C5 6610 567F 1E95 CB5E FC98 E8CD E0AA D460 |
From: Hal F. <ha...@hy...> - 2004-05-14 03:32:50
|
ly...@kn... wrote: > On Wed, 12 May 2004 22:18:05 -0500, Hal Fulton <ha...@hy...> > wrote : > >>Lyle, you're a gentleman and a genius. Do you have a Paypal account? ;) > > All kidding aside, if anyone wants to donate to the FXRuby project they can > do so here: > > http://sourceforge.net/donate/index.php?group_id=20243 I wasn't really kidding. Since I've started a job two weeks ago, and have even had a paycheck, I'm feeling a tiny bit generous. > And, to quote the blurb I wrote for that page: "FXRuby always has been, and > will continue to be, freely available from me. However, if you would like to > make donations to the project, you should know that a portion of those > donations will go to Ruby Central, Inc., a non-profit organization dedicated > to contributing to the growth and spread of the open-sourced, > object-oriented programming language Ruby. For more information about Ruby > Central, please visit the Ruby Central web site at http://www.rubycentral.org." > > At the current time, when I say a "portion" of those donations goes straight > to Ruby Central, that portion is 100%. I have been blessed with a very good > job and I don't need this to supplement my personal income at this time. If > I ever *do* have an expense in the future that I honestly believe is > FXRuby-related, I might change this policy -- but right now, I don't see > that happening. Well, it's not a matter of needing it, but deserving it. There is a Biblical proverb which says, "Do not bind the mouths of the cows who tread the grain." :D Many times in the last ten years I have called for commercial tech support. Often it was $30 or more per call, and was lower quality than the help I've had from you. And you've assisted me at least eight times if not more. So why shouldn't I drop fifty bucks on your desk? Forget Ruby Central, take your wife to dinner. > Now, Hal, in your case, if you just promise to dedicate the next edition of > "The Ruby Way" to me, I think we'll call it even. ;) Haha, dream on. Do you know how tickled my mother was to see the dedication? :) Cheers, Hal |
From: <ly...@kn...> - 2004-05-14 03:18:09
|
On Wed, 12 May 2004 22:18:05 -0500, Hal Fulton <ha...@hy...> wrote : > > OK. Haven't had a chance to debug this yet, but will do that next. Just > > figured you'd like to have the first bit in hand to proceed. > > That's not a biggie. Redirecting stderr hides it. :) But I guess that's > not a long-term solution. No, I agree that it's not a long-term solution. Hopefully I can track that one down soon. I am overdue for a bug-fix release of FXRuby (things have been busy due to the job change in March). > Thanks much, Lyle. You've done a great job with fxruby. Thank you. |
From: <ly...@kn...> - 2004-05-14 03:14:55
|
On Wed, 12 May 2004 22:18:05 -0500, Hal Fulton <ha...@hy...> wrote : > Lyle, you're a gentleman and a genius. Do you have a Paypal account? ;) All kidding aside, if anyone wants to donate to the FXRuby project they can do so here: http://sourceforge.net/donate/index.php?group_id=20243 And, to quote the blurb I wrote for that page: "FXRuby always has been, and will continue to be, freely available from me. However, if you would like to make donations to the project, you should know that a portion of those donations will go to Ruby Central, Inc., a non-profit organization dedicated to contributing to the growth and spread of the open-sourced, object-oriented programming language Ruby. For more information about Ruby Central, please visit the Ruby Central web site at http://www.rubycentral.org." At the current time, when I say a "portion" of those donations goes straight to Ruby Central, that portion is 100%. I have been blessed with a very good job and I don't need this to supplement my personal income at this time. If I ever *do* have an expense in the future that I honestly believe is FXRuby-related, I might change this policy -- but right now, I don't see that happening. Now, Hal, in your case, if you just promise to dedicate the next edition of "The Ruby Way" to me, I think we'll call it even. ;) Lyle |
From: Claus S. <Doc...@gm...> - 2004-05-13 03:46:05
|
First of all, sorry for my earlier vague question, and thanks for the reply. Now, what I was trying to do: I'm still working on the program that you previously helped me with (the canvas stuff). Got the canvas part down, added a few extra features. Still the same concept basically. What the whole thing is supposed to be is a lightweight replacement for FXTable to match my requirements, which are: * custom cell colors (hence the canvas) * bring up a FXMessageBox when certain areas of the canvas are clicked * etc item #2 is what I'm wanting the connect() for... my previous program, which was loosely based on the ListView class by Jamey Cribbs borrowed his method of placing connect( SEL_LEFTBUTTONPRESS, method( :onClick ) ) connect( SEL_LEFTBUTTONRELEASE, method( :onClick ) ) in the ListView (and in my case, CellView) class, and then have the onClick method handle the different events def onClick( sender, sel, event ) ... if event.click_count > 1 @win.onCmdDoubleClick return 1 end ... Now I'm assuming that the make_it_so method in your example is the equivalent of my onClick method... right? However, nothing is happening, and I've got a sneaking suspicion that it's because I've omitted something crucial. Like using the parent FXWindow instead for the connect() method. But I thought I'd better ask before banging my head against the wall repeatedly. I've attached the source in case you want to take a look at it... take your time, I've got tons of other work that I can do on it in the meantime (like adding other needed features and fixing the programming horrors in there - I've been busy documenting many of them as such so that should ease the urge to kill me). But eventually, I'd like to handle these and other types of events. -CWSpitzer PS: the onClick method should crash when executed, as I have commented out some the methods it relies on... I know, sloppy work, but I'm just working on things as they bubble to the top of my to do list. On Wed, 12 May 2004 20:55:55 -0500, Lyle Johnson <ly...@kn...> wrote: > 8< ----- snip ----- > OK, first let's try to pin down what it is that you want to do. You > want your class to be able to have a message target, i.e. to be able to > call connect() on that object and provide a block to handle that > message? > > If that's the case, your class needs to provide a "target" accessor > method that returns a reference to the message target (an FXObject > instance) for that object. If your class is a subclass of FXWindow or > FXDataTarget you've already got that. Otherwise, do something like: > > class MyClass < FXObject > include Responder2 > attr_accessor :target > def initialize > @target = nil > end > end > > You also need to mix-in the Responder2 module to get the connect() > method, as shown. > > Now you should be able to do something like this: > > obj = MyClass.new > obj.connect(SEL_COMMAND) { puts "hey hey hey" } > > And inside your class, when you want to "trigger" that callback, send a > SEL_COMMAND message to the message target, e.g. > > class MyClass > def make_it_so > target.handle(self, MKUINT(0, SEL_COMMAND), nil) > end > end > > I'm sort of rushing through this, so I may have omitted some details. > Let me know how it goes and if you have some follow-up questions. > > Hope this helps, > > Lyle > > |
From: Lyle J. <ly...@kn...> - 2004-05-13 02:27:21
|
On May 12, 2004, at 3:02 PM, Claus Spitzer wrote: > Greetings! I'm at a loss on how to implement event handlers in my > classes. I looked at the API references and saw that connect() is > implemented in Responder2, which led me to believe that I need to > include it in whichever class needs the connect() method. This did not > work, as the objects 'selector', 'target', and 'value' were missing. > I've looked at the class that had those (FXDataTarget) and saw that > they were accessors, so I added those for my class, and it prevents > the compiler from throwing an error at me, but it's a crude solution, > and it doesn't do anything except getting rid of the errors. I'm 99% > sure that what I'm doing is wrong. OK, first let's try to pin down what it is that you want to do. You want your class to be able to have a message target, i.e. to be able to call connect() on that object and provide a block to handle that message? If that's the case, your class needs to provide a "target" accessor method that returns a reference to the message target (an FXObject instance) for that object. If your class is a subclass of FXWindow or FXDataTarget you've already got that. Otherwise, do something like: class MyClass < FXObject include Responder2 attr_accessor :target def initialize @target = nil end end You also need to mix-in the Responder2 module to get the connect() method, as shown. Now you should be able to do something like this: obj = MyClass.new obj.connect(SEL_COMMAND) { puts "hey hey hey" } And inside your class, when you want to "trigger" that callback, send a SEL_COMMAND message to the message target, e.g. class MyClass def make_it_so target.handle(self, MKUINT(0, SEL_COMMAND), nil) end end I'm sort of rushing through this, so I may have omitted some details. Let me know how it goes and if you have some follow-up questions. Hope this helps, Lyle |
From: Lyle J. <ly...@kn...> - 2004-05-13 01:39:13
|
On May 10, 2004, at 11:42 PM, Hal Fulton wrote: > Now, there are two problems... > > 1. New notes (MDI children) don't show up immediately (and I *am* > doing a #create, at least I think I am) > > To reproduce: > a. Go into the tree, expand the "Work stuff" branch > b. Click on the "Interesting work" topic > c. Hit the "New note" button > d. Give it any title when prompted > e. Notice that an empty note does NOT appear on the right. Why?? When you hit the "New note" button, the callback is MyMain#new_note(). The new_note() method calls make_note(title). The make_note() method calls make_note_window(), which returns a reference to an FXMDIChild window. Since there's no call to FXMDIChild#create() in make_note_window() itself, and since you don't call create() on the FXMDIChild returned by make_note_window(), you've got yourself a non-created window. Another problem (possibly tied in to that) was that the new MDI child window was constructed with the dimensions (w=0, h=0). I sort of had trouble following how and when this was supposed to get resized, so I made a change that sort-of works. It's probably best to just diff the attached version of tycho.rb (which is modified) against the 0.0.7 version you sent. > 2. Also: Clicking around in the tree gives me errors like > FXRbGetRubyObj(this=0x08eff288) returns non-Qnil > over and over -- once per click maybe? What's wrong here? OK. Haven't had a chance to debug this yet, but will do that next. Just figured you'd like to have the first bit in hand to proceed. |
From: Claus S. <Doc...@gm...> - 2004-05-12 20:02:34
|
Greetings! I'm at a loss on how to implement event handlers in my classes. I looked at the API references and saw that connect() is implemented in Responder2, which led me to believe that I need to include it in whichever class needs the connect() method. This did not work, as the objects 'selector', 'target', and 'value' were missing. I've looked at the class that had those (FXDataTarget) and saw that they were accessors, so I added those for my class, and it prevents the compiler from throwing an error at me, but it's a crude solution, and it doesn't do anything except getting rid of the errors. I'm 99% sure that what I'm doing is wrong. I am currently in the dark as to what needs to be done... perhaps I need to have my class's parent be FXDataTarget, or FXObject? Hints would be greatly appreciated. Cheers! -CWSpitzer |