I'm new to C++ and RAD tools (wxSmith within CodeBlocks)
So far it's working and fun BUT today is scratchingHead day...
I have a main window that call another window.
On event (a double click)
do your stuff and catch another event in the main window
which is OnTreeCtrl1ItemActivated(wxTreeEvent& event)
a treectrl widget...
But when the second window occur, I cannot access
variables from the first part (wxString test1 or test2)
The reason is not public?, Global?
code following :
Code: Select all
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 activates 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(); // I would like to SetLabel to variable in the
// first module/event like : test1, the name of the user
mynewwindow->TextCtrl1->ChangeValue("thetest\nsetvalue\n");
mynewwindow->Show(TRUE);
}
wtach the video on youtube and you'll get the picture
https://www.youtube.com/watch?v=VOOc8vxaZeU
thanks and regards
Steph