Unable to show a hidden form in Visual C++ -
hey guys hoping shed insight why i'm unable toggle between showing , hiding form.
quizmenu.h i've been working on simple quiz game application proceeds through series of questions in form, of well, forms! there main menu user can exit application:
private: system::void exit_click(system::object^ sender, system::eventargs^ e) { //exits application quizmenu::close(); }
or proceed first question hide main menu , open question1 form:
private: system::void enter_click(system::object^ sender, system::eventargs^ e) { question1 ^question1 = gcnew question1(); question1->show(); this->hide(); }
question1.h question1 prompts user answer question choosing between 2 possible answers through buttons.
correct.h correct answer hides current form , opens indicates answer correct:
private: system::void answer1_click(system::object^ sender, system::eventargs^ e) { correct ^correct = gcnew correct(); correct->show(); this->hide(); }
the second same except opens form indicates user incorrect:
private: system::void answer2_click(system::object^ sender, system::eventargs^ e) { incorrect ^incorrect = gcnew incorrect(); incorrect->show(); this->hide(); }
both forms allow user proceed next question clicking button hides correct/incorrect forms.
question2.h i'm having difficulty. question2 form unable reopen correct/incorrect forms question1 did. unable access main menu. when trying reopen correct.h form error 'question2': undeclared identifier. suspect has fact i've hidden these forms, or #includes either in wrong order or incorrect.
my question2.h form looks sans design code because it's quite lengthy:
#pragma once #include "correct.h" namespace quizgame { using namespace system; using namespace system::componentmodel; using namespace system::collections; using namespace system::windows::forms; using namespace system::data; using namespace system::drawing; /// <summary> /// summary question2 /// </summary> public ref class question2 : public system::windows::forms::form { public: question2(void) { initializecomponent(); // //todo: add constructor code here // } protected: /// <summary> /// clean resources being used. /// </summary> ~question2() { if (components) { delete components; } } private: system::windows::forms::label^ label1; private: system::windows::forms::button^ answer1correct; private: system::windows::forms::button^ answer2incorrect; private: system::windows::forms::button^ answer3incorrect; private: system::windows::forms::button^ answer4incorrect; private: system::windows::forms::picturebox^ picturebox1; protected: private: /// <summary> /// required designer variable. /// </summary> system::componentmodel::container ^components; #pragma endregion private: system::void answer3incorrect_click(system::object^ sender, system::eventargs^ e) { } private: system::void answer2incorrect_click(system::object^ sender, system::eventargs^ e) { } private: system::void answer1correct_click(system::object^ sender, system::eventargs^ e) { correct ^correct = gcnew correct(); correct->show(); this->hide(); } private: system::void answer4incorrect_click(system::object^ sender, system::eventargs^ e) { } }; }
my apologies if difficult read, first submission. i'm happy post more code if isn't enough (in interest of clarity tried keep minimum).
Comments
Post a Comment