Define An Event From a Class

Post your Gambas programming questions here.
Post Reply
User avatar
Technopeasant
Posts: 140
Joined: Saturday 13th July 2019 6:50pm
Location: Stony Plain, Alberta, Canada
Contact:

Define An Event From a Class

Post by Technopeasant »

I have a class file that inherits from picture box, and what I want to do is put code in the class file to account for the raising of the mouse down event.

http://gambaswiki.org/wiki/comp/gb.qt4/ ... .mousedown

I can do it from the form, but this is overly complicated for more than one instance. What I am wondering is if there is a way to define code for this event in the class file.

Here is pseudo code to show what I am looking for:

Code: Select all

Public Sub _MouseDown()

Me.Tag = "Clicked!"

End
Is this possible?
Technical director,
Piga Software
http://icculus.org/piga/
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Define An Event From a Class

Post by cogier »

Have a look at the attached code. Let me know if this is what you wanted.
Task_Test_Working.tar.gz
(34.56 KiB) Downloaded 330 times
User avatar
Technopeasant
Posts: 140
Joined: Saturday 13th July 2019 6:50pm
Location: Stony Plain, Alberta, Canada
Contact:

Re: Define An Event From a Class

Post by Technopeasant »

Not exactly what I was looking for, but interestingly almost exactly what I came up with upon further research.

Great minds thing alike.

:ugeek:

Your use of LAST is better than my solution though, which was to check which ones were triggering .Hovered, so thanks for that.
Technical director,
Piga Software
http://icculus.org/piga/
Post Reply