John,
On Wed, Jan 23, 2019 at 6:31 PM John DeSoi via 4D_Tech <[email protected]>
wrote:

> $1 is a pointer to the collection listbox variable and the debugger shows
> it has 10 elements. The object name on the form is the same as the variable
> name. If I execute it with the name, $hdrVars has 4 elements. But all
> arrays have zero elements if I use the dereferenced pointer.
>
Well assuming your listbox has 4 columns that's what you should expect. The
columns don't (can't) have pointers to them.

I encourage you to work with Form in this case. Collection based listboxes
are extremely easy to work with by putting the listbox in a form by itself
and dropping that subform onto forms that require it. When the subform
object is an object or collection you put the collection in the subform
object. The subform code itself is totally generic because it's all working
in the context of the subform. I like to make the subform an object
constructed like so:

{ "data":collection, "config": object }

The listbox collection is Form.data and the config object has details about
setting it up. Keep in mind that working with collections is working with
references - so I'm not doubling or tripling the amount of memory used by
putting the listbox in the subform. It's like using pointers but easier.
And the changes made in the listbox are immediately reflected in the data
collection of the subform object.



> > The listbox correctly fired an On column moved event and *LISTBOX MOVED
> > COLUMN NUMBER*(*;"listBox";$pos1;$pos2) correctly populated.
>
> You tried this using a dereference pointer? This was the one that was not
> working last night that made me decide to post something.
>

I rarely use pointers with listboxes anymore. It shouldn't matter but
perhaps it does. I find listbox code especially easy to make generic using
names instead. In this case I only tested one call using a pointer.

I think if you are seeing a difference between using a pointer and using
the name there is something about the pointer that's weird. Maybe because
of naming the collection and the listbox object the same thing?

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

*We go vote - they go home*
**********************************************************************
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