Page 1 of 1

Set Cursor dynamicly

Posted: Wed Dec 16, 2020 12:15 pm
by m400mail
Hello to all

if there a way to set the Cursor dynamicly by a Field Name ?

For example RPG Code
select;

// Prompt / F4 bei welchem Feld

when currec='SCREEN02' and CURFLD='HDKDNR1' and prompt1 = *on;
dsply 'Prompt Kundennummer1 ' ;
// set cursor into Field HDKDNR1
when currec='SCREEN02' and CURFLD='HDKDNR2' and prompt2 = *on;
dsply 'Prompt Kundennummer2 ' ;
// set cursor into Field HDKDNR2

when currec='SCREEN02' and CURFLD='HDKDNR3' and prompt3 = *on;
dsply 'Prompt Kundennummer3 ' ;
// set cursor into Field HDKDNR3

Endsl;

Re: Set Cursor dynamicly

Posted: Wed Dec 16, 2020 12:24 pm
by Theju112
Well I would use an indicator to condition the DSPATR(PC) attribute associated to the field and turn it on to position the cursor whenever the condition is satisfied.

Please note, I am just a profound user. Somebody from profound might be able to offer better advice.

More details in below link:

https://www.ibm.com/support/knowledgece ... fdspat.htm

Re: Set Cursor dynamicly

Posted: Wed Dec 16, 2020 12:54 pm
by Scott Klement
If I understand correctly, you want to set focus on a different field depending on a condition in your RPG program.

The easiest way to do that is to bind indicators to the "set focus" property of each text box. (This is similar to DSPATR(PC), but for a Rich Display, whereas DSPATR is for a green-screen display.)

Re: Set Cursor dynamicly

Posted: Wed Dec 16, 2020 1:11 pm
by Theju112
Aaah.. totally missed out on the rich display part, yup, as Scott corrected me, we would need to bind the set focus property to an indicator.
Hope I got it correct his time around.