I built a similar control, although it does not represent directory paths, 
just labels which are stacked vertically. I ended up defining a structure 
to hold the text and width + height of each label and keep these structures 
in a list. In my case, all labels have the same size so converting a mouse 
coordinate to a list index is just arithmetic, but it could be extended to 
support variable width labels and just search the list in linear time to 
convert a mouse coordinate to a list index. The number of items in the 
control should be small enough that linear search should not be a 
disadvantage.

You can find the definition of the control here:

https://github.com/alex-hhh/ActivityLog2/blob/master/rkt/widgets.rkt#L1910

To convert it to variable width labels, the `hover-candiate` function would 
have to be changed (third `cond` option) to do a linear search on the label 
widths. `label-box-dimensions` would also have to change to report the 
actual label width and height for all labels (currently all labels have the 
dimensions of the largest one).

Best Regards,
Alex.

-- 
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