edit scrollbar and properties of list in wxComboCtrl

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
DeeJay
Knows some wx things
Knows some wx things
Posts: 27
Joined: Thu Sep 16, 2021 12:15 pm

edit scrollbar and properties of list in wxComboCtrl

Post by DeeJay »

Hello,
I have created a wxListView inside a wxComboCtrl a populated the list with items according to samle in:

https://docs.wxwidgets.org/3.0/classwx_combo_ctrl.html

I want to:

1. Change size of the textfield in the wxComboCtrl.
2. Change the alignment of the items in the dropdown wxListCtrl - allign to the left.
3. Disable the horizontal scrollbar and add a vertical scrollbar.

ad 1. I tried - SetSize() on both comboCtrl and popupCtrl without success.
ad 2. I tried to call popupCtrl->Arrange(wxLIST_ALIGN_LEFT), but without any visible change
ad 3. I tried popupCtrl->SetScrollbar(), but without any visible change.

Can anybody tell me how to achieve the points 1 - 3?

Thanks!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: edit scrollbar and properties of list in wxComboCtrl

Post by ONEEYEMAN »

Hi,
1. You should override DoGetBestSize() and return new size. You are using sizers, right?
2.what do you use as items - text ot icons?

And finally - whats your wx version and OS?

Thank you.
DeeJay
Knows some wx things
Knows some wx things
Posts: 27
Joined: Thu Sep 16, 2021 12:15 pm

Re: edit scrollbar and properties of list in wxComboCtrl

Post by DeeJay »

Hi ONEEYEMAN ,
thank you for your reply.

I use Ubuntu 18.04.5 LTS; version of wxWidgets is 3.0.5.

1. So, the new size, which DoGetBestSize() returns, returns the optimal size of the text field of the wxComboCtrl when included into a sizer. Right?

- Yes, I add the wxComboCtrl into a cell of the wxGridBagSizer. But I leave the expansion parameter set to 0 - keeps the original size of the object.


2. I use text.


Do you have any suggestion about point 3?

Thanks.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: edit scrollbar and properties of list in wxComboCtrl

Post by doublemax »

DeeJay wrote: Mon Sep 20, 2021 10:11 am 1. Change size of the textfield in the wxComboCtrl.
2. Change the alignment of the items in the dropdown wxListCtrl - allign to the left.
3. Disable the horizontal scrollbar and add a vertical scrollbar.
1) if the control is inside a sizer, the sizer takes control over the size. But you can still affect it with SetMinSize().

2) the default alignment is left-aligned. Can you show the code how you create the control and fill it with data?

3) For native controls, the scrollbars can not always be removed. Would something like wxSimpleHtmlListBox work for your purpose?
https://docs.wxwidgets.org/trunk/classw ... t_box.html
Use the source, Luke!
Post Reply