[Migrated content. Thread originally posted on 29 September 2003]
In some cases when using screen sections I need to be able to figure out which Screen Item handle a control-value referes to. By control-value I mean the Control-Value set up by the runtime in the special names section that = 1 for the first control, 2 for the second control, etc.
Is there a way through the inquire verb or other means to discover the handle?
Merlin
I finally figured out how to do this one...its been bothering me for months.
The basic problem was that the user types in a control# he wants to jump to from a prompt (controls numbered same as field number). In cases where the control was disabled (enabled = off), I wanted logic to return to the prompt without ever entering the Screen Section. That last bit was very important.
To allow this, I use the INQUIRE statement as follows:
inquire control at line ii pos jj id in id-to-check.
if id-to-check is the same # as the control# user is looking for, I can run another inquire and get the enabled-state...very useful!
ii and jj are iterators that loop over every possible character on the screen. for a 80x25 screen, this means 2000 possible positions to check. Howver, the inquire statement is quite fast and there is no detectable delay.
This logic could be useful if you have unusual requirements. For example, if you need to deal with your controls as an array. You could probe the screen and create an array of controls to reference later.
Merlin