Consultor Eletrônico



Kbase P14463: 4GL/ABL: How to change a read/write attribute of the TEXT widget on the fly?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   11/23/2009
Status: Verified

GOAL:

4GL/ABL: How to change a read/write attribute of the TEXT LITERAL widget on the fly?

GOAL:

How to modify a read/write attribute of a TEXT LITERAL widget at run time?

GOAL:

How to change the SCREEN-VALUE and the TOOLTIP of a TEXT LITERAL widget?

GOAL:

How to access the handle of a TEXT LITERAL widget at run time?

FACT(s) (Environment):

All Supported Operating Systems
Progress 9.x
OpenEdge 10.x

FIX:

This solution changes the SCREEN-VALUE and the TOOLTIP of a TEXT LITERAL widget. Any other read/write attribute of a TEXT LITERAL widget may be changed using similar logic.

This sample code changes the SCREEN-VALUE of a TEXT LITERAL widget from "Jack" to "Jill" and its TOOLTIP from "I am a boy, I am!" to "I am a Girl, I am!" respectively:

1. Create a new window.
2. Drop a TEXT LITERAL widget on the window.
3. In the TEXT LITERAL widget Property Sheet dialog box, type "Jack" as its Text and "I am a Boy, I am!" as its Tooltip
4. Drop a button on the window.
5. Define the following trigger for the CHOOSE event of the button.

DO:
DEFINE VARIABLE hHandle AS HANDLE NO-UNDO.
/*** Get the field group handle ***/
hHandle = SESSION:FIRST-CHILD.
DO WHILE VALID-HANDLE (hHandle):
IF hHandle:TYPE = "FIELD-GROUP" THEN LEAVE.
hHandle = hHandle:FIRST-CHILD.
END.
/*** Get the TEXT widget handle ***/
hHandle = hHandle:FIRST-CHILD.
DO WHILE VALID-HANDLE (hHandle):
IF hHandle:TYPE = "LITERAL" AND hHandle:SCREEN-VALUE = "Jack" THEN LEAVE.
hHandle = hHandle:NEXT-SIBLING.
END.
/*** Change the TEXT widget SCREEN-VALUE ***/
ASSIGN
hHandle:SCREEN-VALUE = "Jill"
hHandle:TOOLTIP = "I am a Girl, I am!".
END.
6. SAVE and RUN the window.
7. CHOOSE the BUTTON widget and observe that the SCREEN-VALUE and the TOOLTIP of this TEXT widgets have changed.