Createwindow with minimize and close button only?
BlitzMax Forums/MaxGUI Module/Createwindow with minimize and close button only?
| ||
Hi! Is it possible to create an app window with just these 2 buttons? Or at least is there a way to disable the maximize button? Thanks! Grisu |
| ||
To have the window size always the same you could also use the min and max ...Local Window1:TGadget = CreateWindow:TGadget("Window1",279,96,200,200,Null,WINDOW_TITLEBAR|WINDOW_RESIZABLE ) SetMinWindowSize( Window1:TGadget, 200 , 200 ) SetMaxWindowSize( Window1:TGadget, 200 , 200 ) |
| ||
I think if your window has both minimize and maximize buttons you can use Style = 2 to invert them (disable). Play around with it.Function ModifyWindowButtons(Gadget:TGadget, Style:Int = 1) Local hWnd_temp:Int = QueryGadget(Gadget, QUERY_HWND) Local xs:Int = GetWindowLong(hWnd_temp, - 16) Select Style Case 1 xs :| $20000 'WS_MINIMIZEBOX - add Minimize button xs :| $10000 'WS_MAXIMIZEBOX - add Maximize button Case 2 xs :| $20000 'WS_MINIMIZEBOX - add Minimize button Case 3 xs :| $10000 'WS_MAXIMIZEBOX - add Maximize button End Select SetWindowLong hWnd_temp, -16, xs UpdateWindowMenu Gadget End Function |
| ||
Thanks for the help guys! Here's a fully working test code.... |
| ||
I found this code very useful too, thanks! Is sad it's not available in the actual language itself though. >.< I'm sorry for bumping a one year old thread (but the threads in this forum never go old in my opinion, the search function is a hot button for me at least), but I updated the function and wanted to share it with you others, in case more people been struggling with this. This version works fine with both resizable and static windows and lets you both enable and disable the buttons as you like: I could have made it more like the original example though, with only one variable reference for the style in the function. But I prefer this system with one reference for each button instead myself; the amount of combinations is a bit much to remember if giving the same flexibility to a single reference covering both buttons. ^^; |
| ||
Old thread, but here's a Windows-only, non-MaxGUI method:Strict ?Win32 Extern "win32" Function GetActiveWindow%() End Extern ? Graphics 800,600 ccEnableMinimize(getActiveWindow()) While Not KeyDown(key_escape) Delay 1 Wend Function ccEnableMinimize(hwnd:Long) ' Adds the Minimize Button "_" ?Win32 Local tmp:Long = GetWindowLongA( hwnd, GWL_STYLE ) tmp:|WS_MINIMIZEBOX SetWindowLongA( hwnd, GWL_STYLE, tmp ) DrawMenuBar( hwnd ) ? End Function |