how can I open a Frame from another Frame ?
how can I open a Frame from another Frame ?
Hello !
as you know i'm a new user and developper .I learn JAVA but actually ,I've to do a project in C++.So...
is somebody can help me to open a Frame from another Frame with a buttonclick ? like :
void prjMicrocobFrm::WxButtonFicheCliClick(wxCommandEvent& event)
{
Fcheclientfrm->Show(TRUE); (that doesn't work )
event.Skip();
}
Thank for help me .
as you know i'm a new user and developper .I learn JAVA but actually ,I've to do a project in C++.So...
is somebody can help me to open a Frame from another Frame with a buttonclick ? like :
void prjMicrocobFrm::WxButtonFicheCliClick(wxCommandEvent& event)
{
Fcheclientfrm->Show(TRUE); (that doesn't work )
event.Skip();
}
Thank for help me .
I try to do my best !
I just tried this and it seems to work.
Just to be sure: you have Fcheclientfrm defined, right?
In my case, I tried added a button to the default frame with this code:
So a new main window is created every time the button is pressed.
NOTE: The event.Skip() is not needed and probably should be removed.
-Tony
Just to be sure: you have Fcheclientfrm defined, right?
In my case, I tried added a button to the default frame with this code:
Code: Select all
/*
* WxButton1Click
*/
void Project1Frm::WxButton1Click(wxCommandEvent& event)
{
Project1Frm *Fcheclientfrm = new Project1Frm(NULL);
Fcheclientfrm->Show(TRUE);
// insert your code here
event.Skip();
}
NOTE: The event.Skip() is not needed and probably should be removed.
-Tony
I did
void prjMicrocobFrm::WxButtonFicheCliClick(wxCommandEvent& event)
{
prjMicrocobFrm *Fcheclientfrm = new prjMicrocobFrm(Null);
Fcheclientfrm->show(true);
//event.Skip();
}
the compiler said :
In member function `void prjMicrocobFrm::WxButtonFicheCliClick(wxCommandEvent&)':
404 C:\PAE\projet Microcoob\prjMicrocobFrm.cpp `Null' undeclared (first use this function)
405 C:\PAE\projet Microcoob\prjMicrocobFrm.cpp 'class prjMicrocobFrm' has no member named 'show'
I try the showmodal too ,but the problem is before
so ...
void prjMicrocobFrm::WxButtonFicheCliClick(wxCommandEvent& event)
{
prjMicrocobFrm *Fcheclientfrm = new prjMicrocobFrm(Null);
Fcheclientfrm->show(true);
//event.Skip();
}
the compiler said :
In member function `void prjMicrocobFrm::WxButtonFicheCliClick(wxCommandEvent&)':
404 C:\PAE\projet Microcoob\prjMicrocobFrm.cpp `Null' undeclared (first use this function)
405 C:\PAE\projet Microcoob\prjMicrocobFrm.cpp 'class prjMicrocobFrm' has no member named 'show'
I try the showmodal too ,but the problem is before
so ...
I try to do my best !
C++ is case sensitive. You must write 'NULL' instead of 'Null' or you can simply write 0 (zero).deuch wrote:I did
void prjMicrocobFrm::WxButtonFicheCliClick(wxCommandEvent& event)
{
prjMicrocobFrm *Fcheclientfrm = new prjMicrocobFrm(Null);
Fcheclientfrm->show(true);
//event.Skip();
}
the compiler said :
In member function `void prjMicrocobFrm::WxButtonFicheCliClick(wxCommandEvent&)':
404 C:\PAE\projet Microcoob\prjMicrocobFrm.cpp `Null' undeclared (first use this function)
405 C:\PAE\projet Microcoob\prjMicrocobFrm.cpp 'class prjMicrocobFrm' has no member named 'show'
I try the showmodal too ,but the problem is before
so ...
And, the method name is 'Show' (not 'show') so you must change it as well.
Good luck.
Platform: MSW (Windows XP Pro)
Compiler: msvc 13.10.3077 (Free Toolkit)
wxWidgets: v2.6.0
Compiler: msvc 13.10.3077 (Free Toolkit)
wxWidgets: v2.6.0
-
- Earned some good credits
- Posts: 124
- Joined: Wed Mar 16, 2005 5:44 pm
- Location: Guadeloupe, French West Indies
- Contact:
It seems that ShowModal does not work. I looked my code, and it is Show(TRUE) which is written...
If you want to open a new frame and don't want to open the same frame again, you have to change
prjMicrocobFrm *Fcheclientfrm = new prjMicrocobFrm(NULL);
by
NameOfNewFrame *Fcheclientfrm = new NameOfNewFrame (NULL)
If you want to open a new frame and don't want to open the same frame again, you have to change
prjMicrocobFrm *Fcheclientfrm = new prjMicrocobFrm(NULL);
by
NameOfNewFrame *Fcheclientfrm = new NameOfNewFrame (NULL)
first ,thanks to you help !
so
I try :
.......Fcheclientfrm(NULL); and (Null) ; but the answer was the same :
Null (or NULL) undeclared .
I retry with Fcheclientfrm(0) ;(zero) as you tald me and it was ok for compilation ..... BUT
it doesn't work when I click the button (GRRRRR !)
or exactly ,I think it re-open the same frame
maybe you know why ?
I'll move my little brain tonight .
so
I try :
.......Fcheclientfrm(NULL); and (Null) ; but the answer was the same :
Null (or NULL) undeclared .
I retry with Fcheclientfrm(0) ;(zero) as you tald me and it was ok for compilation ..... BUT
it doesn't work when I click the button (GRRRRR !)
or exactly ,I think it re-open the same frame
maybe you know why ?
I'll move my little brain tonight .
I try to do my best !
Right. I think what's happening is that when you hit the button you are opening a new window that is exactly the same as the old one. This is because your command is:or exactly ,I think it re-open the same frame
Code: Select all
prjMicrocobFrm *Fcheclientfrm = new prjMicrocobFrm(Null);
If you want to have a different window frame appear when you click the button, then you'll have to declare a different window frame class. For example, go to New->New wxFrame. You see a new window frame be generated. You can modify that frame any way you like it (add controls, colors, etc). Then in your code:
Code: Select all
/*
* WxButton1Click
*/
void Project1Frm::WxButton1Click(wxCommandEvent& event)
{
Untitiled1Frm *Fcheclientfrm = new Untitled1Frm(NULL);
Fcheclientfrm->Show(TRUE);
// insert your code here
event.Skip();
}
-Tony
Hi everybody! Me again !
so
it's going better now :my mistake was between the of the class and the frame.wxform ,a confusion .
and I did something : I write an "Include" card ,with the name MySecondFram.h in the "MyFirstFrame.cpp" file ,and finally that work .BUT... there's always a 'BUT' ,when I click it open two or three frames ,and now I know why ,it's ok ?!? I made a third frame witch open with a bitmapButton and i have the same problem :two frame appears .
If someone know why ? and maybe you if I can get informations from a MySql database to wxTextCtrl.
Thanks
so
it's going better now :my mistake was between the of the class and the frame.wxform ,a confusion .
and I did something : I write an "Include" card ,with the name MySecondFram.h in the "MyFirstFrame.cpp" file ,and finally that work .BUT... there's always a 'BUT' ,when I click it open two or three frames ,and now I know why ,it's ok ?!? I made a third frame witch open with a bitmapButton and i have the same problem :two frame appears .
If someone know why ? and maybe you if I can get informations from a MySql database to wxTextCtrl.
Thanks
I try to do my best !
-
- Earned some good credits
- Posts: 124
- Joined: Wed Mar 16, 2005 5:44 pm
- Location: Guadeloupe, French West Indies
- Contact:
You should post this again because I don't really understand what you mean. There seem to be missing words in your post. Plus you say that you now know why it opens 2 or 3 frames, so if you know why (I didn't understand why by the way) how can't you solve the problem? Try posting with a safe language if you want us to help you
I have this same problem
I have two identical function - one is executed when user click button in menuBar and second when user click normal button on panel. Its weird - when user click button in menu it shows dialog and disapear when I click Close button but when I click normal button and click close button dialog disapear and shows again. From where is that diffrent?
I resolv my problem like this:
Code: Select all
void klient::WxButton6Click(wxCommandEvent& event)
{
static int zn=0;
if(zn==0)
{
Kal *kal = new Kal(NULL);
kal->ShowModal();
//some instructions
delete kal;
zn++;
}
else
zn--;
event.Skip();
}
I'm sorry ,I forgot some words and my english is bad .
I'll try to explain :
the problem is when I click the button to call my second frame ,two appears .so I tried to understand ,i read the code , I cleaned some comments etc... bur I didn't change anything .I retried and then all was ok , only one frame appear .Well . so I made another event from a bitmatButton and I had the same problem : When I click it ,two frame appear (a third frame ).
I said before , that I wrote in "myFirstFram.cpp" file ,where there is all Buttons and bitmapbuttons declaration and event ,an "#include MysecondFrame.h" instruction ,and for "mythirdFrame" too .And it work .
so ,I hope you 'll understand ,sorry for my bad english (if you speak french....).
Do you know why two frme appear ?
I'll try to explain :
the problem is when I click the button to call my second frame ,two appears .so I tried to understand ,i read the code , I cleaned some comments etc... bur I didn't change anything .I retried and then all was ok , only one frame appear .Well . so I made another event from a bitmatButton and I had the same problem : When I click it ,two frame appear (a third frame ).
I said before , that I wrote in "myFirstFram.cpp" file ,where there is all Buttons and bitmapbuttons declaration and event ,an "#include MysecondFrame.h" instruction ,and for "mythirdFrame" too .And it work .
so ,I hope you 'll understand ,sorry for my bad english (if you speak french....).
Do you know why two frme appear ?
I try to do my best !