[Gambas-user] SUb Routines with a return value

Fabien Bodard gambas.fr at ...626...
Fri Nov 19 21:04:14 CET 2010


2010/11/19 Matti <math.eber at ...221...>:
> 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?

i've don't say anything about that but generally a

public sub myMenu_Click()

end

is enouth

action is a system to manage groups of items


> 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
>>
>
> ------------------------------------------------------------------------------
> 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
>



-- 
Fabien Bodard




More information about the User mailing list