Using event handlers - (obsolete version)
Using event handlers - (obsolete version)
Update: 20th September 2007.
Major update.
Version 3.0.0.
Please see the new thread on EasyVENT 3 as this is totally incompatible with earlier versions.
The original version of EasyVENT is still available : HERE
whilst version 2.02 is HERE
Remainder of post removed.
Major update.
Version 3.0.0.
Please see the new thread on EasyVENT 3 as this is totally incompatible with earlier versions.
The original version of EasyVENT is still available : HERE
whilst version 2.02 is HERE
Remainder of post removed.
Last edited by srod on Thu Sep 20, 2007 12:53 am, edited 22 times in total.
I may look like a mule, but I'm not a complete ass.
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
-
- Addict
- Posts: 1126
- Joined: Wed Oct 15, 2003 12:40 am
- Location: Sweden
- Contact:
Ohhh yea! That would be the 17:th nail in the chest, the 8:th colour of the rainbow or the make the pizza complete!Shannara wrote:I think a very old screenshot of VD showed something similar, maybe an integration would be wonderful


(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
- utopiomania
- Addict
- Posts: 1655
- Joined: Tue May 10, 2005 10:00 pm
- Location: Norway
srod,
Nice work! I'm glad to see how you've been able to extend EasyVent to cover so many events.
I have a question about the TrackbarGadget #OnScroll event. The demo program correctly shows
the trackbar value when I move the trackbar "thumb" with the mouse.
If I just click on the trackbar, however, the position reported is 0.
Is this the expected behavior? Do I have to use another event to catch when the user changes the position by clicking?
Or would it be possible to extend the #OnScroll event to cover both cases?
Regards,
Eric
Nice work! I'm glad to see how you've been able to extend EasyVent to cover so many events.
I have a question about the TrackbarGadget #OnScroll event. The demo program correctly shows
the trackbar value when I move the trackbar "thumb" with the mouse.
If I just click on the trackbar, however, the position reported is 0.
Is this the expected behavior? Do I have to use another event to catch when the user changes the position by clicking?
Or would it be possible to extend the #OnScroll event to cover both cases?
Regards,
Eric
Hi ebs, it seems to be a Windows peculiarity as this is just the default value provided by Windows. It also happens with Scroll Bar controls.
I could replace the 'default' value with a call to #TBM_GETPOS_() etc. to fill the details in, but to be honest, you're better off using a GetGadgetState() command in your event handler, which undoubtedly amounts to the same thing (just look out for the #SB_ENDSCROLL value in the *sender\state field for the best results).
Regards.
I could replace the 'default' value with a call to #TBM_GETPOS_() etc. to fill the details in, but to be honest, you're better off using a GetGadgetState() command in your event handler, which undoubtedly amounts to the same thing (just look out for the #SB_ENDSCROLL value in the *sender\state field for the best results).
Code: Select all
Procedure.l Change(*sender.PB_Sender)
If *sender\state<>#SB_ENDSCROLL And *sender\state<>#SB_THUMBPOSITION
Debug GetGadgetState(0)
EndIf
ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure
I may look like a mule, but I'm not a complete ass.
Update - and bug fix!
I found that the events dealing with dragging and dropping items from ListIcons / ExplorerLists was flawed and too inflexible. I have thus removed the original events and added 3 far more flexible events.
Two example programs of dragging items from ListIcons are now included, the second of which highlights the target row as you drag the item around etc. (My thanks to 'freak' for his excellent tutorial on this.)
The new events are coloured red.
The full list of supported events runs as follows:
Have also upgraded the user guide so that it gives more details on each event.
See the first post for the download link.
Right, now to put all this work to some use!
Thanks to all those who have tested this code.
I found that the events dealing with dragging and dropping items from ListIcons / ExplorerLists was flawed and too inflexible. I have thus removed the original events and added 3 far more flexible events.
Two example programs of dragging items from ListIcons are now included, the second of which highlights the target row as you drag the item around etc. (My thanks to 'freak' for his excellent tutorial on this.)
The new events are coloured red.
The full list of supported events runs as follows:
- #OnButtonClick
- #OnChange
- #OnClose
- #OnCollapseExpandSelection
- #OnContextMenuPopup
- #OnCursorEnter
- #OnCursorExit
- #OnDragDrop
- #OnDragItemOver
- #OnDblClick
- #OnEditTreeLabels
- #OnEndDragItem
- #OnGotFocus
- #OnKeyDown
- #OnKeyPress
- #OnKeyUp
- #OnLostFocus
- #OnMaximize
- #OnMenuItemSelect
- #OnMinimize
- #OnMouseDown
- #OnMouseOver
- #OnMouseUp
- #OnMove
- #OnPaint
- #OnResize
- #OnSelectItem
- #OnScroll
- #OnStartDragItem
Have also upgraded the user guide so that it gives more details on each event.
See the first post for the download link.
Right, now to put all this work to some use!

Thanks to all those who have tested this code.
I may look like a mule, but I'm not a complete ass.
srod,
I just tried the new drag and drop demo programs and noticed something odd.
When I start dragging an item from the left ListIconGadget, my mouse cursor disappears
and I don't see the item being dragged. Since nothing is visible, I can't tell what's going on,
but when I release the mouse button the dragged item *is* dropped correctly.
I'm using the standard Windows arrow mouse cursor.
Have you (or anyone else) seen this behavior?
Regards,
Eric
I just tried the new drag and drop demo programs and noticed something odd.
When I start dragging an item from the left ListIconGadget, my mouse cursor disappears
and I don't see the item being dragged. Since nothing is visible, I can't tell what's going on,
but when I release the mouse button the dragged item *is* dropped correctly.
I'm using the standard Windows arrow mouse cursor.
Have you (or anyone else) seen this behavior?
Regards,
Eric