1. How to hide & close main win on open (win32lib)

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

new topic     » topic index » view message » categorize

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

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
> 

I think this does what you're asking for:
include win32lib.ew

constant
win1 = create( Window, "Win1", 0, Default, Default, Default, Default, 0 ),
openwin2 = create( PushButton, "Open Window", win1, 10, 10, 90, 30, 0 ),
win2 = create( Window, "Win2", win1, Default, Default, Default, Default, 0 )

procedure click_open( integer self, integer event, sequence params )
	showWindow( win1, SW_HIDE )
	openDialog( win2 )
	showWindow( win1, SW_NORMAL )
end procedure
setHandler( openwin2, w32HClick, routine_id("click_open") )

WinMain( win1, Normal )


Matt Lewis

new topic     » goto parent     » topic index » view message » categorize

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

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 ...

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 )


-- 
Derek Parnell
Melbourne, Australia
irc://irc.sorcery.net:9000/euphoria

new topic     » goto parent     » topic index » view message » categorize

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

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...

new topic     » goto parent     » topic index » view message » categorize

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

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
> 

I want hide and close main window on its open event without appearing
and free PC memory from exw.exe

Is it possible?

new topic     » goto parent     » topic index » view message » categorize

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

> 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 message » categorize

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

>
> posted by: xEmul <xemul at ukr.net>
>
> 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
> >
>
> I want hide and close main window on its open event without appearing
> and free PC memory from exw.exe
>
> Is it possible?
>

If I understand what you're wanting correctly, it wouldn't seem likely that
you could free PC memory from exw.exe, 'cause exw.exe *has* to be running to
be showing win2, I think.

Dan Moyer

new topic     » goto parent     » topic index » view message » categorize

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

Christian Cuvier wrote:
> 
> > 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

Thanks a lot!!!!
Combination of returnValue(-1) and abort(0)
work absolutely correctly!

new topic     » goto parent     » topic index » view message » categorize

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

xEmul wrote:

[snip]
> 
> Thanks...
> I tried the same variant much early...
> But if on open main win we return -1 - it keep EXW.EXE in process list...

There is a mistake in the library. To fix it, find the procedure 'WinMain' in
win32lib.ew then locate the line ...

    openWindow( {id,lInitFocus}, style )

and add after that line ...

    if ctrl_Closed[id] then
       return
    end if

That will correct my mistake.

-- 
Derek Parnell
Melbourne, Australia
irc://irc.sorcery.net:9000/euphoria

new topic     » goto parent     » topic index » view message » categorize

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

Derek Parnell wrote:
> 
> xEmul wrote:
> 
> [snip]
> > 
> > Thanks...
> > I tried the same variant much early...
> > But if on open main win we return -1 - it keep EXW.EXE in process list...
> 
> There is a mistake in the library. To fix it, find the procedure 'WinMain' in
> win32lib.ew
> then locate the line ...
> 
>     openWindow( {id,lInitFocus}, style )
> 
> and add after that line ...
> 
>     if ctrl_Closed[id] then
>        return
>     end if
> 
> That will correct my mistake.
> 

Has anybody been keeping track of all updates since 60.6?  I once tried updating
by applying patches via EUforum searches but I ended up with a broken mess so I
reverted back to the original release.  The Win32Lib patches page still shows
"(none reported)".

Thanks,
-- Brian

new topic     » goto parent     » topic index » view message » categorize

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

Derek Parnell wrote:
> 
> xEmul wrote:
> 
> [snip]
> > 
> > Thanks...
> > I tried the same variant much early...
> > But if on open main win we return -1 - it keep EXW.EXE in process list...
> 
> There is a mistake in the library. To fix it, find the procedure 'WinMain' in
> win32lib.ew
> then locate the line ...
> 
>     openWindow( {id,lInitFocus}, style )
> 
> and add after that line ...
> 
>     if ctrl_Closed[id] then
>        return
>     end if
> 
> That will correct my mistake.
> 
> -- 
> Derek Parnell
> Melbourne, Australia
> irc://irc.sorcery.net:9000/euphoria
> 

Thanks a lot!
It work fine

Can you collect all known bugs into win32lib patch or new version?

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu