Page 1 of 1

Callback compiles without ()

Posted: Wed Aug 23, 2017 5:21 am
by e2robot

Code: Select all

Enumeration
  #window
  #button1
 
EndEnumeration  

Procedure button_pressed()
  Debug "Pressed"
    
EndProcedure

OpenWindow(#window,10,10,200,200,"TEST")

ButtonGadget(#button1,20,20,30,20,"GO")
BindGadgetEvent(#button1,@button_pressed,#PB_EventType_LeftClick)

The above will compile but doesn't work as the callback should be @button_pressed()

This should produce a compiler error or warning

Thanks,
Phil

Re: Callback compiles without ()

Posted: Wed Aug 23, 2017 7:22 am
by Peter
not a bug. Same as http://forums.spiderbasic.com/viewtopic.php?f=11&t=1256

Greetings ... Peter

Re: Callback compiles without ()

Posted: Wed Aug 23, 2017 7:56 am
by falsam
e2robot wrote:This should produce a compiler error or warning
Yes, you're right. The PureBasic IDE displays the warnings. This is not possible with SpiderBasic.

Click the GO button and open the browser debugging console. Errors are displayed.

Re: Callback compiles without ()

Posted: Wed Aug 23, 2017 8:24 am
by Peter
@falsam: or use EnableExplicit. ;-)

(this should be mandatory)

Greetings ... Peter

Re: Callback compiles without ()

Posted: Wed Aug 23, 2017 9:11 am
by falsam
Peter wrote:@falsam: or use EnableExplicit.

(this should be mandatory)
Yes ++ I totally agree with you.