Page 1 of 1

gui checkbox problem

Posted: Mon Dec 29, 2008 6:09 am
by hzsyber
i want reset a form,

like web form's reset.

code:

Code: Select all

void UIControl::ResetLoginForm(PostData* postdb)
//Clear All EditBox & CheckBox values
{
	IGUIElement* root = guienv->getRootGUIElement();
	for (int i = 0; i < postdb->CS32Lenth; i++)
		if (root->getElementFromId(postdb->CS32List[i],true)->getType() == EGUIET_EDIT_BOX)
		{
			root->getElementFromId(postdb->CS32List[i], true)->setText(L"");
		}
		else if (root->getElementFromId(postdb->CS32List[i],true)->getType() == EGUIET_CHECK_BOX)
		{
		//	root->getElementFromId(postdb->CS32List[i], true)->   /*Here, how to reset a IGUICheckBox?*/
		}
		 
		
}
How to reset a IGUICheckBox?

Posted: Mon Dec 29, 2008 6:38 am
by skumar
You should go through the API docs first , before programming or else you may get stuck with simple things....To set the state of a checkbox use setChecked(bool) function.....

Posted: Mon Dec 29, 2008 7:38 am
by hzsyber
yes,i found irr API doc

root->getElementFromId(postdb->CS32List, true)->
no setChecked(bool) function.this function is under class IGUICheckBox

i no found function return is IGUICheckBox,except addCheckBox() :(.

Posted: Mon Dec 29, 2008 7:58 am
by Ion Dune
Presuming that you know its a check box:

Code: Select all

((IGUICheckBox*)root->getElementFromId(postdb->CS32List[i], true)->)setChecked(...)
use IGUIElement::getType () to be certain.

Posted: Mon Dec 29, 2008 9:01 am
by hzsyber
Ion Dune wrote:Presuming that you know its a check box:

Code: Select all

((IGUICheckBox*)root->getElementFromId(postdb->CS32List[i], true)->)setChecked(...)
use IGUIElement::getType () to be certain.
yes!

thanks you!