Piortr,
You might be conflating a hierarchical list with a listbox.

The way you've described the listbox (if I understand it correctly) the
arrays in the listbox will be:

col 1   |  col 2  |  col 3
parent | child   | data
===============
 p1     |  c1      | data1
 p1     |  c1      | data2
 p1     |  c1      | data3
 p1     |  c1      | data4
 p1     |  c1      | data5
 p1     |  c1      | data6
 p2     |  c1      | data7
 p3     |  c1      | data8
 p3     |  c2      | data9


which corresponds to a hierarchical list of:

p1 -
      c1 -
            data1
            data2
            data3
            data4
            data5
            data6
p2 -
      c1 -
            data7
p3 -
      c1 -
            data8
      c2 -
            data9


You have to flatten the hierarchical data so that the parent, child and
data arrays are all the same size.

Making a listbox hierarchical doesn't change the nature of the data it
represents, it just changes the way the data are displayed. So you can
always use Listbox cell position to know what row is selected.

Did I answer the question you asked?


On Mon, Feb 27, 2017 at 6:27 AM, Piotr Chabot Stadhouders via 4D_Tech <
[email protected]> wrote:

> Hi,
>
> I want to use a hierarchical listbox with arrays
> When I am in the on mouse move event of the listbox, how can I determine
> which element this is?
> I have found a tech tip where is explained how to get the row number.
> But how can I get from row number to array index?
>
> Say I have 6 elements in a 1 parent and 1 child array, and there are 3
> different parents, than the last row number returns 9, but there are only 6
> elements in the arrays.
>
> It must be something simple I've overlooked.
>
> Thanks in advance,
>
> Piotr
>
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[email protected]
> **********************************************************************




-- 
Kirk Brooks
San Francisco, CA
=======================
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to