[Gambas-user] Disable right click popup menu of textbox

T Lee Davidson t.lee.davidson at gmail.com
Thu Oct 1 18:37:33 CEST 2020


On 10/1/20 3:44 AM, Gianluigi wrote:
> We create a new class every time, why does the menu have to be different from the other properties?

Yes, we create a new clastextbox object every time. It's not the menu that needs to be different. It is the menu's *event name* 
that, apparently, needs to be unique. The event name is exposed to the parent Form which is the event handler.

How does the event handler know which component raised the event if the event name is the same for all distinct objects?

If the menu was assigned in the Form's scope, then it would know. But, the menu assignment details are 'hidden' from the Form in 
a separate class. All the Form, the event handler, knows (other than what is exposed by .Proxy) is the event name. I suspect it 
has to use an event-name lookup table to determine the associated object, and returns with the first one it finds. (I invite 
corrections.)


-- 
Lee


More information about the User mailing list