Page 1 of 1

Dropdown selection list inside a list

Posted: Tue Apr 05, 2022 10:08 pm
by alphabeta13
I have a command handler showing a screen with a couple instance lists. Each with several columns in it and currently in display-only mode.

I have a requirement to add a push button on the screen that would allow user to change entries in those instance lists. Some columns will need to be converted into dropdown lists so user can only choose a value in the dropdown list.

Can we have a dropdown as a column in an instance list? If so, how to do it? I tried but got an error message indicating that instance list can't be used as a parent to the dropdown list.

Thanks in advance!

Regards,
Taufik

Re: Dropdown selection list inside a list

Posted: Wed Apr 06, 2022 2:14 am
by Dino
Hi Taufik
A bit confused with the question:
instance01.jpg
instance01.jpg (248.51 KiB) Viewed 4119 times
You can have several command handlers showing one or many LIST inside.
they are not called INSTANCE LIST, they are just, LISTs.

And yes, you can have columns in those list, some can be just fields, other could be controls.
If you want to do things like handle fields with controls, most times is better to assign the different possible visualizations for a field, at field level, instead of doing this work in every program.

For this example, I created a visualization drop down for the field GRADE, with static values (they can be dynamic as well, and other kind of visualizations, even programs handling the visualization):
instance02.jpg
instance02.jpg (394.05 KiB) Viewed 4119 times
once done that, I created a command handler with a couple of list in it, and in one of the lists, skills for the employees (#list), I drag the columns SKILCODE, DATEACQR and GRADE which in the code were reflected as this:

Code: Select all

Define_Com Class(#PRIM_LIST) Name(#List) ColumnHeaderHeight(48) ColumnLines(False) DisplayPosition(2) Height(238) Left(0) Parent(#BodyPanel) RowHeight(48) TabPosition(1) Top(0) Width(345)
Define_Com Class(#PRIM_LIST.String) Name(#ListColumn1) ColumnWidth(93) DisplayPosition(1) Parent(#List) SortOnClick(True) Source(#SKILCODE)
Define_Com Class(#PRIM_LIST.Number) Name(#ListColumn2) ColumnWidth(90) DisplayPosition(2) Parent(#List) SortOnClick(True) Source(#DATEACQR)
Define_Com Class(#PRIM_LIST.DropdownColumn) Name(#ListColumn3) ColumnWidth(134) DisplayPosition(3) Parent(#List) SortOnClick(True) Source(#GRADE)
notice that the last column, GRADE, #LIstColumn3, is using DropDownColumn, and also know, that the default for the attribute ColumnReadOnly is TRUE, reason why everything in this list will be output at the beginning until you change that.

Then for one button in the screen which I named "Allow Change in Skills" I added this code for the click event:

Code: Select all

#ListColumn3.ColumnReadOnly := False
and you can continue from there.

Re: Dropdown selection list inside a list

Posted: Thu Apr 07, 2022 4:42 am
by alphabeta13
Thank you very much Dino! I will certainly try this.

Regards,
Taufik