wxMax - How to implement OnIdle/RequestMore()

BlitzMax Forums/Brucey's Modules/wxMax - How to implement OnIdle/RequestMore()

kenshin(Posted 2009) [#1]
I'm looking at getting TV3D going in wxMax, so I managed to get it rendering in the window. So I'm now trying to get the window to be refreshed as many times per second as possible. I've got this code:
SuperStrict

Framework wx.wxApp
Import wx.wxFrame
Import wx.wxTimer
Import Glimmer.TV3D65

Global TV3DEngine:CTVEngine
Global TV3DInputEngine:CTVInputEngine
TV3DEngine = CTVEngine.Create()

Type MyApp Extends wxApp

	Field frame:MyFrame

	Method OnInit:Int()

		frame = MyFrame( New MyFrame.Create( , ,"Minimal wxWidgets App", 100, 100 ) )
		SetTopWindow( frame )
		frame.show()
		Return True
	
	End Method
	
End Type

Type MyFrame Extends wxFrame

	Method OnInit()
	
		Local fileMenu:wxMenu = wxMenu.CreateMenu()
		fileMenu.Append( wxID_EXIT, "&Quit~tAlt-Q", "Quit this program" )
		Local menuBar:wxMenuBar = wxMenuBar.CreateMenuBar()
		menuBar.Append( fileMenu, "&File" )
		SetMenuBar( menuBar )
		Connect( wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, OnQuit )
		Connect( wxID_ANY, wxEVT_IDLE, OnIdle)
		TV3DInputEngine = CTVInputEngine.Create()
		TV3DInputEngine.Initialize( True, True )			
		TV3DEngine.Init3DWindowed( Int( Self.GetHandle() ), False )

	End Method

	Function OnIdle( event:wxEvent )
	
		TV3DEngine.Clear()
		TV3DEngine.RenderToScreen()
		TV3DEngine.ResizeDevice()
		event.RequestMore()

	EndFunction
	
	Function OnQuit( event:wxEvent )

		wxWindow( event.parent ).Close( True )

	End Function
		
End Type

New MyApp.run()

I get an error 'Identifier RequestMore() not found'.

It works fine if I comment out the event.RequestMore() line, but only updates at the refresh rate. ie slowly.

Am I calling RequestMore() incorrectly?


Brucey(Posted 2009) [#2]
Cast to wxIdleEvent :
wxIdleEvent(event).RequestMore()


That should hopefully do the trick.


kenshin(Posted 2009) [#3]
Thanks heaps, that does work fine. It's hitting 9000fps now:o)