Pocket PC eVC++ 4.0 ModalDialog Topic is solved

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
danielch
Experienced Solver
Experienced Solver
Posts: 66
Joined: Wed Nov 30, 2005 10:09 pm
Location: Poland

Pocket PC eVC++ 4.0 ModalDialog

Post by danielch »

Hi,
I have read this info:
http://www.wxwidgets.org/manuals/2.6.3/ ... wport.html
but I still have some questions and one error.
My application based on Modal Dialog:
The main loop is:

Code: Select all

IMPLEMENT_APP(PocketPCDlgApp)

bool PocketPCDlgApp::OnInit()
{
	PocketPCDlg *myDlg = new  PocketPCDlg(NULL);
	SetTopWindow(myDlg);
	myDlg->Show(TRUE);
	//maybe there should be a modal??

	return TRUE;
}
 
int PocketPCDlgApp::OnExit()
{
	return 0;
}

And from dialog (myDlg) I show the other Modal Dialog: In code like this:

void PocketPCDlg::wxButLogInClick(wxCommandEvent& event)
{

	DlgPrzeglad k1(this);
	if ((k1.ShowModal())==wxID_OK){
	
	this->Show(true);
	};
    
}
And in result when I click OK (this standard OK which is always on Pocket PC dialog), k1 is closed but the main dialog is after some short moment also closed. How to avoid it?

My question is how to show this dialog modal and after OK come back to previous wxDialog?


Regards,
Daniel
Regards,
Daniel Chmielewski
User avatar
ABX
Can't get richer than this
Can't get richer than this
Posts: 810
Joined: Mon Sep 06, 2004 1:43 pm
Location: Poznan, Poland
Contact:

Re: Pocket PC eVC++ 4.0 ModalDialog

Post by ABX »

danielch wrote:My question is how to show this dialog modal and after OK come back to previous wxDialog?
This is clearly some sort of bug either in wxW code or your code if it doesn't work as expected. It sometimes happened to me that if there is programming error in debug build then application in emulator disappears without any message and one, who don't see programming error, could say that it just "exits". I would suggest deep debugging of this situation.

On the other hand I'm not sure this->Show(true); makers sense in your code, all in all the dialogs is already shown. Perhaps you just need bring it to top which is not what Show() is designed for AFAIK.

ABX
CVS Head, 2.8.X
wxMSW, wxWinCE, wxPalmOS, wxOS2, wxMGL, bakefile
gcc 3.2.3, bcc 5.51, dmc 8.48, ow 1.6, vc 7.1, evc 3/4, pods 1.2
cd_hodges
Earned some good credits
Earned some good credits
Posts: 145
Joined: Thu Feb 03, 2005 4:46 pm

Post by cd_hodges »

My first question is why don't you use a Frame as your top window? Thats what I did in my app and I haven't had any problems.

I can't really think of a reason why you would use a dialog as your top window especially since you're not showing it Modally.

Chris
cd_hodges
Earned some good credits
Earned some good credits
Posts: 145
Joined: Thu Feb 03, 2005 4:46 pm

Post by cd_hodges »

I noticed an error in your code here:

Code: Select all

DlgPrzeglad k1(this);
        if ((k1.ShowModal())==wxID_OK){
       
        this->Show(true);
        }; 
I'm not sure if this causing the problem but from your current dialog you're doing a ShowModal on the second dialog and then doing another Show on your the first one. You shouldn't need to do that. Your code should probably look more like:

Code: Select all

DlgPrzeglad k1(this);
       k1.ShowModal();
danielch
Experienced Solver
Experienced Solver
Posts: 66
Joined: Wed Nov 30, 2005 10:09 pm
Location: Poland

I dont know

Post by danielch »

Hi,
As you suggested I use wxFrame as my main window. And from this wxFrame I call wxDialogs (5 or 6 of them).

With one, where I have sizers, grids, and buttons I have this problem.
In the modal dialog I only call End_Modal and destroy is called within wxFrame. What is strange this code works great on Pocket pc Emulator 2003 first edtion. But the main frame is closed on Pocket PC. I checked it on two devices with WM 5.0 and with Pocket PC 2003.
In code there is addtional description

Code: Select all

void PocketPCDlg::wxButLogInClick(wxCommandEvent& event)
{

    //this code works fine under Emulator but on Device
    //   wxFrame is closed what I don't want
    pDlgPrzeglad=new DlgPrzeglad(this);
    pDlgPrzeglad->ShowModal();
   pDlgPrzeglad->Destroy();
    
	
    /* 
    //this code close my wxFrame on Emulator and on
    //Device I don't know why, this code
    //also should close only wxdialog

    DlgPrzeglad d1(this);
    if (d1.ShowModal()==wxID_OK){
	
	};
    */
	
	
	
    /* 	
     //and this code work under Emulator and Device
    //but I think that I should not write programs in this way
    //the error propably is in destructor in wxDialog
    if (!(pDlgPrzeglad==NULL)){ 
    wxMessageBox(_T("NOT NULL")); 
   	pDlgPrzeglad->ShowModal();
	}
		else {
	wxMessageBox(_T("IS NULL"));
	pDlgPrzeglad=new DlgPrzeglad(this);
      
    pDlgPrzeglad->ShowModal();

	};
	
            
    */ 

}

So what to say. Please give me some advice. I dont know what to do.
How you use wxDialog and wxFrame on Pocket PC? Please send me some you code? Maybe I am doing something wrong? My style of wxwdialog is:

Code: Select all

#define PocketPCDlg_STYLE wxCAPTION | wxSYSTEM_MENU | wxMINIMIZE_BOX | wxCLOSE_BOX
Is it OK? Please help.

Regards,
Daniel
Regards,
Daniel Chmielewski
User avatar
ABX
Can't get richer than this
Can't get richer than this
Posts: 810
Joined: Mon Sep 06, 2004 1:43 pm
Location: Poznan, Poland
Contact:

Re: I dont know

Post by ABX »

danielch wrote:My style of wxwdialog is:

Code: Select all

#define PocketPCDlg_STYLE wxCAPTION | wxSYSTEM_MENU | wxMINIMIZE_BOX | wxCLOSE_BOX
Is it OK? Please help.
I don't have time to look into your main problem but I wonder why do you are trying other style than default one: wxDEFAULT_DIALOG_STYLE ? It is already adjusted for WinCE. Just look into include/wx/dialog.h

ABX
CVS Head, 2.8.X
wxMSW, wxWinCE, wxPalmOS, wxOS2, wxMGL, bakefile
gcc 3.2.3, bcc 5.51, dmc 8.48, ow 1.6, vc 7.1, evc 3/4, pods 1.2
danielch
Experienced Solver
Experienced Solver
Posts: 66
Joined: Wed Nov 30, 2005 10:09 pm
Location: Poland

Hi I still try to find a bug...

Post by danielch »

Hi,
I still try to find a bug. I even move my wx 2.6.3 application to VS2005 (Platform Pocket PC 2003 and WM 5.0).

I don't know why but somtimes I get error like this:

assert "wxAssertFailure" failed: can't call Exit() if not running
from this line in source code,

wxCHECK_RET( IsRunning(), _T("can't call Exit() if not running") );
Usually after that error my application is destroyed.

Can you give me some tips?

This is connected with wxDialog.

Regards,
Daniel
Regards,
Daniel Chmielewski
User avatar
ABX
Can't get richer than this
Can't get richer than this
Posts: 810
Joined: Mon Sep 06, 2004 1:43 pm
Location: Poznan, Poland
Contact:

Re: Hi I still try to find a bug...

Post by ABX »

danielch wrote:Can you give me some tips?
Not sure what are debugging possibilities but the backtrace could probably help.

ABX
CVS Head, 2.8.X
wxMSW, wxWinCE, wxPalmOS, wxOS2, wxMGL, bakefile
gcc 3.2.3, bcc 5.51, dmc 8.48, ow 1.6, vc 7.1, evc 3/4, pods 1.2
Post Reply