Re: How to hide & close main win on open (win32lib)

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

> Subject: Re: How to hide & close main win on open (win32lib)
> 
> 
> posted by: xEmul <xemul at ukr.net>
> 
> Derek Parnell wrote:
> 
>>> 
>>> xEmul wrote:
>>
>>>> > 
>>>> > Hello!
>>>> > 
>>>> > I need help!
>>>> > I have 2 windows: win1 and win2
>>>> > win1 used by WinMain
>>>> > How I can do following:
>>>> > 1. on open win1 show modal win2, but don't show win1
>>>> > 2. on close win2 close app without showing win1
>>>> > 
>>>> > (1) may be realised by openDialog. But if I close win2 - win1 is appear
>>>> > and
>>>> > don't close
>>>> > if I use openWindow(win2, Modal) - win1 is appear immediately,
>>>> > but on close win2 correct work closeApp
>>>> > 
>>>> > It may be the same as showing password dialog
>>>> > and closing app by hiting Cancel button on it
>>>> > 
>>
>>> This might be the sort of thing you are after ...
>>> 
>>> }}}
<eucode>
>>> include win32lib.ew
>>> 
>>> constant win1 = create( Window, "Application Window", 0, 0, 0, 300, 500, 0 )
>>> constant win2 = create( Window, "Login", 0, Center, Center, 200, 200, 0 )
>>> constant btn1 = create( Button, "Cancel", win2, 20, 20, 50, 25,0)
>>> constant btn2 = create( Button, "Accept", win2, 20, 80, 50, 25,0)
>>> 
>>> integer vCancelling vCancelling=0
>>> 
>>> procedure main_open( integer self, integer event, sequence params )
>>>     openDialog( win2 )
>>>     if vCancelling then
>>>         returnValue(-1)
>>>     end if
>>>     
>>> end procedure
>>> setHandler( win1, w32HOpen, routine_id("main_open") )
>>> 
>>> procedure click_cancel( integer self, integer event, sequence params )
>>>     vCancelling = 1
>>>     closeWindow( findParent(self))
>>> end procedure
>>> setHandler( btn1, w32HClick, routine_id("click_cancel") )
>>> 
>>> procedure click_accept( integer self, integer event, sequence params )
>>>     vCancelling = 0
>>>     setText(win1, "User has logged in")
>>>     closeWindow( findParent(self))
>>> end procedure
>>> setHandler( btn2, w32HClick, routine_id("click_accept") )
>>> 
>>> WinMain( win1, Normal )
>>> 
>>> </eucode>
{{{

>>> 
>>> -- 
>>> Derek Parnell
>>> Melbourne, Australia
>>> irc://irc.sorcery.net:9000/euphoria
>>> 
> 
> Thanks...
> I tried the same variant much early...
> But if on open main win we return -1 - it keep EXW.EXE in process list...
> 

Don't forget to add an abort(0) statement after the returnValue(-1) in 
click_cancel(). closeWindow() just asks Windows to terminate a window exw.exe 
created, it doesn' terminate exw.exe itself. It would terminate some 
application if that window was the main window of some app, but this is not 
the case here.

CChris

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

Search



Quick Links

User menu

Not signed in.

Misc Menu