Re: wxEuphoria - questions and concerns

new topic     » goto parent     » topic index » view thread      » older message » newer message

Greg Haberek wrote:
> 
> I noticed wxEVT_SHOW seems to trigger *before* the window is shown, and
> wxEVT_ACTIVATE triggers *after* the window is shown. Therefore, I use
> wxEVT_SHOW to prompt for a login from the user. However, I have no way
> of stopping the main window from opening if the user clicks Cancel on
> my dialog. In Win32Lib, I could use returnValue( -1 ), but I don't know
> of such a mechanism in wxEuphoria. I tried exit_main() but it does not work.

Yes, looking through the code (for gtk, at least) wxEVT_SHOW is called 
after the window is actually shown.  While you can't stop it from showing, 
you could destroy() it, which will also cause the event loop to shut down,
and control will return from wxMain().  I assume this is the effect you 
wanted to have.

> Also, I noticed a bug with wxEVT_ACTIVATE. If you spawn a console window
> with something like ? 1 or whatever, the console window and main window
> will continue to trigger wxEXT_ACTIVATE events. Worse yet, if you call
> message_box() during this event, you'll end up in an infinite loop of
> message boxes. I learned this the hard way. :(

http://www.wxwidgets.org/manuals/stable/wx_wxactivateevent.html#wxactivateevent
The wxWidgets docs state this:

    A top-level window (a dialog or frame) receives an activate event when 
    it is being activated or deactivated. This is indicated visually by the 
    title bar changing colour, and a subwindow gaining the keyboard focus.

    An application is activated or deactivated when one of its frames becomes
    activated, or a frame becomes inactivated resulting in all application 
    frames being inactive.

    Please note that usually you should call event.Skip() in your handlers
    for these events as not doing so can result in strange effects.

Basically, the wxEVT_ACTIVATE will be called often.  Also, this happens 
before the main event loop is entered.  Looking at the code for wxMain
(which is basically my own expansion of the standard MAIN macros that
would be used by a C++ wxWidgets program):

void WXEUAPI  wxMain(int topWindow)

{

	EuApp::wxEuApp->SetTopWindow( (wxWindow *) topWindow );

	((wxFrame *)topWindow)->Show(true);

	EuApp::wxEuApp->MainLoop();

}

I think that what you want to do is to show your dialog before you call
wxMain, and then decide whether you want to call it or not.  Or simply
use euphoria's abort() instead of continuing.

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu