[fxruby-users] Closing a modal FXDialogBox correctly?
Philippe Lang
philippe.lang at attiksystem.ch
Wed Jan 31 12:11:11 EST 2007
Hi,
Very rarely, I have a bug when closing a modal dialog box.
What is the 100% correct way of closing a modal dialog box,
programmatically, from within the dialog code itself?
Until now, I was using:
----------------------
self.handle(self, FXSEL(SEL_COMMAND, ID_ACCEPT), nil)
----------------------
... and it works 99% of the time.
After checking the fox C++ code, I found that such a call triggers code
like:
----------------------
getApp()->stopModal(this,FALSE);
hide();
----------------------
Where hide() does:
----------------------
if(flags&FLAG_SHOWN){
killFocus();
flags&=~FLAG_SHOWN;
if(xid){
#ifndef WIN32
XWithdrawWindow(DISPLAY(getApp()),xid,DefaultScreen(DISPLAY(getApp())));
#else
// if(getOwner() && getOwner()->id()){
// SetActiveWindow((HWND)getOwner()->getShell()->id()); // Fix
from Sander
// }
ShowWindow((HWND)xid,SW_HIDE);
#endif
}
}
----------------------
Is there a chance some code might be executing WHILE the dialog is being
closed, what could explain the crashes?
I have tried replacing:
----------------------
self.handle(self, FXSEL(SEL_COMMAND, ID_ACCEPT), nil)
----------------------
... with:
----------------------
close
$app.stopModal
----------------------
The "close" function has got code that might help:
----------------------
// Target will receive no further messages from us
setTarget(NULL);
setSelector(0);
----------------------
We'll see if helps. Unfortunately I cannot reproduce the bug.
Does anyone have the same rare problem maybe?
Philippe Lang
More information about the fxruby-users
mailing list