Page 1 of 1

How to address a function from a different namespace ?

Posted: Fri Apr 20, 2018 3:00 pm
by es_91
Hi.

The typical way to address a function in BindEvent () context is to write @functionname ().

Shall a function from a different namespace, say a module, be addressed, this does not work.
The syntax @module::functionname () is simply not valid.

Likewise writing module::functionname () won't return a valid pointer to that function.

What can i do ?

Re: How to address a function from a different namespace ?

Posted: Fri Apr 20, 2018 3:28 pm
by es_91

Code: Select all

DeclareModule first
	
	Declare function ()
	
EndDeclareModule

DeclareModule second
	
	Declare init ()
	
EndDeclareModule

second::init ()

Module first
	
	Procedure function ()
		
		debug 1
		
	EndProcedure
	
EndModule

Module second
	
	Procedure init ()
		
		bg = OpenWindow (#PB_Any, 0, 0, 0, 0, "", #PB_Window_Background)
		
		BindEvent (#PB_Event_SizeWindow, first::function (), bg) ; TODO: doesn't work !!!
		
	EndProcedure
	
EndModule

Re: How to address a function from a different namespace ?

Posted: Fri Apr 20, 2018 3:49 pm
by Peter
Hello es_91,

put the '@' - sign in front of the functionname:

Code: Select all

BindEvent (#PB_Event_SizeWindow, first::@function(), bg)
Greetings ... Peter

Re: How to address a function from a different namespace ?

Posted: Sat Apr 21, 2018 7:23 am
by es_91
oh dear!

Thank you so much. 8-)