Prevent User from Resizing the Main Window

We set the main window size at the start of our solution as follows:

application.setWindowSize( x, y )

which works just fine. However, we would like to prevent the user from resizing the main window beyond the ( x, y ) values…that is, making the main window smaller is okay, but not bigger. How is this accomplished?

Thanks!

kwpsd:
We set the main window size at the start of our solution as follows:

application.setWindowSize( x, y )

which works just fine. However, we would like to prevent the user from resizing the main window beyond the ( x, y ) values…that is, making the main window smaller is okay, but not bigger. How is this accomplished?

Thanks!

In the upcoming Servoy 5.1 there is a new form event “onResize” that could help accomplish this set it to a main form, (and every other forms will be called in a tab panel inside that form), and attach a method to the onResize method, that would check the new size of the window and reset it if its width or height is superior to the one you have fixed.

this is a total other discussion, (I know! ;-) ) but I’m curious why developers often want to set the window of there appliction, to a fixed size or (even worse) there own position. :evil:
I have seen many Filemaker/Servoy application doing that!

But the strange thing is, that I have NEVER seen any other application doing that. Look at all Microsoft Office apps, look at all Apple apps, they ALL let you create/set your own window size & position, and stick to that

Again, total other discussion, but I’m still curious, why you want to do that… :wink:

I agree with Harjo on those points…but I think there is definatly a need to be able to set the minimum size of the window, perhaps also a way to set the maximum size.
Many (if not all) apps do/have that.

I guess I will file a feature request for this as a solution property…together with a weighted anchor for elements (although we have the onResize event now…).
All of which, I think, will make the need for setting a specific (other than minimum) window size go away.

Hi Rob

I would like to have the minimumWindowSize as well, as for some apps it just makes no sense going smaller. Especially as in Servoy the behaviour changes when going smaller than the design time sizes of objects.

Regards, Robert

I added 2 cases:

#273826 Solution property to set minimum and maximum window size
#273827 Weighted anchor support on elements (kinda like we have now in the new splitpane object)

minimum size & weighted anchors, are indeed a nice to have!
but still think, that setWindow & position, should be used ONLY once (first time start) and than never touched again. ;-)

Harjo et al.

Perhaps, I am just spoiled. I come from a Visual FoxPro (VFP) programming environment where it is possible to set the minimum and maximum main window screen size.

The reason I was asking about the maximum screen size is that I have form objects off to the side (that is, outisde of the defined form size in Developer) that I do no want the end user to see. Setting the initial maximum screen size hides these objects from the user, but if they resize the main screen, those ‘hidden’ objects are now exposed. In VFP, setting the maximum screen size ensured that the user could not see these objects. How would you do this with anchors?

Robert…thanks for submitting the feature requests. I was going to do that myself, if I could not get an answer on the forum.

Regards to all!

Hi Kim,

place them not at the right side, but under, the body or footer,
than they will never be seen/exposed. You still got warnings in servoy 5.x telling that elements are outside the boundary

why dont you do a on showMethod where you set the elements to invisible?

forms[form].elements[element].visible = false;

ROCLASI:
I added 2 cases:

#273826 Solution property to set minimum and maximum window size
#273827 Weighted anchor support on elements (kinda like we have now in the new splitpane object)

Stupid questions: what is “weighted anchor”? and where is it on the JSplitPane bean?

Hi David,

david:
Stupid questions: what is “weighted anchor”? and where is it on the JSplitPane bean?

A weighted anchor can resize/move between 0% and 100% of the actual resize. So when you have a field centered in a window with a 50% left-anchor and 50% right-anchor and you resize the window the field will stay centered no matter what and doesn’t grow/shrink.
That’s just one example.

And I was talking about the new (Servoy 5.1) SPLIT_HORIZONTAL/SPLIT_VERTICAL properties in the tabpanel (taborientation).
This will give you (unlike the JSplitPane bean) a webcapable splitpane. Here you have a resizeWeight property (0 to 1) to let the divider move with the window.

Hope this explains it.

Cool, thx. Nice additions.

Harjo:
this is a total other discussion, (I know! ;-) ) but I’m curious why developers often want to set the window of there appliction, to a fixed size or (even worse) there own position. :evil:
I have seen many Filemaker/Servoy application doing that!

But the strange thing is, that I have NEVER seen any other application doing that. Look at all Microsoft Office apps, look at all Apple apps, they ALL let you create/set your own window size & position, and stick to that

Again, total other discussion, but I’m still curious, why you want to do that… :wink:

+100000

I rather deprecate all those setWindow size and positions :)
dont call those methods…:(

jcompagner:

Harjo:
this is a total other discussion, (I know! ;-) ) but I’m curious why developers often want to set the window of there appliction, to a fixed size or (even worse) there own position. :evil:
I have seen many Filemaker/Servoy application doing that!

But the strange thing is, that I have NEVER seen any other application doing that. Look at all Microsoft Office apps, look at all Apple apps, they ALL let you create/set your own window size & position, and stick to that

Again, total other discussion, but I’m still curious, why you want to do that… :wink:

+100000

I rather deprecate all those setWindow size and positions :)
dont call those methods…:(

Even for startup? Form in dialogs? Setting to last user position and size (which we save down)? How about in kiosk mode?

I’m not a fan of fixed window sizes either but seems like there are a number of situations where these methods are required. I’ll gladly change however if there is a better way.

Form in dialog can be specified when you show it
But even then i wouldnt give them. Because if you just give -1 we show it in the preferred size. Which is in my eyes always what you want.

Kiosk mode is really different and doenst really have to do anything with sizes or locations of a ‘normal’ app.

You can set the initial size and position
Servoy already stores the size and position of the main application for you when a user closes the application.
So you dont have to do that.

How many times i did get a solution send in when i open it it jumps to a position and size right away all the time
I find that sooo annoying… :)

jcompagner:
Form in dialog can be specified when you show it
But even then i wouldnt give them. Because if you just give -1 we show it in the preferred size. Which is in my eyes always what you want.

Kiosk mode is really different and doenst really have to do anything with sizes or locations of a ‘normal’ app.

You can set the initial size and position
Servoy already stores the size and position of the main application for you when a user closes the application.
So you dont have to do that.

How many times i did get a solution send in when i open it it jumps to a position and size right away all the time
I find that sooo annoying… :)

I agree with everything and follows with what we’re doing in general practice. The initial size and position of the main window though – what would be the recommended way of setting those values if you deprecate the functions?

david:
I agree with everything and follows with what we’re doing in general practice. The initial size and position of the main window though – what would be the recommended way of setting those values if you deprecate the functions?

i was just joking a bit about deprecating them :)
(david should know me by now a bit better :))

was just to shake it a bit up that those methods should be used very carefully…

jcompagner:

david:
I agree with everything and follows with what we’re doing in general practice. The initial size and position of the main window though – what would be the recommended way of setting those values if you deprecate the functions?

i was just joking a bit about deprecating them :)
(david should know me by now a bit better :))

was just to shake it a bit up that those methods should be used very carefully…

Gotcha. It worked :)