State field visualization pick list

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
adale
Posts: 212
Joined: Wed Apr 08, 2020 9:18 pm
Location: Poplarville, MS

State field visualization pick list

Post 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).
Arlyn Dale
Servias LLC
User avatar
Dino
Posts: 477
Joined: Fri Jul 19, 2019 7:49 am
Location: Robbinsville, NC
Contact:

Re: State field visualization pick list

Post 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.
davidbalansa
Posts: 92
Joined: Mon Feb 01, 2016 10:08 am

Re: State field visualization pick list

Post 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 14365 times
David
adale
Posts: 212
Joined: Wed Apr 08, 2020 9:18 pm
Location: Poplarville, MS

Re: State field visualization pick list

Post 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.
Arlyn Dale
Servias LLC
adale
Posts: 212
Joined: Wed Apr 08, 2020 9:18 pm
Location: Poplarville, MS

Re: State field visualization pick list

Post 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.
Arlyn Dale
Servias LLC
Post Reply