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.
Taku Izumi
Posts: 63 Joined: Thu Dec 15, 2016 2:03 pm
Post
by Taku Izumi » Mon Mar 31, 2025 6:16 pm
Hi all,
When a value set the value property of a dropdown by logic, it automatically sets focus to the leading matching value in the dropdown.
Does anyone know how to disable this auto focus?
In the example below, "D" is set the value of the drop-down, but "Denmark" is selected.
I want only "D" to be displayed as the drop-down value, not "Denmark".
Code: Select all
Begin_Com Role(*EXTENDS #PRIM_WEB) Theme(#SYS_THEME<MaterialDesignBlue>)
Define_Com Class(#PRIM_LIST.DropDown) Name(#DropDown1) Columnheaderheight(0) Columnlines(False) Displayposition(1) Parent(#COM_OWNER) Rowlines(False) Showselection(False) Tabposition(2) Top(48) Height(41) Left(56) Width(164) Autoselect(False) Autoselectitem(False) Dropdownstyle(DropDown)
Define_Com Class(#PRIM_LIST.String) Name(#DropDown1Column1) Columnunits(Proportion) Columnwidth(1) Displayposition(1) Parent(#DropDown1) Sortonclick(True) Source(#STD_TEXTS)
Define_Com Class(#PRIM_PHBN) Name(#Button1) Caption('Button1') Displayposition(2) Left(300) Parent(#COM_OWNER) Tabposition(1) Top(58)
Evtroutine Handling(#Com_owner.CreateInstance)
#STD_TEXTS := *BLANK
Add_Entry To_List(#DropDown1)
#STD_TEXTS := 'America'
Add_Entry To_List(#DropDown1)
#STD_TEXTS := 'Brazil'
Add_Entry To_List(#DropDown1)
#STD_TEXTS := 'Canada'
Add_Entry To_List(#DropDown1)
#STD_TEXTS := 'Denmark'
Add_Entry To_List(#DropDown1)
#STD_TEXTS := 'England'
Add_Entry To_List(#DropDown1)
#STD_TEXTS := 'France'
Add_Entry To_List(#DropDown1)
#STD_TEXTS := 'Germany'
Add_Entry To_List(#DropDown1)
#STD_TEXTS := 'Holand'
Add_Entry To_List(#DropDown1)
Get_Entry Number(1) From_List(#DropDown1)
#DropDown1.CurrentItem.Focus := True
Endroutine
Evtroutine Handling(#Button1.Click)
#DropDown1.Value := 'D'
Endroutine
End_Com
スクリーンショット 2025-03-31 161424.jpeg (7.59 KiB) Viewed 35180 times
Regards,
Taku
Taku Izumi
Posts: 63 Joined: Thu Dec 15, 2016 2:03 pm
Post
by Taku Izumi » Fri Apr 04, 2025 8:33 pm
I found a solution to this issue.
The solution is to create a dropdown collection after setting a value to the value property of the dropdown.
The fixed code is this:
Code: Select all
Begin_Com Role(*EXTENDS #PRIM_WEB) Theme(#SYS_THEME<MaterialDesignBlue>)
Define_Com Class(#PRIM_LIST.DropDown) Name(#DropDown1) Columnheaderheight(0) Columnlines(False) Displayposition(1) Parent(#COM_OWNER) Rowlines(False) Showselection(False) Tabposition(2) Top(48) Height(41) Left(56) Width(164) Autoselect(False) Autoselectitem(False) Dropdownstyle(DropDown)
Define_Com Class(#PRIM_LIST.String) Name(#DropDown1Column1) Columnunits(Proportion) Columnwidth(1) Displayposition(1) Parent(#DropDown1) Sortonclick(True) Source(#STD_TEXTS)
Define_Com Class(#PRIM_PHBN) Name(#Button1) Caption('Button1') Displayposition(2) Left(300) Parent(#COM_OWNER) Tabposition(1) Top(58)
Evtroutine Handling(#Button1.Click)
Clr_List Named(#DropDown1)
#DropDown1.Value := 'D'
Execute Subroutine(CreateDopDown)
Endroutine
Subroutine Name(CreateDopDown)
#STD_TEXTS := *BLANK
Add_Entry To_List(#DropDown1)
#STD_TEXTS := 'America'
Add_Entry To_List(#DropDown1)
#STD_TEXTS := 'Brazil'
Add_Entry To_List(#DropDown1)
#STD_TEXTS := 'Canada'
Add_Entry To_List(#DropDown1)
#STD_TEXTS := 'Denmark'
Add_Entry To_List(#DropDown1)
#STD_TEXTS := 'England'
Add_Entry To_List(#DropDown1)
#STD_TEXTS := 'France'
Add_Entry To_List(#DropDown1)
#STD_TEXTS := 'Germany'
Add_Entry To_List(#DropDown1)
#STD_TEXTS := 'Holand'
Add_Entry To_List(#DropDown1)
Endroutine
End_Com
Regards,
Taku