[fxruby-users] FXListBox makeItemVisible

Gérard Ménochet gerard.menochet at wanadoo.fr
Wed Apr 26 21:35:49 EDT 2006


An example

      libo = FXListBox.new(parent, nil, 0)
      libo.numVisible = 6
      (1980..2050).each do |i| libo.appendItem(i.to_s) end
      libo.currentItem=26

    No 'makeItemVisible' at the first show. If you click one year, it will
always do it .

    To workaround, I do that

      libo.connect(SEL_CONFIGURE) do |sender,selector,data|
        begin ;   libo.currentItem  =  libo.currentItem   ;  rescue ;  end #
force the makeItemVisible
      end

Thanks

Gérard Ménochet

----- Original Message -----
From: "Lyle Johnson" <lyle at knology.net>
To: "Gérard Ménochet" <gerard.menochet at wanadoo.fr>
Cc: <fxruby-users at rubyforge.org>
Sent: Thursday, April 27, 2006 2:29 AM
Subject: Re: FXListBox makeItemVisible



On Apr 26, 2006, at 6:02 PM, Gérard Ménochet wrote:

>     I have the same problem. I tried to use the currentItem,
> setCurrentItem() method (i guess the same thing that currentItem= ),
> that
> works but apparently, no call to
> makeItemVisible(). (fxruby version 1.4.4   - ruby 1.8.4 - win32)

I just checked the source code for FXListBox in FOX 1.4.29, and calling
setCurrentItem() on an FXListBox does in fact call makeItemVisible() on
the embedded FXList:

// Change current item
void FXListBox::setCurrentItem(FXint index){
list->setCurrentItem(index);
list->makeItemVisible(index);
if(0<=index){
field->setIcon(list->getItemIcon(index));
field->setText(list->getItemText(index));
} else {
field->setIcon(NULL);
field->setText(" ");
}
}

Do you have an example program that demonstrates the problem?

Lyle




More information about the fxruby-users mailing list