Adds a text.

syntaxSyntax:
DlxDialog.AddStaticText(x, y, width, text)

Parameters

Parameter Description
x The horizontal position in which to position the upper left corner of the control.
y The vertical position in which to position the upper left corner of the control.
width The width of the control in pixels.
text The text to be displayed.

Return Value

If the operation ends correctly it returns true otherwise it returns false.

Example

  Copy codeCopy code
var dlg = new DlxDialog(400, 350, "Example Dialog");
if (dlg.IsValid())
{
  dlg.AddStaticGroup(10, 10, 190, 155, "EditNumber");
  dlg.AddStaticText(20, 33, 60, "Int:");
  dlg.AddStaticText(20, 58, 60, "Float:");
  dlg.AddStaticText(20, 83, 60, "Length:");
  dlg.AddStaticText(20, 108, 60, "Angle:");
  dlg.AddStaticText(20, 133, 60, "Percent:");
  var ctrl_int = dlg.AddEditNumber(90, 30, 100, DlxApp.DIALOGEDITNUMBER_INTEGER, 5, -100, 100);
  var ctrl_float = dlg.AddEditNumber(90, 55, 100, DlxApp.DIALOGEDITNUMBER_FLOAT, 10.5, -100, 100);
  var ctrl_length = dlg.AddEditNumber(90, 80, 100, DlxApp.DIALOGEDITNUMBER_LENGTH, 10.5, -100, 100);
  var ctrl_angle = dlg.AddEditNumber(90, 105, 100, DlxApp.DIALOGEDITNUMBER_ANGLE, 45, -360, 360);
  var ctrl_pcent = dlg.AddEditNumber(90, 130, 100, DlxApp.DIALOGEDITNUMBER_PERCENT, 0.5, 0, 1);

  dlg.AddStaticText(10, 188, 60, "ComboList: ");
  var ctrl_cbl = dlg.AddComboBox(90, 185, 110);
  ctrl_cbl.AddString("Value1", 1, false);
  ctrl_cbl.AddString("Value2", 2, false);
  ctrl_cbl.AddString("Value3", 3, true);
  ctrl_cbl.AddString("Value4", 4, false);
  ctrl_cbl.AddString("Value5", 5, false);

  dlg.AddStaticText(10, 213, 60, "ComboEdit: ");
  var ctrl_cbe = dlg.AddComboBox(90, 210, 110, "Value0");
  ctrl_cbe.AddString("Value1", 1, false);
  ctrl_cbe.AddString("Value2", 2, false);
  ctrl_cbe.AddString("Value3", 3, true);
  ctrl_cbe.AddString("Value4", 4, false);
  ctrl_cbe.AddString("Value5", 5, false);

  dlg.AddStaticText(10, 238, 60, "Edit text: ");
  var ctrl_ed = dlg.AddEditText(90, 235, 110, 0, DlxApp.DIALOGEDITTEXT_FORMATTED, "Text");

  var brush = new DlxBrushStyle("orange");
  dlg.AddStaticText(10, 263, 70, "Combo Style: ");
  var ctrl_cs = dlg.AddComboStyle(90, 260, 300, brush);

  var ctrl_ck = dlg.AddCheckBox(10, 300, 100, "check box", true);

  dlg.AddStaticGroup(210, 10, 180, 245, "List box");
  var ctrl_lb = dlg.AddListBox(220, 30, 160, 215);
  for (var i = 1; i <= 50; i++)
    ctrl_lb.AddString("Value"+i, i, i==10);

  dlg.AddOkButton(280, 320, 50, 25);
  dlg.AddCancelButton(340, 320, 50, 25);

  var r = dlg.DoModal();

  var brush;
  ctrl_cs.GetStyle(brush);

  DlxApp.Printf("Exit Button: %s", r ? "Ok" : "Cancel");
  DlxApp.Printf("Brush style: %s", brush.GetName());
  DlxApp.Printf("Edit text: %s", ctrl_ed.GetText());
  DlxApp.Printf("Edit angle: %.1f°", ctrl_angle.GetNumber());
  DlxApp.Printf("List box: index=%i, string=%s, data=%f", ctrl_lb.GetInt(), ctrl_lb.GetText(), ctrl_lb.GetNumber());
}

See also