The Text Object

Synopsis

Class Name: Text
Valid Parents: Dialog, Bulletin
Valid Children: Popup

Description

A single or multiple line text field.

  • A XuCR_VALUE_CHANGED callback is generated with each keystroke.
  • Scrollbars are automatically added to the Text object when the resource XuNguiMultilineEdit is true.
  • You can use the functions GuiGetString and GuiSetString to get and set the text field.

Inherited Resources

New Resources

Name Type Default
XuNguiCallback string undef
XuNguiCallbackData string undef
  • XuNguiCallback specifies the name of the function to call when the text field receives events.
  • If XuNguiCallbackData is specified then the value is passed to the callback function in the second argument.
  • For more details - see Callback Functions
Name
Type
Options
XuNguiEditable
float (boolean)
true or false
XuNguiMultilineEdit
float (boolean)
true or false
  • If XuNguiEditable is true then the text in the Text object is editable, if false it is read­only.
  • If XuNguiMultilineEdit is true, then the Text object allows multiple lines of text to be entered. If false, only one line can be entered.
  • When XuNguiMultilineEdit is false, an XuCR_ACTIVATE callback will be made when the return key is pressed.

Callback Information

Reason Event
XuCR_ACTIVATE The [return] key typed (XuNguiMultilineEdit=false)
XuCR_VALUE_CHANGED Any key except [return] typed.

Example Code - simple.gsa

  if exists(gsharp_1.mydialog) destroy gsharp_1.mydialog;
  create Dialog gsharp_1.mydialog
   ( XuNguiDialogType = "template",
     XuNguiTitle = "Personal Details",
     XuNguiWidth = 350,
     XuNguiHeight = 200
   );
  create Bulletin gsharp_1.mydialog.Bull;
  create Label gsharp_1.mydialog.Bull.NameLabel
   ( XuNguiPosition = (3,0),
     XuNguiLabel = "Name:"
   );
  create Text gsharp_1.mydialog.Bull.Name
   ( XuNguiPosition = (100,0),
     XuNguiWidth = 200,
     XuNguiMultilineEdit = false
   );
  create Label gsharp_1.mydialog.Bull.AddressLabel
   ( XuNguiPosition = (3,30),
     XuNguiLabel = "Address:"
   );
  create Text gsharp_1.mydialog.Bull.Address
   ( XuNguiPosition = (100,30),
     XuNguiWidth = 200,
     XuNguiHeight = 80,
     XuNguiMultilineEdit = true
   );

  create Button gsharp_1.mydialog.OK;
  create Button gsharp_1.mydialog.Apply;
  create Button gsharp_1.mydialog.Cancel;

  GuiPopupDialog("gsharp_1.mydialog");

Return to Gsharp Applications Reference Manual