Cloes/Maximize/Minimize buttons

BlitzPlus Forums/BlitzPlus Programming/Cloes/Maximize/Minimize buttons

sswift(Posted 2004) [#1]
In my Blitzplus app, I allow the user to switch from full screen to windowed mode. When I make the switch to windowed mode, there are no maximize minimize or close window buttons.

1) How do I create these buttons in the windowed mode?

2) How can I trap the events triggered by these buttons so that:

a) When the user hits close it displays an end screen.
b) When the user hits minimize the window minimizes.
c) When the user hits maximize, it switches to full screen mode.

3) Do I need to do anything special to minimize the app from fullscreen mode? Do I need to switch to winowed mode first?


pantsonhead.com(Posted 2004) [#2]
This code allows you to put Min/Max buttons on a fixed-size window
http://www.blitzbasic.com/codearcs/codearcs.php?code=897


sswift(Posted 2004) [#3]
I swear I don't know how anyone codes in windows.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/Windowing/Windows/WindowReference/WindowStyles.asp

Look at this crappy documentation. It's confusing as hell. Took me a half hour to find this, and it doesn't show what the values of those constants actually are. Search for any of the constants in the search box and you get a hundred pages.

I found a site on visual basic that contains some of the constants, but they make no sense. WS_MINIMIZEBOX and WS_GROUP both are values which you can set for the window style, but they both are equal to "&H20000".

How can they both equal the same value, and what the heck does &H mean anyhow? IT's a value assigned to a constant, so the & must be the data type... It's not a C style pointer reference... So what is the H for? Hexedecimal? Maybe in VB &H means hexadecimal and &B means binary? I'm not sure, it's been a long time since I used VB.

Anyhow let's assume it means hexadecimal. That still leaves both values equaling $20000.

And I see no window style for adding a close button. Ugh.


sswift(Posted 2004) [#4]
I found this list of Win32 constants in the code archives:
http://www.blitzbasic.com/codearcs/codearcs.php?code=589

It's quite useful. Still doesn't explain though why those two constants have the same value, and there does not appear to be a constant which looks like it would add a close button.


WolRon(Posted 2004) [#5]
I don't think WS_GROUP is exactly a window style. It's supposed to group controls together. You probably would not use this during the window creation. But it's been a long time since I've programmed in Windows...


sswift(Posted 2004) [#6]
Hm... well I don't think it matters now.

I think In Blitzplus, what you can do is make a window, and then make a canvas, and use the canvas as the buffer instead of using the graphics command to make a window. You can use the graphics command if you want to go full screen though.

Of course there are new problems assoiated with this. If I make a resizeable window, the maximize button works and makes the window fill the screen, but not the graphics. I would prefer that the maximize button switch between full screen and windowed mode. I can detect that the window has been maximized, but I dunno if I'm gonna get a glitch when I resize it back to normal before I switch modes or not.


pantsonhead.com(Posted 2004) [#7]
If you lock the canvas using SetGadgetLayout it will resize with the window.
http://www.blitzbasic.com/bpdocs/command.php?name=SetGadgetLayout&ref=gui_cat

Obviously canvas stretching doesn't really work well unless width/height ratio is consistent so a resizable window doesn't sound ideal, but you CAN put min/max buttons on a fixed size window if you use the code posted above. Then you could have 3 window states of Maximized/minimized/default size.

Another option would be to create a resizeable window and create the canvas as big as the screen and then alter your code to respect the current clientwidth/height. This would be less attractive unless your users would benefit from any height/width combination

If you REALLY want to have a fixed window that you can maximize to full screen (with no title bar) then I you can do it with TWO window. A fixed window that is shown when the application appears minimized or windowed and a fullscreen/notitle window which is filled by a canvas which is displayed when the application is Maximized.
To make this work you would show/hide the windows as the user changes views and cange your target canvas.
However, if you want to set the fullscreen window's resolution then you have a completely different barrel of rotten apples...

Hopefully one of these approaches will help with what your application needs.