Discussion:
Managing a 'ghost' listbox
Jean-Luc Arnaud
2016-10-14 10:05:06 UTC
Permalink
Hi all,

I never tried that, so some help or advice is welcome.
I have to deal with two Listboxes, one on the left, the other on the right.
When the first is empty (that is, 20 rows for my need), additional raws
are displayed in the right listbox.
Each row gets a lot of information, some displayed (cells), some hidden
(celltags).

In order to simplify my code, instead of managing two listboxes, I would
like to manage a 'ghost' hidden third listbox.
This last one will be updated (addrow, delererow, update of cells and
celltags) and then, its 20 first rows will be copied into the left
listbox, the remaining in the right one.

What's the best way to create the third listbox?
- Via code, i.e. ThirdListbox=New Listbox and setup of number of columns
and other parameters,
- Or as an object outside the window, or in the window but not visible.

Any suggestion welcome

TIA
--
Jean-Luc Arnaud


_______________________________________________
Unsubscribe by sending a message to:
<nug-***@lists.xojo.com>

List Help: <***@xojo.com>
Markus Winter
2016-10-14 11:40:01 UTC
Permalink
I would make a class myClass with all the information you need, eg one dataset.
Add an array myArray() as myClass -> you have an array ready to be filled with your classes
Add your data to the array by making a new instance of class myClass for each dataset and appending it to the array
Add each class to the rowTag of the listbox as required
In the CellTextPaint event fill each row from the data contained in the class hidden in the rowTag, eg me.cell(row, 0) = myClass( me.rowtag ).SomeStringProperty

MfG

Markus

Sent from my iPad


_______________________________________________
Unsubscribe by sending a message to:
<nug-***@lists.xojo.com>

List Help: <***@xojo.com>
Jean-Luc Arnaud
2016-10-14 14:42:22 UTC
Permalink
Will try to understand (first) and then to apply such a technic.

Thanks a lot, Markus.

Jean-Luc Arnaud
Post by Markus Winter
I would make a class myClass with all the information you need, eg one dataset.
Add an array myArray() as myClass -> you have an array ready to be filled with your classes
Add your data to the array by making a new instance of class myClass for each dataset and appending it to the array
Add each class to the rowTag of the listbox as required
In the CellTextPaint event fill each row from the data contained in the class hidden in the rowTag, eg me.cell(row, 0) = myClass( me.rowtag ).SomeStringProperty
MfG
Markus
Sent from my iPad
_______________________________________________
_______________________________________________
Unsubscribe by sending a message to:
<nug-***@lists.xojo.com>

List Help: <***@xojo.com>
Lars Jensen
2016-10-15 17:27:08 UTC
Permalink
Why do you need an invisible listbox? It seems like you could use a
two-dimensional array of strings to hold the "ghost" data?

lj
Post by Jean-Luc Arnaud
Hi all,
I never tried that, so some help or advice is welcome.
I have to deal with two Listboxes, one on the left, the other on the right.
When the first is empty (that is, 20 rows for my need), additional raws
are displayed in the right listbox.
Each row gets a lot of information, some displayed (cells), some hidden
(celltags).
In order to simplify my code, instead of managing two listboxes, I would
like to manage a 'ghost' hidden third listbox.
This last one will be updated (addrow, delererow, update of cells and
celltags) and then, its 20 first rows will be copied into the left listbox,
the remaining in the right one.
What's the best way to create the third listbox?
- Via code, i.e. ThirdListbox=New Listbox and setup of number of columns
and other parameters,
- Or as an object outside the window, or in the window but not visible.
Any suggestion welcome
TIA
--
Jean-Luc Arnaud
_______________________________________________
_______________________________________________
Unsubscribe by sending a message to:
<nug-***@lists.xojo.com>

List Help: <***@xojo.com>
Jean-Luc Arnaud
2016-10-17 08:20:03 UTC
Permalink
Yes, I could, but I have a routine writing in and reading from this
listbox, based on the row number, and I don't want to juggle with row
numbers on one hand, indexes of a two-dimensional array on the other hand.

Jean-Luc Arnaud
Post by Lars Jensen
Why do you need an invisible listbox? It seems like you could use a
two-dimensional array of strings to hold the "ghost" data?
lj
Post by Jean-Luc Arnaud
Hi all,
I never tried that, so some help or advice is welcome.
I have to deal with two Listboxes, one on the left, the other on the right.
When the first is empty (that is, 20 rows for my need), additional raws
are displayed in the right listbox.
Each row gets a lot of information, some displayed (cells), some hidden
(celltags).
In order to simplify my code, instead of managing two listboxes, I would
like to manage a 'ghost' hidden third listbox.
This last one will be updated (addrow, delererow, update of cells and
celltags) and then, its 20 first rows will be copied into the left listbox,
the remaining in the right one.
What's the best way to create the third listbox?
- Via code, i.e. ThirdListbox=New Listbox and setup of number of columns
and other parameters,
- Or as an object outside the window, or in the window but not visible.
Any suggestion welcome
TIA
--
Jean-Luc Arnaud
_______________________________________________
_______________________________________________
_______________________________________________
Unsubscribe by sending a message to:
<nug-***@lists.xojo.com>

List Help: <***@xojo.com>

Loading...