Start-up Form Size Setting?

Hi Folks I’d like to have my solution open in a form ‘sized’ to show my full form. Is there a way to set the opening form size - much like we do in a dialog?

Hi Ian,

There are functions to get/set windowsize under the applicationnode.
You can even think of computer/user specific settings when you store this as userproperty.
I don’t have my application here right now, but I can drop you some codesnippets if you like later on…

mboegem:
Hi Ian,

There are functions to get/set windowsize under the applicationnode.
You can even think of computer/user specific settings when you store this as userproperty.
I don’t have my application here right now, but I can drop you some codesnippets if you like later on…

That would be brilliant thanks Marc. Meantime I’ll checkout setWindowSize and setWindowposition. I guess I’ll need to run those selectively so in WC the resize should not run?

So, some codesnippets:

onApplicationClose:

//	Set application properties
	var $x = application.getWindowX(); $y = application.getWindowY();
	var $H = application.getWindowHeight(); $W = application.getWindowWidth();
	var $sH = application.getScreenHeight(); $sW = application.getScreenWidth();
		
	if(($x+10) > $sW) $x = 0; // application has probably been open on a second monitor
	if($H > $sH) $H = $sH; // never open application bigger than screen
	if($W > $sW) $W = $sW; // never open application bigger than screen
		
	if($y < 0) { $x = 0; $W = $sW ; $y = 0; $H = $sH-30 } // on windows > screen had been maximized
			
	var $windowLocation	= $x + ',' + $y;
	var $windowSize		= $W + ',' + $H;
	
	application.setUserProperty('windowLocation', $windowLocation);
	application.setUserProperty('windowSize', $windowSize);

Then again, onApplicationOpen:

var $windowLocation	= application.getUserProperty('windowLocation');
	var $windowSize		= application.getUserProperty('windowSize');
	
	if($windowLocation != null)
	{
		var $pos = $windowLocation.split(',');
		application.setWindowLocation(parseInt($pos[0]),parseInt($pos[1]));
	}
	else
	{
		application.setWindowLocation(0,0);
	}
	
	if($windowSize != null)
	{
		var $dim = $windowSize.split(',');
		application.setWindowSize(parseInt($dim[0]),parseInt($dim[1]));
	}
	else
	{
		application.setWindowSize(1280,750); // this is the default application size
	}

I’m not sure if this works in webclient as we just run smartclient, but I’d say: give it a try! :D

Have fun!

mboegem:
Have fun!

Thnaks again Marc - I’ll play with tha tomorrow.

Cheers