Hi! I hope this question is easy.
Is there a tutorial somewhere showing how to modify the values of a checkbox inside the C++ code?
I created a set of checkboxes called "CheckBoxes_ListBox" with the following values:
New Year's Day;Memorial Day;Independence Day;Labor Day;Thanksgiving;Christmas Eve;Christmas Day;New Year's Eve
In the same sizer, I added two buttons: one says "Check All," and the other says "Uncheck All." The goal, of course, is to be able to check or uncheck all the boxes with a single click.
I created the events for clicking the buttons and built the event handler code. So it's there. And now I don't know how to reference the checkbox values.
So, again, is there code I can study online for examples?
I could also use examples for radio buttons and drop-down lists.
----
Per http://forums.codelite.org/viewtopic.php?f=11&t=804:
1. Your codelite version: 9.1.5
2. Is it a self compiled version of codelite: I don't understand this question. I did not compile it; I'm using it as-is. Does that answer the question?
3. Your OS: Windows 7. Target is Windows.
4. Compiler version: g++ TDM-GCC, version 5.1.0.3
Thank you!
Colleen
Need Examples on Referencing Checkbox Values in C++
- ColleenKobe
- CodeLite Expert
- Posts: 130
- Joined: Wed Mar 30, 2016 4:31 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Need Examples on Referencing Checkbox Values in C++
In the event handler for the event 'wxEVT_BUTTON_CLICKED' of the "Check All" button you can do this:
Eran
Code: Select all
void MyClass::OnCheckAll(wxCommadEvent& e)
{
for(size_t i=0; i<CheckBoxes_ListBox->GetCount(); i++){
CheckBoxes_ListBox->Check((unsigned int)i, true);
}
}
void MyClass::OnUnCheckAll(wxCommadEvent& e)
{
for(size_t i=0; i<CheckBoxes_ListBox->GetCount(); i++){
CheckBoxes_ListBox->Check((unsigned int)i, false);
}
}
Make sure you have read the HOW TO POST thread
- ColleenKobe
- CodeLite Expert
- Posts: 130
- Joined: Wed Mar 30, 2016 4:31 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Need Examples on Referencing Checkbox Values in C++
YAAAY! That worked!
Thank you, Eran! You're brilliant!
Colleen
Thank you, Eran! You're brilliant!
Colleen