I'm working on something which is leading to a cascade of questions so I 
suppose that I should just start by explaining what I am trying to do.  I have 
written some code which takes the results of an SQL query and displays it as a 
table in a GUI using list-box%.  This works and I am now writing the callback 
function.  One of the things I want it to do is sort the table by a given 
column when you click on that column header.  As far as I can tell, the way to 
do this is to get the contents of the table, sort it, and put it back. The 
Racket Guide doesn't show any way to just get all the data from the list-box% 
at once but you can get a row by index number.  Fine, so I could loop through 
and get all the rows but how do I know how many rows there are?  There isn't a 
way to get the number of rows directly but there is a way to get the number of 
visible items in the list-box% so maybe I could use that? 

The message is:
(send a-list-box number-of-visible-items)

So, at this point, I have my callback just using this message to report back 
the number of visible items when I click a column header.  I have a 4 x 8 table 
and it tells me that there are 35 items.  Where is this number coming from?  
Could it be a pair of opposite off-by-one errors and it thinks I have a 5x7 
table?  

There are ways to get around the problem.  I could, for example, maintain a 
parallel copy of the contents of the table but I want to write the most 
generalizable code possible since I expect to do this kind of thing repeatedly 
in different contexts.  It seems more reliable to work with the actual data in 
the list-box%.  

The bigger question is whether I am going about what I want to do the best way 
in the first place.  Is list-box really what I want to use?  Is there a better 
choice?  If not, should I work with someone to modify list-box to be more 
accommodating to my use case?

James

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to