How to address a function from a different namespace ?

Just starting out? Need help? Post your questions and find answers here.
es_91
Posts: 36
Joined: Sat Aug 29, 2015 10:25 pm

How to address a function from a different namespace ?

Post 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 ?
:mrgreen:
es_91
Posts: 36
Joined: Sat Aug 29, 2015 10:25 pm

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

Post 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
:mrgreen:
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

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

Post 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
es_91
Posts: 36
Joined: Sat Aug 29, 2015 10:25 pm

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

Post by es_91 »

oh dear!

Thank you so much. 8-)
:mrgreen:
Post Reply