monkey2 icon indicating copy to clipboard operation
monkey2 copied to clipboard

error C2352: illegal call of non-static member function

Open engor opened this issue 8 years ago • 1 comments

I tried to show confirm "Really close app?" right inside of OnWindowEvent and got compile-time error.

C:/proj/monkey2/monkey2fork/tmp/untitled1.buildv1.1.08/windows_release_msvc/src/untitled1_untitled1.cpp(42): error C2352: 't_mojo_app_Window::m_OnWindowEvent': illegal call of non-static member function
C:/proj/monkey2/monkey2fork/modules/mojo/mojo.buildv1.1.08/windows_release_msvc/include/mojo_app_2window.h(105): note: see declaration of 't_mojo_app_Window::m_OnWindowEvent'

I can live with that - by directly call to App.Terminate().

Look at demo app:

Namespace myapp

#Import "<std>"
#Import "<mojo>"
#Import "<mojox>"

Using std..
Using mojo..
Using mojox..

Class MyWindow Extends Window

	Method New( title:String="Simple mojo app",width:Int=640,height:Int=480,flags:WindowFlags=Null )

		Super.New( title,width,height,flags )
	End

	Method OnWindowEvent( event:WindowEvent ) Override
		
		If event.Type=EventType.WindowClose
			New Fiber( Lambda()
				Local ok:=RequestOkay( "Really close app?" )
				If Not ok Return
				' comment me to work:
				Super.OnWindowEvent( event )
				' uncomment me to work
				'App.Terminate()
			End )
		Else
			Super.OnWindowEvent( event )
		Endif
	End
	
End

Function Main()

	New AppInstance
	
	New MyWindow
	
	App.Run()
End

engor avatar Dec 11 '17 04:12 engor

It seems to work properly. This issue can be closed

seyhajin avatar Jun 04 '19 11:06 seyhajin