[fxruby-users] messages

angico angico at angico.org
Wed Oct 22 04:53:35 EDT 2008


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


Here, I create a thread just before calling super, to implement a
"regress" bar, shown in the dialog. I want the user to be prompted for
as long as n seconds (here, 5 seconds) and, if she didn't atend to the
dialog, the dialog takes a default action (in this case, the ID_ACCEPT).
The thread works just fine, with the regress bar showing pretty well,
but...

Well, inserting the line handle(...) from your tip just made the dialog
to freeze, with cpu usage hitting 100%. Program needs to be killed.

I have tried to move the thread "regressao" to the main window (the
parent window for the dialog), but it just doesn't get called.

So, any idea on how to solve this problem?

Thanks a lot,

-- 

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