Page 1 of 1
Material Design Dropdown
Posted: Thu Jul 26, 2018 4:52 am
by atostaine
With the regular controls you would drag a combo box to your panel, then drag fields onto it.
How do you add fields to the material design combo box?
Re: Material Design Dropdown
Posted: Thu Jul 26, 2018 8:58 am
by JamesDuignan
Hi Art,
The material design dropdown is not like the other dropdowns available in LANSA. Dropdown does not need to contain a sourcable field.
So adding an Item to the dropdown will look like:
Code: Select all
#DropDown.Items.Add( 'VALUE1' 'This is a caption for Value 1' )
In the example above "VALUE1" is the value assigned to the field and "This is Value 1" is the caption to be displayed in the dropdown for that item.
If the value is what needs to be displayed without a caption, then not adding the caption parameter will display the value in the list.
The current value of the dropdown is accessed simply by referencing the Name of the Dropdown in an assignment.
below is a simple example of using the dropdown, showing everything mentioned above.
Code: Select all
Begin_Com Role(*EXTENDS #PRIM_WEB) Theme(#SYS_THEME<MaterialDesignBlue>)
Define_Com Class(#PRIM_TBLO) Name(#LayoutList)
Define_Com Class(#PRIM_TBLO.Column) Name(#LayoutListColumn1) Displayposition(1) Parent(#LayoutList)
Define_Com Class(#PRIM_TBLO.Row) Name(#LayoutListRow1) Displayposition(1) Parent(#LayoutList)
Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutListItem1) Alignment(CenterLeft) Column(#LayoutListColumn1) Manage(#ListPrimaryText) Marginleft(16) Marginright(16) Parent(#LayoutList) Row(#LayoutListRow1) Sizing(ContentHeightFitToWidth)
Define_Com Class(#PRIM_MD.Dropdown) Name(#DropDown) Caption('Caption') Displayposition(1) Left(16) Parent(#COM_OWNER) Tabposition(1) Top(16) Width(404)
Define_Com Class(#PRIM_MD.List) Name(#List) Displayposition(2) Layoutmanager(#LayoutList) Left(71) Parent(#COM_OWNER) Rowheight(48) Tabposition(2) Themedrawstyle('Card') Top(171) Width(722)
Define_Com Class(#PRIM_MD.ListLabel) Name(#ListPrimaryText) Caption('Single line item') Displayposition(1) Height(23) Left(16) Parent(#List) Tabposition(1) Themedrawstyle('Heading3') Top(13) Width(688)
Evtroutine Handling(#Com_owner.Initialize)
* Add the dropdown Values
#DropDown.Items.Add( 'A_VALUE' 'This is a caption for A Value' )
#DropDown.Items.Add( 'B_VALUE' 'This is B Value' )
#DropDown.Items.Add( 'C_VALUE' )
#DropDown.Items.Add( 'D_VALUE' 'I am D Value' )
#DropDown.Items.Add( 'E_VALUE' )
* Assign the initial value to the dropdown
#DropDown := 'A_VALUE1'
Endroutine
Evtroutine Handling(#DropDown.Changed)
#ListPrimaryText := #DropDown
Add_Entry To_List(#List)
Endroutine
End_Com
Re: Material Design Dropdown
Posted: Thu Jul 26, 2018 8:59 am
by atostaine
Thank you. After I posted I saw some samples but it still wasn’t clear to me.
Art
Re: Material Design Dropdown
Posted: Fri Sep 21, 2018 5:50 am
by atostaine
After the dropdown is loaded, how can I set the item I want to display? I tried this but it doesn't display the item
for each(#item) in(#dropDown.items)
if (#item.value = #pShipper.asString)
#item.Visible := true
leave
endIf
endFor
Re: Material Design Dropdown
Posted: Fri Sep 21, 2018 6:02 am
by Pablo
Hi Art,
you set the value property of the dropdown:
#dropdown.value = value
Regards,
Pablo
Re: Material Design Dropdown
Posted: Fri Sep 21, 2018 6:36 am
by atostaine
Thank you.
Re: Material Design Dropdown
Posted: Fri Sep 21, 2018 6:52 am
by atostaine
I add the items similar to this:
#dropdown.items.add('51070' 'SHIPPER NAME')
When I set the value of the dropdown to '51070', it shows 51070. I want it to show 'SHIPPER NAME'
Do I have to use the caption to set the value?
Re: Material Design Dropdown
Posted: Fri Sep 21, 2018 9:34 am
by JamesDuignan
Hi Art,
This was rectified in EPC142010. Applying this EPC will fix your issue
https://www.lansa.com/support/notes/epc/epc142010.htm
Regards,
James
Re: Material Design Dropdown
Posted: Fri Sep 21, 2018 9:44 am
by atostaine
Thank you James.
Re: Material Design Dropdown
Posted: Fri Nov 09, 2018 6:34 am
by atostaine
Is there a way to duplicate the dropdown count property from regular Dropdowns in MD Dropdowns?
Art
Re: Material Design Dropdown
Posted: Thu May 02, 2024 10:34 pm
by adale
Simple MD dropdown columns are "value" and "caption" (and a resulting boolean when adding items to the dd list).
Setting the dd value, and using the dd value are fine, but I would like to use the dd list's value "caption" as well.
User selects an item in the drop down, and I want to use the value's "caption" to display in a resulting dialog.
When I try #dropdown.caption, it just gives me the name/description caption of the dropdown component, and not the list value caption.
Is there a means to retrieve the selected dropdown value's caption? Or even the value/caption pair if need be?