I have two window frame in the App (as public members): the frame1 and the frame2
I show the frame1 in App::OnInit and get some values;(I passed the this pointer to both frame so they can access to the other member of App)
then I use a button event handler(a member function of frame1) to pass those values to the members of frame2
and then I set the frame2 as top window and destroy the frame1
The frame2 did show up but it is totally frozen and can't even move.
Actually, I want to use this two frame window in turn in one process
How, do I get to do that???
Why the window is frozen ??
Why the window is frozen ??
Coding is not funny.
It is nothing but a pain.
While people like me still get obessed to it.
It is nothing but a pain.
While people like me still get obessed to it.
Re: Why the window is frozen ??
Can you share some code? It's hard to tell from just a text description.
"Keyboard not detected. Press F1 to continue"
-- Windows
-- Windows
Re: Why the window is frozen ??
Here are all the source:
#include "main.h"
// initialize the application
IMPLEMENT_APP(MainApp);
////////////////////////////////////////////////////////////////////////////////
// application class implementation
////////////////////////////////////////////////////////////////////////////////
bool MainApp::OnInit()
{
// this->step=false;
Win2=new SubFrame(NULL,this);
Win1=new MainFrame( NULL,this);
SetTopWindow(Win1);
GetTopWindow()->Show();
// true = enter the main loop
return true;
}
////////////////////////////////////////////////////////////////////////////////
// main application frame implementation
////////////////////////////////////////////////////////////////////////////////
MainFrame::MainFrame(wxWindow *parent, MainApp *App): MyFrame1( parent ),App(App)
{
}
MainFrame::~MainFrame()
{
}
void MainFrame::OnCloseFrame(wxCloseEvent& event)
{
Destroy();
}
void MainFrame::OnExitClick(wxCommandEvent& event)
{
Destroy();
}
void MainFrame::Finish(wxCommandEvent& event)
{
long *val1=new long;
double *val2=new double;
(m_comboBox1->GetValue()).ToLong(val1);
(m_comboBox2->GetValue()).ToDouble(val2);
App->Win2->Size_Set(int(*val1));
App->Win2->Tolerance_Set(double(*val2));
App->SetTopWindow(App->Win2);
App->GetTopWindow()->Show();
delete val1;
delete val2;
Destroy();
}
SubFrame::SubFrame(wxWindow *parent,MainApp *App) : MyFrame2( parent ),App(App)
{
}
SubFrame::~SubFrame()
{
}
void SubFrame::OnCloseFrame(wxCloseEvent& event)
{
Destroy();
}
void SubFrame::OnExitClick(wxCommandEvent& event)
{
Destroy();
}
Here are the main.cpp:#include "main.h"
// initialize the application
IMPLEMENT_APP(MainApp);
////////////////////////////////////////////////////////////////////////////////
// application class implementation
////////////////////////////////////////////////////////////////////////////////
bool MainApp::OnInit()
{
// this->step=false;
Win2=new SubFrame(NULL,this);
Win1=new MainFrame( NULL,this);
SetTopWindow(Win1);
GetTopWindow()->Show();
// true = enter the main loop
return true;
}
////////////////////////////////////////////////////////////////////////////////
// main application frame implementation
////////////////////////////////////////////////////////////////////////////////
MainFrame::MainFrame(wxWindow *parent, MainApp *App): MyFrame1( parent ),App(App)
{
}
MainFrame::~MainFrame()
{
}
void MainFrame::OnCloseFrame(wxCloseEvent& event)
{
Destroy();
}
void MainFrame::OnExitClick(wxCommandEvent& event)
{
Destroy();
}
void MainFrame::Finish(wxCommandEvent& event)
{
long *val1=new long;
double *val2=new double;
(m_comboBox1->GetValue()).ToLong(val1);
(m_comboBox2->GetValue()).ToDouble(val2);
App->Win2->Size_Set(int(*val1));
App->Win2->Tolerance_Set(double(*val2));
App->SetTopWindow(App->Win2);
App->GetTopWindow()->Show();
delete val1;
delete val2;
Destroy();
}
SubFrame::SubFrame(wxWindow *parent,MainApp *App) : MyFrame2( parent ),App(App)
{
}
SubFrame::~SubFrame()
{
}
void SubFrame::OnCloseFrame(wxCloseEvent& event)
{
Destroy();
}
void SubFrame::OnExitClick(wxCommandEvent& event)
{
Destroy();
}
Coding is not funny.
It is nothing but a pain.
While people like me still get obessed to it.
It is nothing but a pain.
While people like me still get obessed to it.
Re: Why the window is frozen ??
On what OS are you? I just tried on wxOSX 2.9.2 and everything seems to work fine
"Keyboard not detected. Press F1 to continue"
-- Windows
-- Windows
Re: Why the window is frozen ??
OS ?
Under win7
So it is an actual operating system ,I mean the wxOSX 2.9.2 ???
Under win7
So it is an actual operating system ,I mean the wxOSX 2.9.2 ???
Coding is not funny.
It is nothing but a pain.
While people like me still get obessed to it.
It is nothing but a pain.
While people like me still get obessed to it.
Re: Why the window is frozen ??
Well, you need to press the button on the first frame and then the second frame that pops up will be a frozen one, when you try to move it the noise of error comes out. And That' my problem.
Coding is not funny.
It is nothing but a pain.
While people like me still get obessed to it.
It is nothing but a pain.
While people like me still get obessed to it.