# FXRuby ComboBox problems:

**URL:** <https://www.ruby-forum.com/t/fxruby-combobox-problems/57423>\
**Category:** Ruby\
**Created:** [April 10, 2006, 8:41pm UTC](https://www.ruby-forum.com/t/fxruby-combobox-problems/57423 "2006-04-10T20:41:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![christer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a5b964/32.png) [@christer](https://www.ruby-forum.com/u/christer)\
**Post date:** [April 10, 2006, 8:41pm UTC](https://www.ruby-forum.com/t/fxruby-combobox-problems/57423/1 "2006-04-10T20:41:33Z")

</div>

First problem: The empty alternative shows just about two pixels in  
height.  
“”  
“male”  
“female”  
How can I get the full height?

Second problem: The leftmost characters in the combo has a lighter  
background color. The number of characters seem to equal the shortest  
string  
" " # shortest string  
“male” # m has lighter background  
“female” # f has lighter background  
How can I get the correct background color everywhere in the combo?

These are minor problems, but disturbing.  
I really love the speed and the API of FX, so I’m not ready to switch  
yet.

some code:

```
# Win XP, FXRuby 1.4.3
width = 10
cbo = FXComboBox.new(@parent, width, nil, 0, COMBOBOX_STATIC)
cbo.appendItem(" ",0)
cbo.appendItem("female",1)
cbo.appendItem("male",2)
```

---

<div class="post-metadata">

**Author:** ![christer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a5b964/32.png) [@christer](https://www.ruby-forum.com/u/christer)\
**Post date:** [April 10, 2006, 9:16pm UTC](https://www.ruby-forum.com/t/fxruby-combobox-problems/57423/2 "2006-04-10T21:16:37Z")

</div>

On 4/10/06, Christer N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> First problem: The empty alternative shows just about two pixels in  
> height.  
> “”  
> “male”  
> “female”  
> How can I get the full height?  
> easiest way is to put a space inside instead of an empty string.  
> annother way would be setting the layout to LAYOUT\_FIX\_HEIGHT.

> Second problem: The leftmost characters in the combo has a lighter  
> background color. The number of characters seem to equal the shortest  
> string  
> " " # shortest string  
> “male” # m has lighter background  
> “female” # f has lighter background  
> How can I get the correct background color everywhere in the combo?

strange feature isn’t it? don’t know when the combobox became like  
this. anyway here is the trick that removes the selection of the text:  
cbo.children[0].killSelection

hth,  
– henon

[snipped]

---

<div class="post-metadata">

**Author:** ![christer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a5b964/32.png) [@christer](https://www.ruby-forum.com/u/christer)\
**Post date:** [April 11, 2006, 8:29am UTC](https://www.ruby-forum.com/t/fxruby-combobox-problems/57423/3 "2006-04-11T08:29:46Z")

</div>

I tried the advice, but failed to see any improvement.  
LAYOUT\_FIX\_HEIGHT did not work, and cbo.children[0] refers FXWindow,  
not FXTextField, where killSelection is defined.

I must have found a weak spot of FXRuby. The combobox is used for  
selecting a string in 90% of all cases. The default behaviour of  
FXComboBox is text editing and substring selection.

I’ve tried to find the source code, but failed.

Christer

---

<div class="post-metadata">

**Author:** ![christer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a5b964/32.png) [@christer](https://www.ruby-forum.com/u/christer)\
**Post date:** [April 11, 2006, 9:38am UTC](https://www.ruby-forum.com/t/fxruby-combobox-problems/57423/4 "2006-04-11T09:38:15Z")

</div>

On 4/11/06, Christer N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Christer

hmm, sorry. but, i have tried it in FXRuby1.4.4 and i actually got an  
FXTextField!  
i also checked out the height thing: the height of the combo is always  
the same for me … only the item with the empty string in the list is  
very small.

– henon
