Maximise Button (again) [MAXGUI]+[NON]
BlitzMax Forums/BlitzMax Beginners Area/Maximise Button (again) [MAXGUI]+[NON]
| ||
Hello! Does someone know how one can: 1. Create a plain window with maxgui (no statusbar, menu!) and check if the maximise button is clicked? The helptext given to "Createwindow" doesn't give that much info... :( 2. Check the maximise Button event with a normal app in window mode? "Graphics 800,600,0" e.g. |
| ||
1. just check for a EVENT_WINDOWSIZE event 2. cant help you there :-( |
| ||
2. Impossible without rewriting the DX and OGL Max2D modules to make use of MaxGUI directly (or adding the features you need manually) - and these modules are an absolute shambles. |
| ||
Thanks for the answers. My idea was to create a window with maxgui as a workaround. But even this seems impossible for me, I just want to create a 800x600 window with min, max, close buttons, NON resizable. But I don't know the flag to set such a window. And the helpfile does not list all flags possible here. :( |
| ||
This example should make a 800x600 window with min,max,close buttons that cannot be resized.Graphics 800,600,0 Extern "win32" Function GetActiveWindow() Function GetWindowLongA(hWnd%, nIndex%) = "GetWindowLongA@8" Function SetWindowLongA(hWnd%, nIndex%, uFlags%) = "SetWindowLongA@12" Function DrawMenuBar%(hMenu%) End Extern Const WS_MAXIMIZEBOX:Long = $10000 Const WS_MINIMIZEBOX:Long = $20000 Const GWL_STYLE:Int = -16 ' example Local handle:Long = GetActiveWindow() fixWindow( handle ) Repeat Cls SetColor 255,255,255 DrawText "Window with minimize, maximize and close button.", 20,20 DrawText "that cannot be resized.", 20,40 Flip Until KeyHit(KEY_ESCAPE) Or AppTerminate() Function fixWindow( hWnd:Long ) Local tmp:Int = GetWindowLongA( hWnd, GWL_STYLE ) tmp = tmp | WS_MAXIMIZEBOX tmp = tmp | WS_MINIMIZEBOX SetWindowLongA( hWnd, GWL_STYLE, tmp ) DrawMenuBar( hWnd ) End Function |
| ||
zawran, the idea was to switch over to Maxgui. There one should be able tracking the click of the maximise button. Though I don't know how. I have your code to show a maximise button with normal bmx, but as we can't check the event there. Its kind of useless for my purpose. |
| ||
I don't think that you can get an event for clicking on the maximize button even with maxgui. From what I have been able to find so far, you can only get events from the window being resized, but that could also be because its being minimized. I have been trying to find out via the MSDN website, but nothing so far. But I will keep looking as I could use this myself. |
| ||
I'm frustrated that such "simple" suff can't be done with bmx. Every windows app has these 3 buttons. Why is this so difficult for bmx? :(((((((((((( |
| ||
See: WindowMaximized( window:TGadget ) WindowMinimized( window:TGadget ) SetMinWindowSize( window:TGadget,w,h ) |
| ||
...Oops, brain spasm... |
| ||
the only answer I have: this is the first version of MaxGUI, in the next update will have 'more control' on the interface... I hope so! |
| ||
WindowMaximized( window:TGadget ) WindowMinimized( window:TGadget ) Unless I am mistaken, which I might well be, then those commands only tells you if the window is either maximized or minimized, and they cannot be used to capture the event that someone clicks on the buttons. But one could ofcause make a flag variable which holds the current state, and then check that against the WindowMaximized result and then act on that. Its just not the same as getting an actual event trigger from the user clicking. I have been trying to dig through the MSDN info, but haven't found any events that does this, so I am not even sure that it can be done internally in windows and therefore probably not be done with MaxGUI either. |
| ||
Perhaps Jim can explain that a bit? I confess this stuff is too high for me... :( |
| ||
I found this topic using the search engine, anybody knows how can i scale the viewport of the game when i use the maximize button? |
| ||
Local rect[4] GetClientRect GetActiveWindow(),rect Local width=rect[2]-rect[0] Local height=rect[3]-rect[1] That'll get you the width/height of the graphics window. |
| ||
Thanks but i think i would need more help, how do i scale all the game images thinking that i use the setscale function and different imagehandles to make some effects? Can i draw it first in an image like a render to texture and then scale this image? Donno what to do -_- |
| ||
After the graphics window is finished sizing or while it's sizing use SetViewport 0,0,GraphicsWidth(),GraphicsHeight(). I think this is what you're talking about. |
| ||
No, that doesnt fix my problem, when i click the maximize button the graphicswidth and graphicsHeight still the same, and i dont think that using only the setviewport function will fix my problem, i need a way to scale the whole viewport too! |
| ||
Just curious Josepho, did you ever manage to work out what you wanted to do as I`m after something similar. Jason. |
| ||
Projection Matrix. I'm using the code from Yan's post, about 2/3 of the way down that page. By the way, its much easier to use than it first appears! You basically set the screen resolution as normal, then use TVirtualGraphics.set() - this will stay the same throughout your game, even if the user changes screen res (Just call TVirtualGraphics.set() again). I write my game logic to run correctly at 800x600, so I just give those parameters to TVirtualGraphics. Other than that, any occurence of GraphicsWidth()/GraphicsHeight() should be replaced with TVirtualGraphics.VirtualWidth/VirtualHeight, and use TVirtualGraphics.MouseX()/MouseY() instead of the usual MouseX() and MouseY(). That's about it. |
| ||
Thanks GfK. Now that you mention it I seem to recall you telling me about this before in another post and I did think it was a little complex at the time. I`ll be sure to have another look at it though. Cheers, Jason. |