> Programming Languages > Ruby
Various Topics Home

Ruby



Ruby Programming Languages FXIconList Questions


Default FXIconList Questions

Hi,

I have a cl that extends FXIconList; I'm having some trouble with a
few things.

1) When a user cs on a header, I'd like to sort that column
alphabetically. I've looked at the sample iconlist.rbw, but sorting
doesn't seem to work there.

2) I'd like to dynamically change the style of the icon list, from
details to big icons. I need to be able to do this from a method
because I'd like to do other things when the style changes, so I can't
do "FXMenuCommand.new(menuPane, "&Big Icons", nil, iconlist,
FXIconList::ID_SHOW_BIG_ICONS)"

Any ideas?

Thanks!

Karl.
Default Re: FXIconList Questions

Karl wrote:

> I have a cl that extends FXIconList; I'm having some trouble with a
> few things.
>
> 1) When a user cs on a header, I'd like to sort that column
> alphabetically. I've looked at the sample iconlist.rbw, but sorting
> doesn't seem to work there.


I will send a modified version of the 'iconlist' example program to Karl
privately, but the basic steps are to:

* Subcl FXIconItem to override its <=> method. This gets used
by FXIconList's sorems method to sort the items.

* Subcl FXIconList to additionally listen for "cs" on the
header item buttons, and then change the current sorting method
used for the icon items and then re-sort by calling
FXIconList#sorems.

Will also try to write up a little tutorial or something describing this
in more detail...

> 2) I'd like to dynamically change the style of the icon list, from
> details to big icons. I need to be able to do this from a method
> because I'd like to do other things when the style changes, so I can't
> do "FXMenuCommand.new(menuPane, "&Big Icons", nil, iconlist,
> FXIconList::ID_SHOW_BIG_ICONS)"


Use the FXIconList#getListStyle and FXIconList#setListStyle methods to
query and set the style flags, e.g.

style = iconList.getListStyle()
style &= ~ICONLIST_MINI_ICONS
style |= ICONLIST_BIG_ICONS
iconList.setListStyle(style)

or in a more compact form,

iconList.listStyle &= ~ICONLIST_MINI_ICONS
iconList.listStyle |= ICONLIST_BIG_ICONS

or even shorter,

iconList.handle(self,
MKUINT(FXIconList::ID_SHOW_BIG_ICONS, SEL_COMMAND), nil)

The last one is what the menu command button does when you c it.


Thread Tools
Display Modes





Powered by vBulletin®
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0