Minimize without window style 2?
BlitzPlus Forums/BlitzPlus Programming/Minimize without window style 2?
| ||
I cant seem to find a way to use the minimize button without making the window resizable (style 2). Is there no way to have a non resizable window with minimize enabled and maximize disabled? |
| ||
make a normal button... (and you can use an underscore _ as buttontxt) and when $401 on that button, use MinimizeWindow. The only problem is that the button isn't on the dragbar of your window.. you might consider making a dragbar yourself, which is basicly a canvas and a routine to drag the canvas around the screen.. |
| ||
Thanks for the work around but having to make a "Minimize" button is ridiculous. This is a very basic and rudimentary style. If its not natively possible then I must seriously question just what kind of app language b+ really is. |
| ||
well b2d and b3d are game languages.. iirc b+ was released so that we all could make map editors and other GUI stuff needed for gamedev... I dunno if the intention of b+ was different, but from my pov it's a supportive language for 2d and 3d games.. however... I could be wrong here :) |
| ||
Right, I know what its about. I bought it on day one. My point is that not having basic things like this in an app language is just unacceptable. Doesn't anyone else find it strange that its currently impossible to create a fixed window that can be minimized? To me thats like leaving out labels or textboxes! |
| ||
Have a look at Fredborgs code for making a resizable blitz 3d window. http://www.blitzbasic.com/codearcs/codearcs.php?code=829 The important bit is this (taken from my own modifications) ; Get hWnd pointer for the Blitz Window bw_win\hWindow = GetActiveWindow() ; Set the Blitz Window Style bw_win\WindowStyle = WS_VISIBLE + WS_BORDER + WS_MINIMIZEBOX + WS_MAXIMIZEBOX + WS_SIZEBOX + WS_SYSMENU + WS_DLGFRAME; + WS_THICKFRAME SetWindowLong(bw_win\hWindow,GWL_STYLE,bw_win\WindowStyle) ; Resize and center Blitz Window MoveWindow(bw_win\hWindow,(bw_win\DesktopW/2)-(800/2),(bw_win\DesktopH/2)-(600/2),800,600,True) Make sure you add the movewindow stuff in otherwise the buttons don't show up. |
| ||
Thanks for the code Ben, ill try it when I get off work. |
| ||
No problem. I did get this working in blitz+ but can't find the code :) |
| ||
; Desktop Size Const SM_CXSCREEN=0 Const SM_CYSCREEN=1 ; Set Window Long Const GWL_WNDPROC =(-4) Const GWL_HINSTANCE =(-6) Const GWL_HWNDPARENT =(-8) Const GWL_STYLE =(-16) Const GWL_EXSTYLE =(-20) Const GWL_USERDATA =(-21) Const GWL_ID =(-12) ; Window Style Const WS_OVERLAPPED =$0 Const WS_POPUP =$80000000 Const WS_CHILD =$40000000 Const WS_MINIMIZE =$20000000 Const WS_VISIBLE =$10000000 Const WS_DISABLED =$8000000 Const WS_CLIPSIBLINGS =$4000000 Const WS_CLIPCHILDREN =$2000000 Const WS_MAXIMIZE =$1000000 Const WS_CAPTION =$C00000 Const WS_BORDER =$800000 Const WS_DLGFRAME =$400000 Const WS_VSCROLL =$200000 Const WS_HSCROLL =$100000 Const WS_SYSMENU =$80000 Const WS_THICKFRAME =$40000 Const WS_GROUP =$20000 Const WS_TABSTOP =$10000 Const WS_MINIMIZEBOX =$20000 Const WS_MAXIMIZEBOX =$10000 Const WS_TILED =WS_OVERLAPPED Const WS_ICONIC =WS_MINIMIZE Const WS_SIZEBOX =WS_THICKFRAME Const WS_OVERLAPPEDWINDOW=(WS_OVERLAPPED Or WS_CAPTION Or WS_SYSMENU Or WS_THICKFRAME Or WS_MINIMIZEBOX Or WS_MAXIMIZEBOX) Const WS_TILEDWINDOW =WS_OVERLAPPEDWINDOW Const WS_POPUPWINDOW =(WS_POPUP Or WS_BORDER Or WS_SYSMENU) Const WS_CHILDWINDOW =(WS_CHILD) ; Window Messages Const SW_HIDE=0 Const SW_SHOWNORMAL=1 Const SW_NORMAL=1 Const SW_SHOWMINIMIZED=2 Const SW_SHOWMAXIMIZED=3 Const SW_MAXIMIZE=3 Const SW_SHOWNOACTIVATE=4 Const SW_SHOW=5 Const SW_MINIMIZE=6 Const SW_SHOWMINNOACTIVE=7 Const SW_SHOWNA=8 Const SW_RESTORE=9 Const SW_SHOWDEFAULT=10 Const SW_MAX=10 Graphics 640,480,16,2 hwnd=GetActiveWindow() ;Style = WS_VISIBLE + WS_BORDER + WS_SYSMENU + WS_DLGFRAME + WS_MINIMIZEBOX Style = WS_VISIBLE + WS_BORDER + WS_SYSMENU + WS_MINIMIZEBOX SetWindowLong(hwnd,GWL_STYLE,style) MoveWindow(hwnd,0,0,640,480,True) Repeat Until KeyHit(1) End There you go. You need the userlibs from Fredborgs code snippet. The only problem is working out when people close the window, although there was a thread about that the otherday somewhere. |
| ||
Couldn't you use SetGadgetLayout for that? Or maybe use events so that when the user minimizes you just maximize it back up. These probably won't work (I'm a noob) but it might help. -Rich05 |
| ||
Thanks, but I believe theres some confusion over exactly what it is im asking for. This should help: I want a non resizable window (fixed) with a titlebar like this ![]() In b+ the only way to have a minimize button on your window is to make it resizable. That makes it impossible to have a fixed window that can be minimized without your own button. |
| ||
hm... I'd say create a resizeable window to get that [_] button, and use $802 to set the original windows-size back .. but that's indeed not exactly elegant :) |
| ||
Nullmind was kind enough to offer this example: [a ftp://user:blitz@...] 4k I think it does a good job and its very flexible. Thanks for the help again everyone. |
| ||
Looks like the mini.zip link above is dead. I have posted working B+ code example here: http://www.blitzbasic.com/codearcs/codearcs.php?code=897 |
| ||
Its on my website under articles. Good idea to submit it to the archives tho. |
| ||
Does anybody know why SetWindowLong(x,y,z) wont work if you have a statusbar in the window style? I notice that a statusbar can cause other user32 functions to fail also (like ShowWindow). Anyone got any ideas about this ? |