Page 1 of 1

wxMDIParentFrame ?

Posted: Fri Oct 28, 2011 11:52 am
by Javaca
Hello mans!
I am newbie. Anybody can show me an wxMDIParentFrame example code + wxMDIChildFrame example code for PureBasic? I am using PB 4.51 and wxWidget Port for PB.

Thank you.

Re: wxMDIParentFrame ?

Posted: Sat Oct 29, 2011 5:36 pm
by IdeasVacuum
...have you taken a look at the examples supplied with the package?

http://www.purebasic.fr/english/viewtopic.php?t=35923

Re: wxMDIParentFrame ?

Posted: Sat Oct 29, 2011 5:55 pm
by Javaca
The package don't have MDI examples.

Re: wxMDIParentFrame ?

Posted: Sat Oct 29, 2011 8:48 pm
by IdeasVacuum
.... if you can follow the example for a regular frame (window), then MDI should be similar, the wxWidget online notes should help? :|

Re: wxMDIParentFrame ?

Posted: Sun Oct 30, 2011 8:25 am
by Javaca
This is my example MDI code. The wxMDIChildFrame_Create did not work. Why ?

Code: Select all

XIncludeFile ( #PB_Compiler_Home + "include/inc.wx.pbi")

EnableExplicit

Global APP.i	

Procedure OnInit()
  Protected frame
  Protected mdiparent
  Protected mdichild
  
  frame = wxFrame()
  mdiparent = wxMDIParentFrame()
  mdichild = wxMDIChildFrame()
  
  wxFrame_Create(frame, 0, -1, "", wxSize(-1,-1), wxSize(640,480), #wxDEFAULT_FRAME_STYLE, "frame")		
  wxFrame_Maximize (frame, #True)
  
  ;wxMDIParentFrame_RegisterVirtual(mdiparent, wxMDIParentFrame_OnCreateClient(mdiparent))
  ;wxMDIParentFrame_OnCreateClient(mdiparent)
  
  wxMDIParentFrame_Create(frame, 0, -1, "Parent window", wxSize(-1,-1), wxSize(640,480), #wxDEFAULT_FRAME_STYLE, "frame")
	
	;wxMDIChildFrame_Activate (mdiparent)
	wxMDIChildFrame_Create(mdichild, mdiparent, -1, "Child window", wxSize(-1,-1), wxSize(100,100), #wxDEFAULT_FRAME_STYLE, "mdiparent")
	
	wxWindow_Show(frame,#True)

	ProcedureReturn wxApp_OnInit(app)
	
EndProcedure

Procedure OnExit()	
	ProcedureReturn wxApp_OnExit(app)
EndProcedure	

Procedure Main()	
	app 	= wxApp() 
	wxApp_RegisterVirtual(app,@OnInit(),@OnExit())	
	wxApp_Run(0,0)	
EndProcedure:Main()