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, 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!'
  TextBlock1.BackColor=RGB(255,000,000)
EndEvent

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'
  &PassIsValid=PassIsValid()
  Do case
     case &PassIsValid = True
          MsgTB.Caption = 'Welcome to the system!'
     otherwise
          MsgTB.Caption = 'Invalid password. Please retry...'
  EndCase
EndEvent

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)
Endevent

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:

ActionGroup_Toolbar

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



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