Dynamically retrieving variable names!!

Hi everybody,

I have a sample code below which enables 3 boxes for vTest1, vTest2, vTest3 respectively. I have a trigger below for On 'ENTER' anywhere,
i need to display the variable names when i press enter correspondingly.

For Example,
If i am entering a value in vTest1 and press ENTER, it should pop-up a message which prints vTest1,
If i am entering a value in vTest2 and press ENTER, it should pop-up a message which prints vTest2, likewise...

But it should be in a single trigger (i.e., ON 'ENTER' ANYWHERE) fetching the variable names dynamically to which it points currently.

*******************************************************
DEFINE VARIABLE vTest1 AS INTEGER NO-UNDO.
DEFINE VARIABLE vTest2 AS INTEGER NO-UNDO.
DEFINE VARIABLE vTest3 AS INTEGER NO-UNDO.
DEFINE FRAME f
vTest1 AT COLUMN 1 ROW 1
vTest2 AT COLUMN 1 ROW 2
vTest3 AT COLUMN 1 ROW 3
WITH SIDE-LABELS.
SET vTest1 vTest2 vTest3 WITH frame f.
ON 'ENTER':U ANYWHERE
DO:
/* I need the code here!! */
END.
*******************************************************

Can anyone help me out???:confused:
 
I think this is the code you are looking for :

DEFINE VARIABLE vTest1 AS INTEGER NO-UNDO.
DEFINE VARIABLE vTest2 AS INTEGER NO-UNDO.
DEFINE VARIABLE vTest3 AS INTEGER NO-UNDO.
DEFINE FRAME f
vTest1 AT COLUMN 1 ROW 1
vTest2 AT COLUMN 1 ROW 2
vTest3 AT COLUMN 1 ROW 3
WITH SIDE-LABELS.
ON 'ENTER':U ANYWHERE
DO:
/* I need the code here!! */
MESSAGE self:name
VIEW-AS ALERT-BOX INFO BUTTONS OK.
END.
SET vTest1 vTest2 vTest3 WITH frame f.
 
Hi,

Thanks a lot, i was expecting the same. Now take a close look on the code. This should then disable the box; but it wont do that.....

It should get disabled, can anyone help me out from this...:confused:

********************************************************
define variable xxx as character no-undo.
DEFINE VARIABLE vTest1 AS INTEGER NO-UNDO.
DEFINE VARIABLE vTest2 AS INTEGER NO-UNDO.
DEFINE VARIABLE vTest3 AS INTEGER NO-UNDO.
DEFINE FRAME f
vTest1 AT COLUMN 1 ROW 1
vTest2 AT COLUMN 1 ROW 2
vTest3 AT COLUMN 1 ROW 3
WITH SIDE-LABELS.
ON 'ENTER':U ANYWHERE
DO:
/* I need the code here!! */
/*MESSAGE self:name
VIEW-AS ALERT-BOX INFO BUTTONS OK. */
xxx = self:name.
disable xxx with frame f.
END.
SET vTest1 vTest2 vTest3 WITH frame f.
******************************************************

Thanks a lot in advance!!
 
Although the way you are doing it is not the best way to do it.
But for learnings sake

try
SELF:SENSITIVE = FALSE.

-Parul.
 
Hi,

I know that its a bad idea of using it, it is something like Reflection in JAVA, which would bring down the performence...

Jus for learning sake i asked u, i jus want to know if Progress has something like this...

Thanks a lot for ur information... :)
 
Back
Top