Minimum window size?
Posted
#1
(In Topic #457)
Guru

Is it possible to set a minimum window size so the form cannot shrink below the size of not being able to render controls properly and pumping out error messages?
I've tried using the Form_Resize() event to resize the window if it gets too small but it doesn't work.
Code
Public Sub Form_Resize()
Me.Width = Max(Me.Width, 600)
Me.Height = Max(Me.Height, 300)
Me.Refresh
EndThat almost works but it slips past the limits still somehow.
Posted
Guru

If the window is a new window set the minimum size in the IDE then open it with 'MyForm.ShowModal'.
If this is your main Form then, as above, set the minimum size in the IDE then add the following code to your program.
You will not be able to resize the Form smaller than set in the IDE, bigger is OK.
Posted
Guru

sadly now i've got a HSplt that's not initialising as it was and i can't seem to change it
also i'm getting a segmentation error when closing the app
I'll play some more and see if i can figure it out as i'm loving the way the form can't go any smaller.
We need to ask Ben for a Form.MiniminWitdth , Form.MinimumHeight setting i think. really needs one.
Best solution i have so far is this…
Code
Public Sub Form_BeforeArrange()
If Me.Width < 600 Then Me.width = 600
If Me.Height < 350 Then Me.Height = 350
End
By using that method the form is still going smaller than it should
Edit. I've altered the code above to exclude the Form_Resize() event code as it wasn't needed , just the Before_Arrange() event code can make the controls stop pumping out errors.
Posted
Guru

Posted
Guru

Would sure save a lot of messing about.
I couldn't use ShowModal without the segmentation fault 11
I even tried the SM_integer=Me.SowModal and Me.Close(SM_integer) still same error.
Ben now has the code and is looking over it.
Posted
Guru

Thanks anyway.
1 guest and 0 members have just viewed this.



