[fxruby-users] Class with looping objects

Douglas Allen kb9agt at gmail.com
Wed Mar 3 18:01:31 EST 2010


Most FOX objects send out messages (also known as *events*) when something
interesting happens. FOX messages have four important elements:

   1.

   The message *sender* is the object that sends the message. In this case,
   the FXButton instance is the sender.
   2.

   The message *type* is a predefined integer constant that indicates what
   kind of event has occurred (i.e. why this message is being sent). In this
   case, the message type is SEL_COMMAND, which indicates that the command
   associated with this widget should be invoked.
   3.

   The message *identifier* is another integer constant that is used to
   distinguish between different messages of the same type. For example, the
   message that tells a FOX window to make itself visible is a
SEL_COMMANDmessage with the identifier
   FXWindow::ID_SHOW (where ID_SHOW is a constant defined in the
FXWindowclass). A different message identifier,
   FXWindow::ID_HIDE, tells an FXWindow instance to make itself invisible.
   4.

   The message *data* is an object containing message-specific information.
   For this case (the FXButton's SEL_COMMAND message, there is no
   interesting message data, but we'll see other kinds of messages where the
   message data is useful.



On 3/2/10, Stuart Clarke <stuart_clarke86 at yahoo.com> wrote:
>
> Hi,
>
> Thanks for your reply.
>
> I have tried this previously and I get the following error:
>
> C:/Ruby/lib/ruby/gems/1.8/gems/fxruby-1.6.16-x86-mswin32-60/lib/fox16/aliases.rb:4812:in
> `getText': This FXTextField * already released (RuntimeError)
>
> Code is:
>
>   buttonCode = FXButton.new(frame, "Run").connect(SEL_COMMAND,
> method(:matcher))
> end
> def matcher(sender, sel, ptr)
>    self.close(true)
> #....
>
> Just to clarify, when matcher runs, it does
>
> Matcher object - get first item and call object2
> Object2 does stuff and then we go back to object matcher and get the next
> item
> This loop continues until all items have been through both objects then
> once finished the run button pops up again and the processing is done, at
> this point I want a GUI.
>
> Thanks a lot
>
> Stuart
>
>
> --- On *Mon, 1/3/10, Joey Kinsella <jkinsella at ancillaryservices.com>*wrote:
>
>
> From: Joey Kinsella <jkinsella at ancillaryservices.com>
> Subject: Re: [fxruby-users] Class with looping objects
> To: fxruby-users at rubyforge.org
> Date: Monday, 1 March, 2010, 14:43
>
>
> Couldn't you just do:
>
> def initialize
>   # ...
>   button = FXButton.new(frame, "Run").connect(SEL_COMMAND,
> method(:matcher))
>   # ...
> end
>
> def matcher(sender, selector, data)
>   # ...
>   self.close # (true) # if you want to notify the messaging system.
> end
>
> or well, something along those lines.. button is a reference to an FXButton
> object, It should never equal SEL_KEYRELEASE in this respect. Also the code
> above is assuming that it's an object which extends FXMainWindow.
>
> Hope this helps,
> -Joey
>
> On Mon, Mar 1, 2010 at 6:09 AM, Stuart Clarke <stuart_clarke86 at yahoo.com<http://mc/compose?to=stuart_clarke86@yahoo.com>
> > wrote:
>
>> Hi,
>>
>> I have a GUI which triggers an object to do some stuff, when you press the
>> FXButton it calls matcher e.g.
>>
>> button = FXButton.new(frame, "Run").connect(SEL_COMMAND, method(:matcher))
>>
>> This button remains in a pressed state until the object has finished
>> running, when it is complete the button pops back up. I am trying to add a
>> popup box to respond to the button popping up (or processing finished) like
>> so:
>>
>> if button == SEL_KEYRELEASE
>>   FXMessageBox.information(self, MBOX_OK, "Complete")
>>   mainwindow.close
>> end
>>
>> This however does not work, any ideas how I can acheive this?
>>
>> Many thanks
>>
>> --- On *Fri, 26/2/10, Stuart Clarke <stuart_clarke86 at yahoo.com<http://mc/compose?to=stuart_clarke86@yahoo.com>
>> >* wrote:
>>
>>
>> From: Stuart Clarke <stuart_clarke86 at yahoo.com<http://mc/compose?to=stuart_clarke86@yahoo.com>
>> >
>> Subject: [fxruby-users] Class with looping objects
>> To: fxruby-users at rubyforge.org<http://mc/compose?to=fxruby-users@rubyforge.org>
>> Date: Friday, 26 February, 2010, 19:38
>>
>>
>> Hi all,
>>
>> Apologies if this is a stupid question but it is getting the best of me.
>>
>> I have a class which contains a GUI object which has serveral text fields
>> and buttons which when used trigger the use of further objects which all
>> loop through data, the structure is as follows:
>>
>> class
>> def GUI
>> GUI calls object1
>> end
>> def object1 loops through some data one entry at a time and for each entry
>> passes to a new object
>> end
>> def object2 loops through passed data and does stuff
>> end
>> then the next bit of data does the same thing in object1
>>
>>
>> What I need is a gui that pops up when my script runs through all of
>> objects for each bit of data. Any ideas? I just need to know when the loop
>> is complete, at present I press the go button on my fx GUI and it stays
>> pressed in until all processing is done then pops back out. At this point I
>> need a Gui.
>>
>> I hope this makes sense,
>>
>> Many thanks
>>
>>
>>
>> _______________________________________________
>> fxruby-users mailing list
>> fxruby-users at rubyforge.org<http://mc/compose?to=fxruby-users@rubyforge.org>
>> http://rubyforge.org/mailman/listinfo/fxruby-users
>>
>>
>>
>> _______________________________________________
>> fxruby-users mailing list
>> fxruby-users at rubyforge.org<http://mc/compose?to=fxruby-users@rubyforge.org>
>> http://rubyforge.org/mailman/listinfo/fxruby-users
>>
>
> --
> If you are not the intended recipient, you are hereby notified
> that any dissemination, distribution, copying or other use of
> this communication is strictly prohibited.  If you have
> received this communication in error, please notify us
> immediately.
>
>
> -----Inline Attachment Follows-----
>
> _______________________________________________
> fxruby-users mailing list
> fxruby-users at rubyforge.org<http://mc/compose?to=fxruby-users@rubyforge.org>
> http://rubyforge.org/mailman/listinfo/fxruby-users
>
>
>
> _______________________________________________
> fxruby-users mailing list
> fxruby-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/fxruby-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20100303/5ade8bc5/attachment.html>


More information about the fxruby-users mailing list