Does FX/Ruby have some standard icons? 
Author Message
 Does FX/Ruby have some standard icons?

I'm trying to be vaguely clever, by only expanding
tree items when someone double clicks on them,
thus improving perceived performance (in terms of
startup time).

However, I'd like the user to know whether an item
has children.  Ie, whether it makes sense to
double click on an item.

Hence, I'd like to put two different icons next to
the tree nodes, depending upon whether they have
children in the data.  FOX won't know about the
children yet, since they won't be added to the
tree list until the double click, so it doesn't
display a "+" sign.

Are there any "standard" icons, or do I need to
actually have my own images, in order to add icons?

If there are, how do I get access to them?  Can
someone point me to the right part of the
documentation?

TIA.

Harry O.



Sat, 30 Jul 2005 12:47:29 GMT  
 Does FX/Ruby have some standard icons?

Quote:

> I'm trying to be vaguely clever, by only expanding tree items when
> someone double clicks on them, thus improving perceived performance (in
> terms of startup time).

> However, I'd like the user to know whether an item has children.  Ie,
> whether it makes sense to double click on an item.

> Hence, I'd like to put two different icons next to the tree nodes,
> depending upon whether they have children in the data.  FOX won't know
> about the children yet, since they won't be added to the tree list until
> the double click, so it doesn't display a "+" sign.

You are talking about two different issues with regards to how tree
items are drawn.

The first issue is whether the boxes with the +/- signs appear to the
left of (non-leaf) tree items. Two different options for the FXTreeList
widget control affect this. For root-level tree items, if you pass in
the TREELIST_ROOT_BOXES option you'll see these boxes; if not, you
won't. For other (non-root) tree items, the TREELIST_SHOWS_BOXES option
serves the same purpose.

The second issue (and independent of the first) is which icon(s) are
displayed when a tree item is open or closed. If you're using, for
example, FXTreeList#addItemLast to append child items to a parent node,
you can pass the "open" and "closed" icons as the third and fourth
arguments to addItemLast:

     treeList.addItemLast(parentItem, "Item Text", openIcon, closedIcon)

for the other methods on FXTreeList, see the API docs here:

     http://www.fxruby.org/doc/api

So for the application you've described, it sounds like you'd want to
turn off display of all of the "boxes", then use custom icons for the
leaf and non-leaf items, as appropriate.

Quote:
> Are there any "standard" icons, or do I need to actually have my own
> images, in order to add icons?

You'll need to provide your own icons. Any of the icons used for tree
lists in the FXRuby examples (e.g. splitter.rb) are fair game, if that
helps.


Sat, 30 Jul 2005 14:33:05 GMT  
 Does FX/Ruby have some standard icons?

Quote:

> The first issue is whether the boxes with the +/- signs appear to the
> left of (non-leaf) tree items. Two different options for the FXTreeList
> widget control affect this. For root-level tree items, if you pass in
> the TREELIST_ROOT_BOXES option you'll see these boxes; if not, you
> won't. For other (non-root) tree items, the TREELIST_SHOWS_BOXES option
> serves the same purpose.

Thanks.  I want the '+' signs.  What I was getting at is that at the time the
window is displayed, the top-level nodes won't have any children (because I'm
not inserting them into the tree until the user clicks on the node).

The default behaviour seems to be to show the '+' signs when there *are*
children, which is fine by me.  It was nice to see that when I add child
nodes after the window has been drawn, the '+' signs get added automatically
.. not surprising, but it would have been a pain if they weren't.

Quote:
> The second issue (and independent of the first) is which icon(s) are
> displayed when a tree item is open or closed. If you're using, for
> example, FXTreeList#addItemLast to append child items to a parent node,
> you can pass the "open" and "closed" icons as the third and fourth
> arguments to addItemLast:

>      treeList.addItemLast(parentItem, "Item Text", openIcon, closedIcon)

Yep.  I saw that in the RDoc for the API.  What I was hoping was that there
might be some way of asking FOX to use something like, say, the system's
standard icon for a file folder ... assuming such a "standard" icon exists
.. rather than having to load my own image.  Needing to do that isn't really
a big issue, it just means that deploying the program requires including the
image files, rather than just giving someone the single Ruby file.

I guess I could do something sneaky like encode the icons as data and put them
after __END__ in the Ruby code, so they can be read in at runtime.  Probably
more effort than it's worth, but I might do that, just as an experiment.

Quote:
> You'll need to provide your own icons. Any of the icons used for tree
> lists in the FXRuby examples (e.g. splitter.rb) are fair game, if that
> helps.

Excellent!  I'll give them a go.

By the way, are there any reasonably detailed tutorials on using FOX, other
than the one that comes with the library?  It's too bad that the Ruby book
market isn't better, because I reckon a book devoted to FX/Ruby would be
great.

Thanks for all the help.

Cheers,

Harry O.



Sun, 31 Jul 2005 04:28:05 GMT  
 Does FX/Ruby have some standard icons?

Quote:

> By the way, are there any reasonably detailed tutorials on using FOX, other
> than the one that comes with the library?

I see a few FOX tutorials listed on the Wiki site:

     http://www.fifthplanet.net/cgi-bin/wiki.pl?Tutorials

and at least one claims to be FXRuby-specific. I can't comment on how
detailed they are.



Mon, 01 Aug 2005 00:10:47 GMT  
 Does FX/Ruby have some standard icons?

Quote:

> > By the way, are there any reasonably detailed tutorials on
> using FOX,
> > other
> > than the one that comes with the library?

> I see a few FOX tutorials listed on the Wiki site:

>     http://www.fifthplanet.net/cgi-bin/wiki.pl?Tutorials

Good link (Good timing, too :-)

Many thanks, Lyle.

-botp



Mon, 01 Aug 2005 11:47:31 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. FX RUBY Dialog print

2. Drag and Drop example for FX/Ruby?

3. Yet another FX/Ruby question

4. FX/Ruby status line

5. Core dumps with FX/Ruby tables

6. Fun with FX ruby....

7. Novice needs help with FX Ruby

8. Problems installing FX/Ruby

9. Re Having trouble doing int 21/2521h

10. Is their a way to calculate standard devaition without having to maintian array

11. Having problems with standard modules with embedded python.

12. Whats the standard way of doing this?

 

 
Powered by phpBB® Forum Software