WxWidgets CheckListBox getting value issue

272 Views Asked by At

I have a problem with WxWidgets version 3.0.2. Currently I'm trying to get the value of a 'ChecklistBox' with index number 0.

It seems to work, however I can't get it to fill a string variable from C++.

I tried a lot of things, such as .ToString(), .mb_str(), (string)varname, etc.

The code I am using to get the value which I presume works, but returns a non 'string' result, so I can't use it in my C++ code... (at least not yet..)

The Code I use to get the value of index number 0 returns no errors:

CheckListBox = new wxCheckListBox(this, CHECKBOX1, wxDefaultPosition, wxSize(208,63), 0, 0, 0, wxDefaultValidator, _T("CHECKBOX1"));
CheckListBox->GetItem(0); //Seems to work (at least gives no errors)

String Test = CheckListBox->GetItem(0); //Fails

Error returned: conversion from ‘wxOwnerDrawn’ to non-scalar type std::__cxx11::string {aka std::__cxx11::basic_string}|*

Simple test such as the following work since I see 'Test' added to the CheckListBox:

CheckListbox->Check(CheckListBox->Append("Test"));

Thanks for any advice!

1

There are 1 best solutions below

5
On BEST ANSWER

I can't see GetItem(idx) in CheckListBox.

Perhaps you are looking for virtual wxString GetString (unsigned int n) const which is inherited from wxListBox.