Page 1 of 1

State field visualization pick list

Posted: Wed May 05, 2021 4:13 am
by adale
I have a "State" field, with the visualization set for a pick list with all 50 states pre-listed.
I have the field in a VL Web - View as part of a series of data input fields.
The drop down selector works fine, but is there a parm I am missing where if you enter a character the state field input, the list will start or position at the letter in the list values?
Meaning, enter a "M" would start you at Maine (ME).

Re: State field visualization pick list

Posted: Wed May 05, 2021 7:02 am
by Dino
Hi
the example you are looking for, is the one LANSA calls the "Dynamic Auto Complete" available in the web page called xmdmain, view xMdAutocomplete, component MdDropDownAutoComplete, which definition is the next

Code: Select all

Define_Com Class(#PRIM_MD.DropDown) Name(#MdDropDownAutoComplete) Displayposition(3) Left(16) Parent(#PanelDynamic) Tabposition(3) Top(144) Width(768) Promptonly(False) Promptposition(Bottom) Helperposition(None) Appearance(TextFieldBox)
and take actions for the events of autocomplete

Code: Select all

Evtroutine Handling(#MdDropDownAutoComplete.AutoCompleting) Value(#Value) Handled(#Handled)

#Com_owner.ShowAutoComplete( #Value )

#Handled := True

Endroutine
and keypress:

Code: Select all

Evtroutine Handling(#MdDropDownAutoComplete.KeyPress) Keycode(#Key)

If (#Key = BackSpace)

#MdDropDownAutoComplete.CloseDropDown

Endif

Endroutine
You need to implement all that to get the autocomplete works successfully with a dynamic dropdown.

Re: State field visualization pick list

Posted: Wed May 05, 2021 8:01 am
by davidbalansa
Hi,

If you want to keep it as a field visualization you would use Dino's code in a Reusable Part defined as a Visual Host. Then create a Visual Host Visualization for your field.
Capture.PNG
Capture.PNG (28.91 KiB) Viewed 14360 times
David

Re: State field visualization pick list

Posted: Wed May 05, 2021 10:05 pm
by adale
Thanks for the help and pointing me in the right direction.
All my experience in Lansa has been with WAM's, so moving to the VL Web Pages gets me baffled at times.

Re: State field visualization pick list

Posted: Thu May 06, 2021 12:48 am
by adale
Thanks again for pointing me in the right direction. Here is what I have worked out and was actually a simple fix.
Once you pointed me to the xMdAutoComplete, I saw a feature / parm that addressed my issue for a Simple auto complete, "Promptonly". I assume the defualt is True, as once I entered this parm to be False, the drop down works like I want. The ability to start typing a letter, and the drop down list values will start to autocomplete, and allow me to use the Up or Down arrow keys to scroll through the list.
In my Field definition, I already had a visualization of "DropdownField", which looks to inherit features of the PRIM_MD.DropDown.
Also in my Field definition, I already had the state names and values loaded into it's *picklist, so I did not need to retrieve or build a list in the pgm.