Original Post
Hi!
I 've created an Input Box(a modal window with edit box, OK&CANCEL buttons), if an image is clicked. I've to close this window if OK or CANCEL button is clicked. I've removed the window,inside the click event of these buttons.
My problem is, if I visit the menu page second time and click the image, the Input Box window doesn't open.
This is my code:
I've checked for m_pInput == NULL why because I'm creating this Input Box on clicking an image. So an input box will be created on each click otherwise.
Here is the event handler:
What to do to open the window on second visit also?
I 've created an Input Box(a modal window with edit box, OK&CANCEL buttons), if an image is clicked. I've to close this window if OK or CANCEL button is clicked. I've removed the window,inside the click event of these buttons.
My problem is, if I visit the menu page second time and click the image, the Input Box window doesn't open.
This is my code:
if(m_pCreateProfileImage->getRelativePosition().isPointInside(m_MousePos)) { if(m_pInput == NULL) { m_pInput = pManager->getGUIEnvironment()->addWindow(recti(100,100,400,250),true,L"Create a New Profile",0,ID_WINDOW_INPUT); m_pEdit = pManager->getGUIEnvironment()->addEditBox(L"Enter",recti(30,50,250,80),true,m_pInput,ID_EDIT_BOX); m_pEdit->setMax(10); m_pBtnOK = pManager->getGUIEnvironment()->addButton(recti(20,90,100,120),m_pInput,ID_BUTTON_OK, L"OK", L"Click to create Profile"); m_pBtnCancel = pManager->getGUIEnvironment()->addButton(recti(120,90,200,120),m_pInput,ID_BUTTON_CANCEL,L"Cancel",L""); } }I've checked for m_pInput == NULL why because I'm creating this Input Box on clicking an image. So an input box will be created on each click otherwise.
Here is the event handler:
if(event.GUIEvent.EventType == EGET_BUTTON_CLICKED) { s32 id = event.GUIEvent.Caller->getID(); switch(id) { case ID_BUTTON_OK: { if(str.size() > 0) { //sprintf_s(query,512,"UPDATE profile SET name=(%s)",str.c_str()); printf("%S \n",str.c_str()); m_pInput->remove(); } break; //return true; } case ID_BUTTON_CANCEL: m_pInput->remove(); break; //return false; } //return false; }What to do to open the window on second visit also?