Text Block control

Official Content
This documentation is valid for:

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, with the advantage that 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!'

To add a Text Block into a form, drag the Text Block icon from the GeneXus Toolbox to the desired part.

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 written:

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

You can even 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)

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


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

See also

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