Hmm, are the ids the ids from the checkboxes ???
If you want to handle an element by it's id you should use getElementFromId(...) to get the pointer to it !!!
if (driv == "EDT_OPENGL"){
if (id == 4){
guiEnv->getElementFromId(4, true)->setChecked(false);
}
if (id == 5){
guiEnv->getElementFromId(5, true)->setChecked(false);
}
}
class RadioGroup
{
public:
RadioGroup()
{
}
~RadioGroup
{
u32 b;
for (b = 0; b < Boxes.size(); ++b)
Boxes[b]->drop();
}
void addCheckBox(IGUICheckBox* box)
{
box->grab();
Boxes.push_back(box);
}
void removeCheckBox(IGUICheckBox* box)
{
s32 n = Boxes.linear_search(box);
if (n != -1)
{
Boxes[n]->drop();
Boxes.erase(n);
}
}
void setCheckedBox(IGUICheckBox* box)
{
u32 b;
for (b = 0; b < Boxes.size(); ++b)
if (Boxes[b] != box) Boxes[b]->setChecked(false);
}
private:
core::array<IGUICheckBox*> Boxes;
};
You would just create one of these to manage the checkbox state. Add all of the related checkboxes to one of these. Then your event receiver would just call setCheckedBox() and the other boxes would automatically get unchecked.
Another option would be to use a combo box instead. The combo box only allows one active selection, takes up less ui space and is already written and working.