[fxruby-users] messages

angico angico at angico.org
Wed Oct 22 07:25:07 EDT 2008


Em Qua, 2008-10-22 às 05:53 -0300, angico escreveu:
> Em Ter, 2008-10-21 às 19:59 -0500, Lyle Johnson escreveu:
> > 
> > On Oct 21, 2008, at 2:54 PM, angico wrote:
> > 
> > > How could I send a message to a widget? Say, I want to have a modal
> > > window to be closed after a specified timeout. How could I send it a
> > > "default" ID_CANCEL or ID_ACCEPT message, in order to have it close
> > > itself and return control to its parent window?
> > 
> > 
> > This should do the trick:
> > 
> > 
> > dialog.handle(self, FXSEL(SEL_COMMAND, FXDialogBox::ID_ACCEPT), nil)
> > 
> > 
> > Hope this helps,
> > 
> > 
> > Lyle
> > 
> 
> Hi, Lyle.
> 
> Thanks for your tip, but I am afraid it didn't work.
> 
> The point is that I have the following code, in my custom dialog box:
> 
> 
> def execute
> 	t = Thread.new { regressao }
> 	super
> end
> 	
> def regressao
> 	while @regressor.progress > 0 do
> 		@regressor.progress -= 1
> 		sleep 0.05
> 	end
> 	handle(self, FXSEL(SEL_COMMAND, FXDialogBox::ID_ACCEPT), nil)
> end
> 
> 

Well, while waiting for any more hints, I was wandering why the program
was hanging, and I thought it was because the creation of the new thread
was happening inside the overridden version of execute (before the call
to super).

So I dedided to create a new method, ini, to which I moved the line "t =
Thread.new { regressao }", and which is called from the main window just
before calling dialog.execute. It firstly seemed to work, but now I got
a segmentation fault at exactly the line for the call to handle(...).

Does anybody know what I am doing wrong?

TIA,

-- 

angico
------
home page: www.angico.org
Gnu/Linux, FLOSS, Espiritismo, e eu por mim mesmo 8^I
------
contatos:
email: angico at angico.org
skype: an.gi.co
------



More information about the fxruby-users mailing list