[fxruby-users] Draw on top of a widget?

David Peoples davidp at touringcyclist.com
Fri Apr 22 00:49:29 EDT 2005

Is there a way to draw an arbitrary text string "on top of" an FXRuby 
widget, in this case an FXListBox? I want to overwrite a portion of the 
text in the selection box with that same text but drawn as if 
"selected". Can this be done in FXRuby?

What am I trying to do? I'm making a version of the FXListBox widget 
with a keyboard interface. As you type characters, the first item in the 
list that matches the typed character(s) is selected. I have the key 
capturing and list matching routine down, and the correct item is 
getting displayed in the selection box. But I want to visually indicate 
what portion of that item has matched the typed text, and thus I want to 
draw just a portion of the item in the "selected" state. Since the 
selection box portion of the FXListBox widget is an FXButton under the 
skin in Fox and FXButtons don't have any way to display partial 
selection like say an FXTextField would, I don't see any way to do this 
directly in the FXListBox itself. Thus my idea of this "draw on top" kludge.

I know a much cleaner approach would be to make a Fox FXButton widget 
that implements and displays subselection of the caption, make a new Fox 
"MyFXListBox" that uses that altered FXButton, all in C++, and make the 
glue code that imports that new widget into FXRuby. But my C++ is really 
weak, and I don't know thing one about SWIG. If it turns out that the 
"draw on top" kludge can't work, I'd appreciate seeing the source for 
any  custom Fox C++ widgets that have been merged into FXRuby, or at 
least pointers for getting started with SWIG.

Thanks for your time.

David Peoples

More information about the fxruby-users mailing list