[Gambas-user] equivalent python self

Doriano Blengino doriano.blengino at ...1909...
Sun Aug 16 16:25:54 CEST 2009


Jean-Yves F. Barbier ha scritto:
> Hi list,
>
> Is there an equivalent to Python 'self' into GB?
>
> i.e. into a proc:
> TreeView1_MouseDown()
>    self.Enable = TRUE
> instead of
>    TreeView.Enable = TRUE
> END
>
>   
This is LAST. But beware, it is the current sender of an event, not 
'self'. There is also ME, which is the current instance of a class. From 
your example it is not clear what you mean, because it is a little 
nonsense. To clarify, take a form with a button1 on it. if you write:

    public button1_click()
      last.x += 10
    end


the button will shift to the right every time you click it. If you write

    public button1_click()
      me.x += 10
    end


the form will shift, not the button.

I think (and hope) this is what you needed. Regards,

-- 
Doriano Blengino

"Listen twice before you speak.
This is why we have two ears, but only one mouth."





More information about the User mailing list