Problem with ComboBox in version 2.8.0 Topic is solved

Are you writing your own components and need help with how to set them up or have questions about the components you are deriving from ? Ask them here.
tigdra83
Earned a small fee
Earned a small fee
Posts: 14
Joined: Thu Jan 04, 2007 9:20 am

Problem with ComboBox in version 2.8.0

Post by tigdra83 »

Hi,

a simple question about the ComboBox:
I'm using the Version 2.8.0 and the ComboBox is filled with an array. This entries are sorted, but the style is without the option wxCB_SORT.
In the version 2.6.3 from wxWidgets, this sorting-problem isn't there.

Any idea to get rid of this problem?

Here's the code-fragment:

wxArrayString string;
string.Add(_T("d"));
string.Add(_T("c"));
string.Add(_T("b"));
string.Add(_T("a"));

wxComboBox* cbox = new wxComboBox(this, wxID_ANY, _T("MyBox"), wxPoint(10,10), wxDefaultSize, string, wxCB_DROPDOWN);
tigdra83
Earned a small fee
Earned a small fee
Posts: 14
Joined: Thu Jan 04, 2007 9:20 am

Post by tigdra83 »

Hello again,

can anybody tell me if this problem is there indeed or I'm only stupid and don't see my mistake??

Thanks
manianis
Experienced Solver
Experienced Solver
Posts: 72
Joined: Mon Jan 15, 2007 11:00 am

Post by manianis »

Everything seems to be ok with your code. Normally the entries won't be sorted unless you're using wxCB_SORT style.

The problem is somewhere else in your code.
tigdra83
Earned a small fee
Earned a small fee
Posts: 14
Joined: Thu Jan 04, 2007 9:20 am

Post by tigdra83 »

Yes, I think so that the code is okay. But the worst thing is, that exactly the same program/code is running fine in version 2.6.3 of wxWidgets, that means that there the entries are not sorted...
So I don't know if there's a bug or something else...
Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg »

The same ol' bug tracking recipe applies. Check the samples in the wx2.8.0 directory, if they exhibit the same behaviour as your code and they shouldn't, you can be pretty sure it's a bug ;-) You can post the bug report at SF.net ...

Regards,
- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
manianis
Experienced Solver
Experienced Solver
Posts: 72
Joined: Mon Jan 15, 2007 11:00 am

Post by manianis »

I'm using the Unicode Compilation of wxWidgets and I've tested this code:

Code: Select all

 wxString itemComboBox32Strings[] = {
        _("d"),
        _("b"),
        _("c"),
        _("a")
    };
    wxComboBox* itemComboBox32 = new wxComboBox( itemPanel6, ID_BASICCONTROLS_COMBOBOX, _("a"), wxDefaultPosition, wxSize(130, -1), 4, itemComboBox32Strings, wxCB_DROPDOWN );
    itemComboBox32->SetStringSelection(_("a"));
the items are not sorted and they appear in the same order they are declared.
Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg »

Where is your wxCB_SORT flag ??

Regards,
- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
tigdra83
Earned a small fee
Earned a small fee
Posts: 14
Joined: Thu Jan 04, 2007 9:20 am

Post by tigdra83 »

thanks, I'll check if the behaviour is because of the configure-options...
Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg »

You need to add that flag to the constructor of the wxComboBox. No need to configure wxWidgets if that is what you were referring to.

- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
tigdra83
Earned a small fee
Earned a small fee
Posts: 14
Joined: Thu Jan 04, 2007 9:20 am

Post by tigdra83 »

================
I'm using the Unicode Compilation of wxWidgets and I've tested this code:
================

Hello again,

I've tested your code with an unicode-compiled wxVersion and the same error occurs. The parameter for the configure-script were:

./configure --enable-unicode --with-x11 --disable-shared --enable-log --enable-debug -without-odbc --enable-debug_cntxt

But I'm not sure if the configuration is the problem... So on, I have really no idea what it can be, because if this example is running good on your system...

Furthermore I've tested the combo-example from wxWidgets and it run's fine... But the minimal example from wxWidgets only with an ComboBox (exactly your code, see below) sorts the entries, and this in both configuration (with and without unicode)...

//something before

// frame constructor
MyFrame::MyFrame(const wxString& title)
: wxFrame(NULL, wxID_ANY, title)
{
// set the frame icon
//SetIcon(wxICON(sample));

//Test
wxString s[] = {
_("d"),
_("b"),
_("c"),
_("a")
};
wxComboBox* itemComboBox32 = new wxComboBox( this, wxID_ANY, _("a"), wxDefaultPosition, wxSize(130, -1), 4, s, wxCB_DROPDOWN );
itemComboBox32->SetStringSelection(_("a"));

#if wxUSE_MENUS
// create a menu bar
wxMenu *fileMenu = new wxMenu;

//something below
Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg »

Ok I didn't understand the problem, I thought there was no sorting, but it seemed you meant there was, without any need to. If you explicitly kill the flag with ~(wxCB_SORT) & {your other flags} ?

Once again ,sorry for misreading your post.

- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
tigdra83
Earned a small fee
Earned a small fee
Posts: 14
Joined: Thu Jan 04, 2007 9:20 am

Post by tigdra83 »

Good idea, but it doesn't help...

Anyway... Bad box :wink:
manianis
Experienced Solver
Experienced Solver
Posts: 72
Joined: Mon Jan 15, 2007 11:00 am

Post by manianis »

Perhaps it's a bug in the Linux compil of wxWidgets. I'm using wxWidgets under windows and for now everything is Ok.
tigdra83
Earned a small fee
Earned a small fee
Posts: 14
Joined: Thu Jan 04, 2007 9:20 am

Post by tigdra83 »

I don't think it's a bug in the configuration or Linux compile because then the combo-example also would be wrong. But there the entries are in correct order.

I think it's a very stupid mistake but I'm unable to find it. And I wonder because of 4 lines I've added to the minimal example, there can't be a mistake...
manianis
Experienced Solver
Experienced Solver
Posts: 72
Joined: Mon Jan 15, 2007 11:00 am

Post by manianis »

tigdra83 wrote:I don't think it's a bug in the configuration or Linux compile because then the combo-example also would be wrong. But there the entries are in correct order.

I think it's a very stupid mistake but I'm unable to find it. And I wonder because of 4 lines I've added to the minimal example, there can't be a mistake...
Check if the strings you're insterting are not sorted after insertion !
Post Reply