for collection / entity selection listboxes, here's the gist of how to do it:
in the "meta expression" property, enter
meta_generic (Form.mySource.sel;Form.mySource.metas[0];Form.mySource.metas[1])
Form.mySource.sel is the entity selection object that represents the selected
entities for the listbox.
you may enter the same expression for the "selected items" property to have it
managed automatically,
or updated it by code in your "On Selection Change" event.
in general, it is a bad idea to use the "On Clicked" event, since clicking is
not the same as selecting/unselecting.
also, if you define the "selected items" property, you will not be able to
select lines by code.
(you will be competing with 4D)
meta_generic is a project method that looks like this:
C_OBJECT($1;$2;$3;$0)
If ($1.contains(This))
$0:=$2
Else
$0:=$3
End if
you define Form.mySource.metas[0] and Form.mySource.metas[1] in your form
method.
Form.mySource.metas:=New collection(New object;New object)
Form.mySource.metas[0].stroke:="#e5ecf2"
Form.mySource.metas[0].fill:="#596dae"
Form.mySource.metas[1].stroke:="#596dae"
Form.mySource.metas[1].fill:="#e5ecf2"
you should refrain from calling "New object" inside the meta expression method,
for it is inefficient to create and dispose identical objects each time "On
Display Detail" is executed.
finally, the listbox property "hide selection highlight" should be enabled.
for more complex examples of using the meta object, see documentation
https://doc.4d.com/4Dv17/4D/17.4/List-box-specific-properties.300-4880707.en.html
> On Feb 21, 2020, at 2:19, Eric via 4D_Tech <[email protected]> wrote:
>
> Miyako thank you for your response. I had seen the referenced example
> before making this post; it does a nice job if the List Box is array,
> selection or H List based. It does not reference Entity Selection at all
> that I can see; and my brain is failing to connect the dots on how to
> convert those concepts to an Entity Selection LB.
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive: http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************