Why the window is frozen ??

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
SamHu
Earned a small fee
Earned a small fee
Posts: 20
Joined: Tue Sep 20, 2011 7:52 am

Why the window is frozen ??

Post by SamHu »

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???
:?: :?: :?:
Coding is not funny.
It is nothing but a pain.
While people like me still get obessed to it.
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Re: Why the window is frozen ??

Post by Auria »

Can you share some code? It's hard to tell from just a text description.
"Keyboard not detected. Press F1 to continue"
-- Windows
SamHu
Earned a small fee
Earned a small fee
Posts: 20
Joined: Tue Sep 20, 2011 7:52 am

Re: Why the window is frozen ??

Post by SamHu »

Here are all the source:
gui.h
(2.18 KiB) Downloaded 124 times
gui.cpp
(4.86 KiB) Downloaded 118 times
main.h
(2.21 KiB) Downloaded 127 times
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.
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Re: Why the window is frozen ??

Post by Auria »

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
SamHu
Earned a small fee
Earned a small fee
Posts: 20
Joined: Tue Sep 20, 2011 7:52 am

Re: Why the window is frozen ??

Post by SamHu »

OS ?
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.
SamHu
Earned a small fee
Earned a small fee
Posts: 20
Joined: Tue Sep 20, 2011 7:52 am

Re: Why the window is frozen ??

Post by SamHu »

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.
Post Reply