CHOOSE FIELD initial value

bohrmann

Member
Hi,

My program uses a simple CHOOSE FIELD comman, when users can select which program to run. But I would like to place the cursor on to the second line as default. I tried many ways, but to no avail.
Can you please advise, how to position the cursor from the code at easiest?

Thanks,
Peter
 
If i got it right.
WAIT-FOR {event of widget} FOCUS fieldToSelect - for frames.

SELECT-list = ENTRY( 2, SELECT-list:LIST-ITEMS IN FRAME {&FRAME-NAME} ). - for selectionlist
 
The current code looks like this:

DEFINE VARIABLE menu4 as character extent 6 format "x(40)"
initial [" 1. Option1 ",
" 2. Option2 ",
" 3. Quit "]

repeat :
choose field menu4 auto-return with frame f-menu4.

if frame-index = 1 then do :
run pgm1.p.
end.

if frame-index = 2 then do :
run pgm2.p.
end.

if frame-index = 3 then do :
leave.
end.

The user can select any of the procedures, but when this program starts, the cursor is positioned on the first item.
I would like to place the cursor on the second line as default.
Any idea?
 
This is at least 20 years old coding style used in Progress V6 - somebody correct me - but, as far as I know this is not possible and if I remember correctly the CHOOSE statement has been deprecated with the introduction of OpenEdge 10.

HTH, RealHeavyDude.
 
define variable selected-item as character.
define variable sl as character view-as selection-list size 50 by 5.
define frame a
sl no-label.

on return of sl in frame a
do:
apply "go" to frame a.
end.

sl:list-items in frame a = "Option1,Option2,quit".
repeat:
display sl with frame a.
enable sl with frame a.
sl:SCREEN-VALUE in frame a = ENTRY(2, sl:LIST-ITEMS).
wait-for go of frame a.
selected-item = sl:input-value in frame a.
if selected-item = "Option1" then
run prg1.
if selected-item = "quit" then leave.
end.
 
KEYS char-variable
If you want to highlight a particular choice when entering a CHOOSE statement, or if you want to know what keys the user pressed to make a selection, use the KEYS option. When you use the KEYS option, you must give the name of a character variable, char-variable. If char-variable is initialized to one of the choices before entering the CHOOSE statement, Progress highlights that choice. As the user presses keys to move the highlight bar, Progress saves those keystrokes in char-variable. You can test the value of char-variable after the CHOOSE statement returns control to the procedure. There is a 40-character limit when using the KEYS option.

It's all in the help...

For the record, CHOOSE works fine in OpenEdge.
 
"Deprecated" means you are strongly discouraged from using this feature in new code. Yes, CHOOSE still "works". But it is a feature that PSC is hoping people will stop using. As a feature it is not going to be enhanced or improved or even taken seriously should you have a problem with it. No effort will go into making it work nicely with other, newer features. Don't expect it to work well with event-driven or GUI constructs. Or Object Oriented features. Or anything else really. They might even drop it from the language at some future date (unlikely, but that is the implication of deprecation).
 
You are right. But what if your entire system consists of 'real' v6 progress? Full of 'editing' and 'choose' and all the fun stuff of v6. In our case it is not an option to rewrite and restyle everything.
I guess there still are a lot of companies with similar 'problems'.
 
Just because your whole application is like that, doesn't mean that you can't start replacing individual functions with modern code. One might even come up with some tools to help move forward specific aspects.
 
Depending on your resources, yes, it might take forever, meaning that you will never get finished. Even if you do, you won't ever get to the same result that you would get from a full transformation. But, unless you are ready to pay for a full transformation, that doesn't mean that you can't make incremental changes to improve things. Everything you touch is something that you can make better. It might take some figuring out at first, but pretty soon you will get the pattern and it will come naturally. And, you can start building up a library of things that are already done.

If you want to get there faster, consider tools. E.g., http://www.cintegrity.com/content/Request-Expression-Interest
 
Back
Top