flatnotebook

BlitzMax Modules Forums/Brucey's Modules/flatnotebook

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

OK, so I just tried it below and am getting a number readout too. If you type something in each page and switch back and forth, you will see the second method works:

wxTextCtrl(GetCurrentPage()).GetValue()

SuperStrict

Framework wx.wxApp
Import wx.wxFrame
Import wx.wxFlatNotebook
Import wx.wxTextCtrl

New MyApp.run()

Type MyApp Extends wxApp

	Field Window:wxFrame
	Field NoteBook:TFlatNoteBook
	
	Method OnInit:Int()
	
		Window = New wxFrame.Create( Null,TId.GetNextId(),"FlatNoteBook",0,0,500,500)
		Window.Centre()	
		NoteBook = New TFlatNoteBook.CreateGadget(Window,5,5,490,490)
		Window.Show()				
		Window.Refresh()
					
		Return True
	
	End Method

End Type

Type TFlatNoteBook Extends wxFlatNotebook

	Field Id:Int
	Global s_Page:String[] = ["Page One","Page Two","Page Three"]
		
	Method CreateGadget:TFlatNoteBook(_parent:wxWindow,_x:Int,_y:Int,_w:Int,_h:Int)
	
		Id = TId.GetNextId()
		CreateFNB(_parent,Id,_x,_y,_w,_h)
		Return Self
	
	End Method
	
	Method OnInit()
				
		
		
		For Local s_title:String = EachIn s_Page
			AddPage(New wxTextCtrl.Create(Self,TId.GetNextId(),Null,0,0,490,490),s_title)
		Next
	
		Connect(Id, wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CHANGED, _OnPageChanged)
	
	End Method
	
	Method OnPageChanged(_event:wxFlatNotebookEvent)
		DebugLog GetPageText(_event.GetSelection())
		DebugLog _event.GetSelection() +" page label " +s_Page[_event.GetSelection()]
		DebugLog wxTextCtrl(GetCurrentPage()).GetValue()
	End Method
	
	Function _OnPageChanged(_event:wxEvent)
		TFlatNoteBook(_event.parent).OnPageChanged(wxFlatNotebookEvent(_event))
	End Function

End Type

Type TId 		
	
	Global CurrentId:Int = wxID_HIGHEST

	Function GetCurrentId:Int()
		Return CurrentId
	End Function

	Function GetNextId:Int()
		CurrentId :+ 1
		Return CurrentId
	End Function
		
End Type