I'm learning C++ with wxSmith inside CodeBlocks.
I've built an app with two frames and I need to access variables in the top level window.
void test12052019Frame::OnButton1Click(wxCommandEvent& event)
{
wxString test1 = "";
wxString test2 = "";
test1 = TextCtrl1->GetValue();
test2 = TextCtrl2->GetValue();
// compare/parse userid/password
// Access ERP system and get credential schema
// build the treeview
if(test1 == "titou" && test2 == "123123"){
// todo auth. against Mysql
wxMessageBox("You're in !!\n");
TreeCtrl1->Show();
TreeCtrl1->ExpandAll();
}else
wxMessageBox("You're out !!\nWrong userid/password");
}
void test12052019Frame::OnTreeCtrl1ItemActivated(wxTreeEvent& event)
{
//TreeCtrl1 is my tree
//when I click on any option of my tree
//it activate a wxMessageBox with the label
//of the option selected...
//just let go your imagination :)
NewFrameActivities *mynewwindow = new NewFrameActivities(this);
wxString thelabel;
wxTreeItemId test3;
test3 = TreeCtrl1->GetSelection();
thelabel = TreeCtrl1->GetItemText(test3);
wxMessageBox(thelabel);
mynewwindow->SetLabel(thelabel);
//mynewwindow->StaticBox1->SetLabel(tosomething...);
//I have a textctrl in this event (textctrl1) and
//textctrl(textctrl1) in another event
mynewwindow->TextCtrl1->ChangeValue("thetest\nsetvalue\n");
mynewwindow->Show(TRUE);
}
I need to know the username from the first event (top level window, textctrl1) Visual demo