Widget overrides
This example demonstrates how to override the ButtonWidget
by modifying
its methods for tooltip display, while the original widget remains intact as a base for the new
version.
For more specific information on overriding widgets in the GBC, refer to the section provided in the following link Overriding and extending widgets
The modifications include changing the class definition to extend from
ButtonWidget
instead of TextWidgetBase
, which allows for
overriding existing methods. For instance, the setText
method is updated to store
the text in a new property, _text
, while the setTitle
method is
overridden to customize how the title is set based on the _text
property.
ON ACTION
statement includes both a lot of text
and a comment to create a button, the information may be truncated, preventing the user from seeing
the full content. (Line breaks have
been added to improve readability.)ON ACTION name ATTRIBUTES(TEXT="full text name that will display with dots",
COMMENT="comment")
By overriding the setTitle
method, this customization ensures that the complete
text and comment are displayed as a tooltip when the user hovers their mouse over the button.
Steps
Be aware that each time a new GBC
version is released, you must check your customized widget against the new released
ButtonWidget
version, to not miss changes introduced in releases.