Is there a curent way (via actions or scripts) to populate a menu (say a pulldown menu) from a specific field in a collection?
Alternatively, if I need the user to pick (optionally - empty or null or whatever can be a valid pick) one of a list of strings from a specific field (‘name’) in a collection, what widget/control should I use? A simple list? Something else?
This should be possible using databinding for the dropdown field. If you create a collection with an enum field and then databind the dropdown field to that collection/dataview, then the contents of the dropdown field should be the options of the enum field.
Thank you. My misunderstanding. The table (collection) I was using does not have any enumerated fields. I was trying to make a dropdown menu of a text field expecting that it would display a list of the values in that field (the ‘name’ field) in the collection ‘codes’. Perhaps, if I want to display one column (or field) of a collection, the current UI widget would be the ‘simple list’? I’ll give that a try.
Nope, I tried a “Simple List” with just the Title mapped to the Name field of the Codes colleciton - displays fine, but NO highlight to show the user what line is selected and I can’t find a property to make the selected line be hilighted in a ‘Simple List’. I then tried a ‘Table’ mapped to a View of the Codes Collections which only diaplays the ‘Name’ field. Once i got the extra columns turned off, so I just had ‘Name’ this was scrollable, and had properties like "auto hilite’ which I checked, but in RUN mode, clicking on a line/row did not highlight the line?!? With either of these widgets I do not know what property to use to get the text of the selected line in a list for storing in a Collection.
In Classic, this would be either a multiline field with Autohilite on (i.e. a List field).
I also tried a plain ‘Field’ widget and set it for multiline. Bound to a Collection ‘Codes’ and the ‘Name’ field. Only the 1st record appears, not a list of records. I thought if it was multiline (vs ‘textarea’) that it would display multiple lines, like the LC Classic list field.
SO, here is the use-case. I have a Collection called ‘data’ with x rows and y columns. One of the columns (fields) is called ‘name’. What widget(s) do I use to present the strings in the ‘name’ column/field for all x rows/records for a user to pick just one line (highlight) and then in a script, be able to tell what the text of that hilighted line is? I don’t care at this point whether the widget is a field, dropdown meu, pulldown button, simple list, table, or whatever. I just want to be able to do this (to me very basic) use-case.
I tried different things. What worked (kind of) for me was to use a simple list widget. Make it that your ‘name’ binds to “Title” of the simple list widget. Make a field and name it “MyInputField”.
The script of the simple list is:
on mouseUp pButton, pEvent
put pEvent["row"] into tRow
put the content of me into tMyContent
put tMyContent[tRow]["title"] into tText
set the text of widget "MyInputField" to tText
end mouseUp
It works when I click on a row of the simple list then it puts the text of the “Title” section of that row into field “MyInputField”.
What I could not figure out is how to select the clicked row in the simple list widget to hilite on click and it stays hilighted. I do not even know if that can be done. (a la listField)
Here the secret seems to be that ‘mouseUp’ has a second parameter “pEvent” which is an array.
Thank you. That does work. I can hide the the “MyInputField” field. I suppose I could simplify it further and set a customer property of the simple list to tText and then I would not need a hidden field. I can’t figure out how to highlight a selected line in a simple list. I don’t think that is possible at this time. At least, thanks to your help, I can advance the funtionality a little further. I suppose the UI can come later.
Hi @Researchware unfortunately at this time there isn’t a way to select a row in the simple list to activate it’s hilite color. I have filed this as an issue though and we are working towards a resolution. I will update this thread once this has been fixed.