Scaling Forms to screen resolution

Forums for specific tips, techniques and example code
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Scaling Forms to screen resolution

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:11 pm

by JADE News Administrator >> Thu, 29 Oct 1998 5:09:52 GMT

You may think that your application's forms all look wonderful, until a User starts playing around with their screen resolution and switching between small and large fonts; then your beautiful application can suddenly look like a pile of custard.

By setting the "scaleForm" property on each of your forms to true, when Jade loads the form, the font's will be automatically scaled according to the workstation's current settings.

You can also preserve the general relative layout of your form's controls by setting the relative height, left, top and width to true. Then you can allow the User to resize the forms however they choose without losing the overall look of the form. Note that the comboBox does not have a relative height, so if you use the "Update all selected controls" option on the properties dialog, and the last control selected was a comboBox, then the relative height of all the other controls won't be set. You can get around this by deselecting another control (say a textBox) then reselecting it, and *then* setting the relative properties.
--
Darrell Duniam
dduniam@cnzmail.aoraki.co.nz
darrelld@ozemail.com.au

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Scaling Forms to screen resolution

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:11 pm

by JADE News Administrator >> Thu, 29 Oct 1998 5:10:26 GMT

BTW - The reason these properties default to false is because they were not a part of the original product, therefore, setting them to false ensures that an existing application does not behave any differently after being upgraded to a later version of Jade.

You could easily write a Jade script to set these properties by iterating thru the "Form.instances" collection.
--
Darrell Duniam
dduniam@cnzmail.aoraki.co.nz
darrelld@ozemail.com.au

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Scaling Forms to screen resolution

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:11 pm

by JADE News Administrator >> Thu, 29 Oct 1998 5:11:03 GMT

If you set the relative size and position properties of a form's controls to true at design-time, you may have noticed that when you resize the form in the painter, all of your controls are stretched with it. This is a wonderful feature at run-time, but it's a pain in the butt when designing your form(s). So, I've written a small method to set these properties at run-time instead, to save having to unset and reset them in the painter. I've implemented this method on my Form class, which I can then call from the "load" event of any form subclass.

setFormProperties(pScaleForm:Boolean;pRelativeSize:Boolean) updating;

vars
count : Integer;
begin

// Set the form's scale property.

self.scaleForm := pScaleForm;

// Now set the relative size and position properties of the form's controls.

count := 1;

while (count <= self.controlCount) do
if (not self.controls(count).isKindOf(StatusLine)) then
self.controls(count).relativeHeight := pRelativeSize;
self.controls(count).relativeLeft := pRelativeSize;
self.controls(count).relativeTop := pRelativeSize;
self.controls(count).relativeWidth := pRelativeSize;
endif;

count := count + 1;
endwhile;
end;

--
Darrell Duniam
dduniam@cnzmail.aoraki.co.nz
darrelld@ozemail.com.au


Return to “Tips and Techniques”

Who is online

Users browsing this forum: No registered users and 2 guests