TextBox

This script illustrates using the TextBox feature. Each line is commented so you can see how to create text boxes, locate them, control text alignment, change the font, change the background color, and close them. This script does not do anything useful. Its purpose is to illustrate working with Text Boxes in ESPL.

var
  form: TForm;
  font: TFont;
begin
{Create 1st TextBox, caption 'A', left,top,width,height}
  TextBox('A',1,1,200,100);

{Add one line of text. False changes default centering to left justify}
  TextAdd('First',false);

{Create 2nd TextBox, caption 'B', use default position and size}
  TextBox('B');

{Add one line of text. Text is centered by default}
  TextAdd('Second');

{Find the 1st text box by matching the caption 'A'}
  FindWindow(eText,'A');

{Make the 1st text box the active window}
  SetFocus;

{Assign a TForm variable to this window}
  form:=ActiveMDIchild;

{Change the form's background color to White}
  form.color:=clWhite;

{Assign a TFont variable to form's current font setting}
  font:=form.font;

{Change the font color to Blue}
  font.color:=clBlue;

{Change the font itself}
  font.name:='Courier New';

{Change the font size}
  font.size:=10;

{Change the font style}
  font.style:=fsUnderline+fsBold;

{Add another line of text to the 1st text box}
  TextAdd('Third');

{Go find the 2nd text box with caption 'B'}
  findWindow(eText,'B');

{Make it the active window so the menu will apply to it}
  SetFocus;

{Close the active window which is the 2nd text box}
  mnuCloseWindow.click;

end;