Kbase P21273: How to add a LABEL to a Dynamic Widget
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  14/03/2003 |
|
Status: Unverified
GOAL:
How to add a LABEL to a Dynamic Widget
GOAL:
How to add a LABEL to a Dynamic Widget such as a FILL-IN
GOAL:
How to use the SIDE-LABEL-HANDLE attribute
FIX:
When creating widgets dynamically (as opposed to using the DEFINE VARIABLE c AS CHAR VIEW-AS FILL-IN statement) one of the problems is that you must take care of many unforeseen details on your own.
One such detail is the label. Whereas the DEFINE VAR ... VIEW-AS FILL-IN statement will create the label for you automatically, with a dynamic widget you must create the label separately and attach it to the widget yourself.
Below is an example which shows how this can be done. The label is created using a TEXT widget.
----------------------- cut here ----------------------------------
DEF FRAME f WITH SIZE 30 BY 20.
DEF VAR x AS WIDGET-HANDLE.
DEF VAR t AS WIDGET-HANDLE.
CREATE TEXT t ASSIGN
ROW = 6
COLUMN = 5
FRAME = FRAME f:HANDLE
VISIBLE = TRUE
SCREEN-VALUE = "xxxx:" /* This is the label text */
CREATE FILL-IN x ASSIGN
ROW = 6
COLUMN = 12
HEIGHT-CHARS = 12
FORMAT = "99/99/99"
FRAME = FRAME f:HANDLE
SENSITIVE = TRUE
VISIBLE = TRUE
SIDE-LABEL-HANDLE = t.
WAIT-FOR GO OF FRAME f.
You must use FONT-TABLE:GET-TEXT-WIDTH-CHARS(string [,font#]) on the
text widget's screen-value (i.e., on the label text string) in order
find out how big it really is so you can position it properly. This
is what is used to position fill-in labels in the UIB.