Author |
Topic: Show and hide window (Read 210 times) |
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: Show and hide window
« Reply #1 on: Jun 24th, 2017, 11:21pm » |
|
on Jun 24th, 2017, 10:00pm, flotulopex wrote:| There might be a "simple way" to show and/or hide a window...or does it have to be open/closed every time it is used? |
|
I think you can use the 'show' and 'hide' GUI commands with a window as well as with a control. Something like this might work:
Code:[MouseMove]
IF MouseX > 1900 THEN #Side "show"
IF MouseX < 1720 THEN #Side "hide"
WAIT Richard.
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: Show and hide window
« Reply #2 on: Jun 25th, 2017, 09:30am » |
|
on Jun 24th, 2017, 11:21pm, Richard Russell wrote:| I think you can use the 'show' and 'hide' GUI commands with a window as well as with a control. |
|
Here's your entire program adapted accordingly; it seems to work for me. I've commented out the LOADBMP statements because I don't have your bitmaps; instead I've filled the 'side' window with red to make it visible:
Code:' TwoWindows.bas
NOMAINWIN
GRAPHICBOX #Main.GBx1,0,0,DisplayWidth,DisplayHeight
STYLEBITS #Main.GBx1,0,_WS_BORDER,0,0
GRAPHICBOX #Side.GBx1,0,0,200,DisplayHeight
STYLEBITS #Side.GBx1,0,_WS_BORDER,0,0
[MAIN]
WindowWidth = DisplayWidth
WindowHeight = DisplayHeight
' LOADBMP "Back", DefaultDir$ + "\" + "BACK.bmp" 'DisplayWidthxDisplayHeight bmp file
OPEN "BACK" FOR window_popup AS #Main
#Main "TRAPCLOSE [QuitMain]"
#Main.GBx1 "down"
#Main.GBx1 "drawbmp Back 0 0"
#Main.GBx1 "when leftButtonDown [MouseLeftButton]"
#Main.GBx1 "when mouseMove [MouseMove]"
UpperLeftX = DisplayWidth-200
UpperLeftY = 0
WindowWidth = 200
WindowHeight = DisplayHeight
'LOADBMP "Side", DefaultDir$ + "\" + "SIDE.bmp" '200xDisplayHeight bmp file
STYLEBITS #Side,0,_WS_VISIBLE,0,0
OPEN "SIDE" FOR window_popup AS #Side
#Side.GBx1 "down; fill red"
#Side.GBx1 "drawbmp Side 0 0"
WAIT
[QuitMain]
CLOSE #Main
CLOSE #Side
END
[MouseLeftButton]
IF (MouseX < 10 AND MouseY < 10) THEN GOTO [QuitMain] 'clic on top left = QUIT
WAIT
[MouseMove]
IF MouseX > DisplayWidth-20 THEN #Side "show"
IF MouseX < DisplayWidth-200 THEN #Side "hide"
WAIT Richard.
|
|
|
|
flotulopex
Junior Member
member is offline


Gender: 
Posts: 94
|
 |
Re: Show and hide window
« Reply #3 on: Jun 25th, 2017, 10:16am » |
|
Thanks a lot Richard. It works effectively.
I spent all my Saturday afternoon searching for this (...).
Thank you again
|
|
Logged
|
Roger
|
|
|
flotulopex
Junior Member
member is offline


Gender: 
Posts: 94
|
 |
Re: Show and hide window
« Reply #4 on: Jun 25th, 2017, 10:39am » |
|
BTW, where can I find info about the _WS_VISIBLE stylebit?
I can't find it in the help file.
These area the ones listed in the help file: _WS_BORDER Creates a window that has a thin-line border. _WS_CAPTION Creates a window that has a title bar (includes the WS_BORDER style). _WS_HSCROLL Creates a window that has a horizontal scroll bar. _WS_MAXIMIZE Creates a window that is initially maximized. _WS_MAXIMIZEBOX Creates a window that has a Maximize button. _WS_MINIMIZE Creates a window that is initially minimized. Same as the WS_ICONIC style. _WS_MINIMIZEBOX Creates a window that has a Minimize button. _WS_VSCROLL Creates a window that has a vertical scroll bar.
|
|
Logged
|
Roger
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: Show and hide window
« Reply #5 on: Jun 25th, 2017, 11:20am » |
|
on Jun 25th, 2017, 10:39am, flotulopex wrote:| BTW, where can I find info about the _WS_VISIBLE stylebit? |
|
MSDN has a list of style bits here, including that one.
I'm not sure it is strictly necessary in your program, but I wanted to avoid the side window initially appearing, even if only for a brief 'flash'.
Richard.
|
|
Logged
|
|
|
|
flotulopex
Junior Member
member is offline


Gender: 
Posts: 94
|
 |
Re: Show and hide window
« Reply #6 on: Jun 25th, 2017, 3:35pm » |
|
Quote:| I wanted to avoid the side window initially appearing, even if only for a brief 'flash'. |
|
This is just perfect! Looks much more "pro".
Thanks again.
Rog'
|
|
Logged
|
Roger
|
|
|
|