FormGroupControl.widthMode Method [AX 2012]

Gets or sets the calculation mode for the width of the control.

public int widthMode([int value])

Run On

Client

Parameters

value
Type: int
An integer value that indicates how the control width is calculated; optional.

Return Value

Type: int
An integer value that indicates the width current calculation mode.

Calculate the width according to the following table.

Mode

Width calculation

Exact

The exact width of the control in pixels is used.

Auto

The width of the control is calculated automatically, and the value parameter is ignored.

Column width

The layout of the form determines the width of the control.

The width of the control might change when the calculation mode is set to Auto or Column width.

The following example shows a call to the widthMode method to calculate the control width, based on an exact pixel value.

static void createForm(Args _args) 
{ 
    Args args; 
    Form form; 
    FormRun formRun; 
    FormBuildDesign formBuildDesign; 
    FormBuildDataSource formBuildDataSource; 
    FormBuildStringControl formBuildStringControl; 
    FormBuildGroupControl formBuildGroupControl; 
    FormGroupControl formGroupControl; 
    int idx; 
    DictTable dictTable; 
    CustTable custTable; 
 
    // Create the form header. 
    form = new Form(); 
 
    // Add data sources to the form. 
    dictTable = new DictTable(tableNum(custTable)); 
    formBuildDataSource = form.addDataSource(dictTable.name()); 
    formBuildDataSource.table(dictTable.id()); 
 
    // Create the form design. 
    formBuildDesign = form.addDesign("Design"); 
    formBuildDesign.caption("myForm"); 
 
    // Add controls. 
    formBuildGroupControl = 
 formBuildDesign.addControl(FormControlType::Group,"Group"); 
    idx = formBuildGroupControl.id(); 
  
    formBuildStringControl = 
 formBuildGroupControl.addControl(FormControlType::String,"String"); 
 
    // Add data fields to the controls. 
    formBuildGroupControl.dataSource(formBuildDataSource.id()); 
    formBuildStringControl.dataSource(formBuildDataSource.id()); 
    formBuildStringControl.dataField(2); 
 
    args = new Args(); 
    args.object(form); 
 
    // Create the run-time form. 
    formRun = classfactory.formRunClass(args); 
 
    formRun.run(); 
    formRun.detach(); 
 
    formGroupControl = formRun.control(idx); 
    formGroupControl.widthMode(-1); 
    formGroupControl.widthValue(200); 
}

Community Additions

ADD
Show: