Window MinWidth & MinHeight values, to go with Lock resizing

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Keya
Addict
Addict
Posts: 1890
Joined: Thu Jun 04, 2015 7:10 am

Window MinWidth & MinHeight values, to go with Lock resizing

Post by Keya »

the Lock Left/Top/Bottom/Right features are brilliant as they make it soooo easy to turn a static window into a resizable one

BUT they don't prevent the WINDOW itself from getting too small, and it seems that the best place for that code would be in the ResizeGadgets() procedure that the IDE generates when Lock gadget checkboxes are set to handle resizing - actually i dont know where else I could put code to control window size seeing as that procedure is being called to handle sizing and it gets overwritten by the IDE so i cant make changes there.

So does anyone have a workaround solution in the meantime, that would allow me to prevent the window from getting too small, but at the same time allow PB's IDE to handle gadget resizing?

my code to prevent resizing is pretty simple, I just BindEvent the resizing event for my window to a procedure, and in that i get WindowWidth() and WindowHeight() like the generated code already does, and then basically "If WindowWidth < MinWindowWidth: WindowWidth = MinWindowWidth", followed by ResizeWindow

So it seems it would be very easy to add! please? huh? please? huhhuh? :D
User avatar
BasicallyPure
Enthusiast
Enthusiast
Posts: 539
Joined: Thu Mar 24, 2011 12:40 am
Location: Iowa, USA

Re: Window MinWidth & MinHeight values, to go with Lock resi

Post by BasicallyPure »

Hi Keya,

I would think

Code: Select all

WindowBounds(#Window, MinimumWidth, MinimumHeight, MaximumWidth, MaximumHeight)
will already do what you are asking assuming you know what MinWindowWidth is or perhaps I misunderstand what you are asking.
BasicallyPure
Until you know everything you know nothing, all you have is what you believe.
User avatar
Keya
Addict
Addict
Posts: 1890
Joined: Thu Jun 04, 2015 7:10 am

Re: Window MinWidth & MinHeight values, to go with Lock resi

Post by Keya »

Ah, perfect! muchas gracias
It seems it would be a natural addition to the visual designer, but perhaps its better to leave it out/how it is for flexibility
Post Reply