# \- Combobox reading out current item

**URL:** <https://www.ruby-forum.com/t/combobox-reading-out-current-item/97629>\
**Category:** Ruby\
**Created:** [July 8, 2006, 9:28pm UTC](https://www.ruby-forum.com/t/combobox-reading-out-current-item/97629 "2006-07-08T21:28:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [July 8, 2006, 9:28pm UTC](https://www.ruby-forum.com/t/combobox-reading-out-current-item/97629/1 "2006-07-08T21:28:39Z")

</div>

Dear all,

I’d like to read out the current item of a combobox.  
In the documentation about FOX, there’s a promise  
that for some developer version 1.5.x, it’s  
possible to access FXCombobox using SEL\_CHANGED  
I’m using FXRuby and Fox 1.6., as provided in the brand-new one-click  
installer  
for Windows version.  
But this doesn’t seem to work.

@cb=FXComboBox.new(self, 21, eval(_‘@’_ (mailto:‘@’) + m\_label),  
0,COMBOBOX\_STATIC|FRAME\_SUNKEN|FRAME\_THICK|LAYOUT\_RIGHT){|cb|  
for i in removed\_email\_address@domain.invalid\_ ([mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid))  
cb.appendItem(@array[i])  
end  
}

# ok so far, for the creation of the combobox

@cb.connect(SEL\_CHANGED){ p ‘you changed me!’ }

# but then no output when I click on it … ☹

Thanks in advance,

Best regards,

Axel

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [July 8, 2006, 10:36pm UTC](https://www.ruby-forum.com/t/combobox-reading-out-current-item/97629/2 "2006-07-08T22:36:07Z")

</div>

On 7/8/06, removed\_email\_address@domain.invalid [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’d like to read out the current item of a combobox.  
> In the documentation about FOX, there’s a promise  
> that for some developer version 1.5.x, it’s  
> possible to access FXCombobox using SEL\_CHANGED…  
> But this doesn’t seem to work.

I will file a bug report on your behalf. In the meantime, just catch  
SEL\_COMMAND instead. Also, I’m pretty sure that you need to fix your  
call to FXComboBox.new. The third argument should be a reference to  
the target (an FXObject instance). In your case, it should probably  
just be nil:

```
@cb = FXComboBox.new(self, 21, nil, 0,
         COMBOBOX_STATIC|FRAME_SUNKEN|FRAME_THICK|LAYOUT_RIGHT) {
  ...
}

```

Also, as fascinating as this must be for the readers of ruby-talk, you  
might want to consider posting FXRuby-specific stuff like this to the  
fxruby-users mailing list instead.

Hope this helps,

Lyle
