[Gambas-user] SUb Routines with a return value

Matti math.eber at ...221...
Fri Nov 19 20:29:32 CET 2010


I don't understand exactly what you want to do, and why you have
"mnuPopup.Popup()" inside the event handler sub Action_Activate. And why
"mnuPopup.Popup()" anyway?

Popup menus are easily made like

PUBLIC SUB Form_MouseDown()	'or something else MouseDown()
  IF Mouse.Right THEN mnuTest.Popup
END

now mnuTest shows,
and if some element of mnuTest is clicked, then

PUBLIC SUB mnuAction_Click()
  Message.Info("hello")
END

Generally, you have to write sub/function "AS something" only if you want to
return something to the code that called it. If you don't, "PUBLIC SUB xy()" is
enough.

Yes, and Gambas 2 and 3 can live together on the same machine.


Am 19.11.2010 13:33, schrieb Michael:
> I have been using popup menus for the first time and got the following 
> from the Gambas help.
> "PUBLIC SUB Action_Activate(key AS String) AS Boolean"
> 
> I assumed this was an error as only functions have a return value so I 
> changed it "Public Function...".
> Then on my line "mnuPopup.Popup()" it got an error "no return value".
> 
> Then I modified the line to "PUBLIC SUB..." with no "as Boolean". and 
> got the same error. However it all works perfectly when written as a SUB 
> with a return value. Is this intended?
> 
> One more question? Can Gambas 3 be installed alongside Gambas 2 on 
> Ubuntu Maverick?
> 
> Thanks
> Mike
> 
> 
> 
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
> Spend less time writing and  rewriting code and more time creating great
> experiences on the web. Be a part of the beta today
> http://p.sf.net/sfu/msIE9-sfdev2dev
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
> 




More information about the User mailing list