Official Content

The Text Block control allows you to insert text in forms with multiple functions. For example, to show short texts next to other controls, or to show messages, warnings, etc.

  • This control can be seen as text directly inserted into the form.
  • You can change its appearance (its back color, content, etc.) dynamically (at runtime) by setting properties.

For example, the following code changes the text and the back color of the Text Block named TextBlock1:

Event Start
  TextBlock1.Caption='Hello world!'
  TextBlock1.BackColor=RGB(255,000,000)
EndEvent

How to add a Text Block into a form

  • Drag the Text Block icon from the GeneXus Toolbox.
  • Drop it into the desired part of the form.

Login Sample

In the following example, you can see a user login screen. If the user name and password entered are correct, a success message will be displayed in the Tb_Msg Text Block present in the form. Otherwise, the following message will be displayed: "Password incorrect. Please retry." in the same Text Block.

Text Block Login sample

In the event associated with the button, the following code has been defined:

Event 'Ok'
  &PassIsValid=PassIsValid()
  Do case
     case &PassIsValid = True
          MsgTB.Caption = 'Welcome to the system!'
     otherwise
          MsgTB.Caption = 'Invalid password. Please retry...'
  EndCase
EndEvent

Associating Links to Text Blocks

You can associate a link to a Text Block control, like the following code shows:

Event Start
    CustomersTB.Link = Link(WWCustomer)
    ProductsTB.Link = Link(WWProduct)
    ProductTypesTB.Link = Link(WWProductType)
    SuppliersTB.Link = Link(WWSupplier)
Endevent

In particular, in the previous example, there are four Text block controls (named CustomersTB, ProductsTB, ProductTypesTB, and SuppliersTB) that were included inside an Action Group Control to show them in the Form inside a Toolbar, as the following image shows:

ActionGroup_Toolbar

When the user clicks on each Text Block, the corresponding Work With for Web object will be opened at runtime.

See Also

Text Block properties
Action Group Control for the Web
Action Group Control for Panels

Last update: April 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant