

Debug "Finished SizeWindow of window: " + GetWindowTitle(EventWindow)
Purebasic window outer size code#
Note: Following code isn't needed, as it's fully covered by the BindEvent() functions! OpenWindow(2, 470, 300, 400, 200, "PureBasic 2nd Window", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget)īindEvent(#PB_Event_SizeWindowFinished, 2) If OpenWindow(1, 50, 100, 400, 200, "PureBasic Window", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget) here further action on this specific window can be going on :-)"ĭebug " new pos+size: " + WindowX(2) + "," + WindowY(2) + " with " + WindowWidth(2) + "x" + WindowHeight(2) here further action on this specific window can be going on :-)"ĭebug " new pos+size: " + WindowX(1) + "," + WindowY(1) + " with " + WindowWidth(1) + "x" + WindowHeight(1)ĭebug "UpdateSize_2ndWindow() function reached. If OpenWindow(1, 100, 200, 195, 260, "PureBasic Window", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget)īindEvent(#PB_Event_SizeWindow, = WaitWindowEvent()ĭebug ".new window size: " + WindowWidth(1) + "x" + WindowHeight(1)ĭebug "UpdateSize_1stWindow() function reached. PostEvent(#PB_Event_SizeWindowFinished, window, 0) RemoveWindowTimer(window, #TimerSizeWindow)

Protected window, dx, dy, delta_dx, delta_dyĪddWindowTimer(window, #TimerSizeWindow, 200)

Length ReadData (FileNumber, Buffer, Length) EndIf Close the file. Buffer AllocateMemory (Length) Read the file into the buffer. FileNumber OpenFile ( PBAny, File) Length Lof (FileNumber) If File And Length Allocate a memory buffer to hold the file. Static old_dx, old_dy, timer, time_dx, time_dy Size FileSize (File) If Size < 1 ProcedureReturn EndIf Open the file. With my question I initially hoped, that there isn't needed any workaround, if there would be some additional OS events on Windows/MacOS (not natively supported by PB), which could be used instead of #PB_Event_SizeWindow and which are only fired if the mouse was released by the user (= resizing finished).ĭebug "Update (window=" + window + ", dx=" + dx + ", dy=" + dy + ")" You can obviously store a C unsigned int (32 bit) inside a PureBasic long (32 bits) since the binary value is correctly stored and it's just a matter of interpretation if it's signed or not, but PureBasic will still consider it a signed number for example in comparisons, leading to problems. So this workaround would be visible for the user.Ĭurrenty the solution of mk-soft seems the way to go.

All files are 'EnableExplicit safe' and 'Multiple-include safe' 7Zip. My goal is to react (at least for some parts of my GUI, see first post) only when the user has finished the resizing (= released the seems to work fine, at least here on Win10 (need to be tested on MacOS during resizing the hiding/displaying of the second window leads to a mostly hidden titlebar of the main window during resizing. PureBasic Includes A variety of useful Include Files for PureBasic projects Most of these come from my own projects, others were written for the PB forums, and some were never used at all. Thank you for your suggestions, This "normal behaviour" is what I want to avoid, because in this case every change of the window size will be recognized and my "UpdateSize" procedure need to react already during resizing of the window by the user.
Purebasic window outer size windows#
)Ĭurrently I have only the idea of a workaround: save the old window size (before resize was started) and don't react to every pixel change, but to every +/- 10 pixel or more.Īnyone has a code example, which works on Windows and MacOS? (probably even a feature-request for a new #PB_Event_SizeWindowFinished or similar. What was called a bug here, is my wanted behaviour The only releated thread I found is this one. So I'm searching for a solution, where the GUI/dialog resize function is only called, when the mouse cursor was released and the user's resizing action is finished. This can be useful of course, but as I'm having very complex GUIs / dialogs (containing a lot of gadgets, charts, filled listicons which content need to be recalculated after a size change, etc.) I can't and don't want to react to every window width/height change (for only 1 pixel) while the user is still resizing the window. So an event is triggered already while the user has the mouse cursor still pressed. Using the #PB_Event_SizeWindow event I'm currently getting resize events after every single pixel change in width/height of the window.
