Search code examples
dialogaxaptadynamics-ax-2012x++

How to convert the normal text to bold text?


I have this code in my Dialog:

//other code
dialog.addText(strFmt("Delete this field's value: %1?", MyTable.FieldTable));
//other code

I have an output looklike:

I have an output looklike

I know the strUpr function:

dialog.addText(strFmt("Delete this field's value: %1?", strUpr(MyTable.FieldTable)));

Does there exist a method or function to convert only the FIELDValue to bold text?


Solution

  • You can set the bold property to 7 on FormBuildStaticTextControl.

    Control can be obtained via the control method on DialogText returned by addText method.

    The integer that is returned contains the weight of the font as follows:

    0 Use the default font weight. 
    1 Thin. 
    2 Extra-light. 
    3 Light. 
    4 Normal. 
    5 Medium. 
    6 Semibold. 
    7 Bold. 
    8 Extra-bold. 
    9 Heavy. 
    

    Example:

    Dialog dialog = new Dialog();
    DialogText dt = dialog.addText("Test");
    FormBuildStaticTextControl txtCtl = dt.control();
    txtCtl.bold(7);
    
    dialog.run();