[Gambas-user] equivalent python self

Jean-Yves F. Barbier 12ukwn at ...626...
Sun Aug 16 17:16:11 CEST 2009


Doriano Blengino a écrit :
> 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,

I guess so: my purpose is to have a shortcut (some procs have very long names)
into procs they "own" (otherwise, GB wouldn't know to which object apply the command)

In my example proc is about TreeView1 object, so following what you said, 
LAST.Enable = TRUE will be applied to TreeView1 BUT will it be applied to another
object I could reference into this proc=>

i.e.:
TreeView1_MouseDown()
  TextBox2756.Text = "xxxxxxx"
  LAST.Enable = TRUE   => does it apply to TreeView1 or TextBox2756 ?
END

-- 
Most legends have their basis in facts.
		-- Kirk, "And The Children Shall Lead", stardate 5029.5




More information about the User mailing list