Chris,
Have a look at these commands:

entitySelection.and( )  - intersection
entitySelection.or( )  - union
entitySelection.minus( )  - difference
entitySelection.add( )
entitySelection.minus( )


For working with a listbox like you are I will have two 'versions' of the
entity selection:

master  - this is the version created by the query or whatever other method

display - this is a different entity selection that is a reference to the
master

The idea is you put the display in the listbox. Showing and hiding become
easier as many of (if not all) the operations we want to use to manipulate
the displayed list produce a new entity selection.

This is a place where working with references really shines. Using this
approach in classic 4D we would be duplicating the data whereas here we are
simply manipulating references to it.

On Mon, Sep 23, 2019 at 4:37 AM Chris Belanger via 4D_Tech <
[email protected]> wrote:

> CB:  typo: on “Show” the   .and( ) basically makes the .es = to the
> .es_Selected [but they are not the same entity selection].
>
> —
>
> > On Sep 23, 2019, at 4:35 AM, Chris Belanger <[email protected]>
> wrote:
> >
> > I have a listBox with an Entity Selection as its dataSource.
> > I want to support standard ‘set manipulations’ such as   HIDE,  SHOW,
> SHOW ALL,  SELECT ALL [yes, I realize these are not 4D sets, but
> collections…terminology…]
> >
> > Given that:
> > Form.es  = entity selection displayed in the ListBox
> > Form.es_Selection = “Selected Items” in the listbox
> >
> > I am able to easily HIDE or SHOW the "Selected Items”
> > : ($1.parameter="Hide")
> >               Form.es:=Form.es.minus(Form.es_Selected)  // remove the
> selection
> >               Form.es_Selected:=Form.es.getDataClass().newSelection()
> // change this to a NEW BLANK selection
> >
> > : ($1.parameter="Show")
> >               Form.es:=Form.es.and(Form.es_Selected)  // remove the
> selection
> >               Form.es_Selected:=Form.es.getDataClass().newSelection()
> // change this to a NEW BLANK selection
> >
> >
> > but “SELECT ALL” is giving me issues.
> > I can easily set the ‘Selected Items’ to be the same as the Entity
> Selection
> > Form.es_Selected:=Form.es.or(Form.es_Selected)  // select all the
> records
> >
> > but even though this makes the ‘Selected Items’ the same as the entity
> selection. It is not reflected in the appearance of the listBox (i.e. all
> rows are NOT selected as desired)
> > I also tried:
> > INVOKE ACTION(ak select all) — no affect
> >
> > also tried:
> > Form.es_Selected:=Form.es.or(Form.es_Selected)  // select all the
> records
> > Form.es:=Form.es  // cause a re-draw — BUT IT DOESN’T!
> >
> > ----
> > So does anyone know how to simulate   SELECT ALL in a listbox that has
> an entity Selection as a datasource?
> >
> > thanks,
> > Chris
>
> **********************************************************************
> 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]
> **********************************************************************



-- 
Kirk Brooks
San Francisco, CA
=======================

What can be said, can be said clearly,
and what you can’t say, you should shut up about

*Wittgenstein and the Computer *
**********************************************************************
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]
**********************************************************************

Reply via email to