Using event handlers - (obsolete version)

Developed or developing a new product in PureBasic? Tell the world about it.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

You're welcome GeoTrail.
I may look like a mule, but I'm not a complete ass.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

**Update (22nd August 2006)**

Inspired by netmaestro's work on his MouseHover library, I gladly accepted his help to upgrade the code behind the events #OnCursorEnter and #OnCursorExit which are fired when the mouse cursor enters or exits a registered control respectively.

Needless to say, they now behave exactly as I'd have liked in the first place! No longer can you 'miss' an event by moving the mouse too fast etc. No longer will overlapping controls or overlapping windows adversely effect the firing of these events. E.g. if the cursor moves over an overlapping window then the partly obscured control will immediately fire the #OnCursorExit event - as it should do! Moving the cursor into a container gadget and then into a child of the container will now fire #OnCursorEnter twice without firing a #OnCursorExit. After all, the cursor is still within both controls. Of course every #OnCursorEnter will always be matched with an eventual #OnCursorExit etc.

Those of you using this library should download the new version (link in the first post). Nothing else has changed so no code is broken etc.

Thanks again to netmaestro.
I may look like a mule, but I'm not a complete ass.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

I've had a good look through this library and I think srod has done a brilliant job of coding here. This tool effectively simplifies the implementation of several difficult concepts, making the power of sophisticated event management instantly available to PureBasic beginner and expert alike. Hats off, srod, great work!
BERESHEIT
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

Very good work SRod :D
Will make good use of it :P
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

fsw wrote:Very good work SRod :D
Will make good use of it :P
You're welcome.

Must admit that of all the stuff I've written, this is the one I rely upon the most. Only recently have I turned to writing (or attempting to!) commercial software and I'm relying quite heavily on EasyVENT. It just means that I have one less thing to worry about and can concentrate upon the gui and the main program logic etc.

@netmeastro: thanks for the kind words. (How much do I owe you for that? :) )
I may look like a mule, but I'm not a complete ass.
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

Every time I move a window I get a invalid memory access error :cry:
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Can you post the code and which version of Windows are you using?
I may look like a mule, but I'm not a complete ass.
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

Tested with "General demo.pb" and "Editorgadget demo.pb" on WinXP Pro SP2.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

No problems here on xp home.

Which line is throwing the error - could you give me the line number and past the code please?

Use PM if you don't mind so we don't clutter up the forum. :)
I may look like a mule, but I'm not a complete ass.
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

Sent a PM
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Because of fsw's bug report above, I've had to rewrite the #OnCursorEnter and #OnCursorExit code.

The problem is thread based and, for the life of me, I can't figure out a) what's causing it exactly (we know which line of code is throwing the error, but it makes no sense!) and b) why it only appears on fsw's machine?

:)

Still, taking no chances I've watered the code down a little and whilst the 2 events in question are now not quite as flexible, things are still better than earlier versions of EasyVENT.

Please accept my apologies and download again (see first post for the link).

@fsw: if your machine complains again, do me a favour - chuck it out the window! :D
Only kidding, I really appreciate your patience in helping me track down the bug, just a shame I can't fix it!
I may look like a mule, but I'm not a complete ass.
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

I get an error saying 'Line 228: structure not found:ENLINK'.

Can't get anything to run.
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

with PB4 or 3.94 ?
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

I'm using the latest pb4 on winxp home sp2
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Your PB resident file should have this structure already defined!

Weird!

Try pasting this into the top of the main library file:

Code: Select all

Structure ENLINK
  nmhdr.NMHDR
  msg.l
  wParam.l
  lParam.l
  chrg.CHARRANGE
EndStructure
**EDIT: I've uploaded a new version which will define this structure if not already present.
I may look like a mule, but I'm not a complete ass.
Post Reply