listbox rowtag? 
Author Message
 listbox rowtag?

Is there any way to do something like a rowtag with a listbox?  I
often seem to have this problem where I have an array of data (each
element is a custom class) which I'd like to display in a listbox.
This is fine until the user sorts the listbox differently or moves
things around (I don't want to disable this functionality).  As soon
as they do that, it becomes difficult to keep track of which data is
in which listbox index.  A rowtag like the ones for popup menus would
be a perfect place to store some data..

Does anyone have any ideas on how to keep track of which element is
where?  What I've done so far is just attempted to make the same
changes to my "real" data array as the user makes to the listbox, but
that's really a pain..

Thanks.



Tue, 13 Dec 2005 07:33:49 GMT  
 listbox rowtag?

Quote:

> Is there any way to do something like a rowtag with a listbox?  I
> often seem to have this problem where I have an array of data (each
> element is a custom class) which I'd like to display in a listbox.
> This is fine until the user sorts the listbox differently or moves
> things around (I don't want to disable this functionality).  As soon
> as they do that, it becomes difficult to keep track of which data is
> in which listbox index.  A rowtag like the ones for popup menus would
> be a perfect place to store some data..

> Does anyone have any ideas on how to keep track of which element is
> where?  What I've done so far is just attempted to make the same
> changes to my "real" data array as the user makes to the listbox, but
> that's really a pain..

> Thanks.

This is a FAQ.

First: Request Rowdata for listboxes from RS on their web site.

Second: You can make a hidden column that contains an index to an array
element. As rows are sorted, the hidden column gets shuffled as well,
and you can just use that to index to your data array.

Third: You can make another array that contains the same information
that would be in the hidden column. This means you have to reindex the
array whenever a sort occurrs.

HTH.



Tue, 13 Dec 2005 09:08:54 GMT  
 listbox rowtag?
Thanks for the suggestions.. Right after I posted, I figured out that
you can use the ColumnWidths property of the listbox to set one of the
columns to 0%.  Then you can put the data in that column..  Seems to
work fine.

Now if REALSoftware would just get their act together and start being
consistent the starting list index (0 or 1) for all of their data
structures/controls.  If they're going to be inconsistent with them
they should at least clearly state in the help file the starting index
for each item...



Tue, 13 Dec 2005 13:45:29 GMT  
 listbox rowtag?

Quote:
>Thanks for the suggestions.. Right after I posted, I figured out that
>you can use the ColumnWidths property of the listbox to set one of the
>columns to 0%.  Then you can put the data in that column..  Seems to
>work fine.

Another option, if your listbox has 3 columns (index 0 to 2), you can
store your data in the fourth (index 3) column. There is no interrupt
if the column argument of the .cell method is above the number of
column. -> no need to set the width of this column.

--
Frdric Testuz



Tue, 13 Dec 2005 15:30:35 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Popup Rowtag Property

2. Listbox background paint and *my* listbox bug

3. Tk Listbox bindings (was: Tk Listbox Question)

4. listbox-rtb (listbox recolor) for TK4.0

5. Making Tk listboxes behave like MS-Windows listboxes

6. How do I make one listbox's choices be dependent on another listbox selection?

7. How to make ENTRY mirror active element in LISTBOX? and other listbox questions..

8. ListBox in VA 4.02 question

9. Owner-draw listbox?

10. VAST: "extended" listbox behavior

11. Hierarchical listbox: hot to test for sublistitem

12. 50,000 Record database to Listbox

 

 
Powered by phpBB® Forum Software