Using WIDGET-HANDLE

mycinka

New Member
HI,
I have two files: *.w and *.p. The first represents window with fill-in fields and buttons. When one of the buttons is selected, it runs something like this:

/*--------*/
DEFINE VAR fill1Handle AS WIDGET-HANDLE NO-UNDO.
ASSING fill1Handle = FILL-IN-1:HANDLE.

RUN externalProcedure.p (INPUT fill1Handle).
/*--------*/

From .w file I'm able to display the value of FILL-IN-1:

MESSAGE FILL-IN-1 ....

I would like to do this also in .p file by using fill1Handle. Now I can only access to SCREEN-VALUE, INPUT-VALUE, ...

Is there any way how to display or change value in FILL-IN-1 in externalProcedure when I use a widget's handle ?

Thanks
 
Like you said, by using the handle and "screen-value"; for instance:
Code:
DEF INPUT PARAMETER ipHandle AS HANDLE NO-UNDO.
..
Some code goes here
..
ipHandle:SCREEN-VALUE = "New Value":L.
..
Some code goes here
..
If this is not what you are after, you will have to be alittlemore specific as to the why not and what you are trying toachieve.
 
This is allright:

ipHandle:SCREEN-VALUE = "New Value":L.

I don't want the SCREEN-VALUE, but the value which is within FILL-IN-1 in *.w file.

Give you simple example, button's trigger contains this code:

DO:
MESSAGE FILL-IN-1
VIEW-AS ALERT-BOX INFO BUTTONS OK.
END.

It shows the message with value(NO SCREEN-VALUE) within FILL-IN-1 and the same code I want to use in external procedure.

Example, externalProcedure.p:

DEFINE INPUT PARAMETER widgetHandle AS WIDGET-HANDLE NO-UNDO.

MESSAGE "FILL-IN-1 contains:" SKIP widgetHandle
VIEW-AS ALERT-BOX INFO BUTTONS OK.

This shows widget's handle number, but I want the value. I didn't find any method or function which could return FILL-IN-1's value when widget's handle is used. The value of this widget(variable) isn't the same as the SCREEN-VALUE. Until ASSIGN FILL-IN-1 is done, SCREEN-VALUE and value within FILL-IN-1 are different. So, instead of widgetHandle I would like to use something like this:

MESSAGE "FILL-IN-1 contains:" SKIP GiveMeTheVale(widgetHandle)
VIEW-AS ALERT-BOX INFO BUTTONS OK.

So, do you understand what I try to achieve?
 
If you are talking about variables, you can make your variables newshared in the .w and shared the .p and access these in the .p. However,that is not a good practice in event driven programming (and besidesthat makes your programs not very flexible). Other than that I don'tthink there is a real way (other than using temp tables instead of realvariables) to do what you want if variables are used.

If you use Progress version 9 and IF the widget in question is adatabase or temp-table field, you do have the option of passing thehandle of the buffer of the database table or temp-table to the programyou are calling. That in combination with the widget-handle of thescreen object would give you access to both the buffer-value (which isthe value not changed through the UI since the last succesful ASSIGN)and the screen value (which may have been changed through the UI sincethe last succesful ASSIGN).

If you are not going to be accessing datables or temp-table fields,maybe you can also explain what it is you are trying to do in both the.w and the .p (don't send heaps of code, just use a description)...That might help in maybe finding a different way of doing what youwant...
 
Repost http://www.progresstalk.com/showthread.php?t=72575


{&SELF-NAME} contains the variable. E.g. in the VALUE-CHANGED trigger put

IF SELF:TABLE <> 'RowObject' THEN
ASSIGN {&SELF-NAME} NO-ERROR.

or

ASSIGN SELF:PRIVATE-DATA = ?
SELF:PRIVATE-DATA = (IF SELF:TABLE <> 'RowObject' THEN
STRING({&SELF-NAME}, SELF:FORMAT) ELSE SELF:SCREEN-VALUE)
NO-ERROR.

You can access widgetHandle:PRIVATE-DATA at any time. {&SELF-NAME} is valid during the widget definitions only, thus you must use it in a trigger. Most probably a developer event like U1 or so fits your needs best, coz you can walk the widget tree applying 'U1':U to every widget to assign and fetch the values. Ensure your buffers are available when you try the code above.
 
Back
Top