Home > Ax Technical, Dynamics Ax, Uncategorized > Setting up Form size during runtime in Dynamics Ax

Setting up Form size during runtime in Dynamics Ax

Sometime we change  or construct a form at  runtime. In those situation we end up modifying/setting the width and height at run time itself.

there is one thing you need to keep in mind if you are doing that.

Don’t use the following way to set the size of the controls in forms

tabcontrol.width(FormWidth::ColumnWidth);
tabcontrol.height(FormHeight::ColumnHeight);
tabcontrol.width(100);
tabcontrol.height(200);

then nothing happens for the Form. The form size is actually set to zero.

Instead you must do it the following way….

For Auto/ColumnWidth, height properties, set it like this

  tabcontrol.widthMode(FormWidth::ColumnWidth);
  tabcontrol.heightMode(FormHeight::ColumnHeight);

For setting manual values set it like this

  tabcontrol.widthValue(100)
  tabcontrol.heightValue(200);

I’m not sure for what reason it is done like this 😦

Advertisements
  1. Hathout
    September 19, 2013 at 5:49 am

    where should I add this code to take effect … FormRun Method ??

    • September 19, 2013 at 6:11 am

      Try it after the super in the init method in Form if it doesn’t work put it after run. But i’m sure the first works.

  2. April 9, 2010 at 2:14 am

    A small addition …

    You can either use

    tabcontrol.widthValue(100) or tabcontrol.width(100)

    if you want to manually define the value

    and the form size doesn’t reset to zero when you try to set integervalues using width() and height() methods.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: