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...

Using event handlers - (obsolete version)

Post by srod »

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.
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.
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 would argue is ready to be used
er... battening down for an onslaught? :lol:
BERESHEIT
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

:D

I didn't say it would work, only that it could be used!

**Edit: actually I think that I did say that it would work!

Oh well, I can run fast...
I may look like a mule, but I'm not a complete ass.
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

Running is healthy :) I love this product already. It is definately nice to have event bindings :) I think a very old screenshot of VD showed something similar, maybe an integration would be wonderful :)
techjunkie
Addict
Addict
Posts: 1126
Joined: Wed Oct 15, 2003 12:40 am
Location: Sweden
Contact:

Post by techjunkie »

Shannara wrote:I think a very old screenshot of VD showed something similar, maybe an integration would be wonderful :)
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! :D
Image
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

Impressive stuff! :D
--Kale

Image
User avatar
utopiomania
Addict
Addict
Posts: 1655
Joined: Tue May 10, 2005 10:00 pm
Location: Norway

Post by utopiomania »

Veeery impressing indeed :) Thanks!
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.
I may look like a mule, but I'm not a complete ass.
Straker
Enthusiast
Enthusiast
Posts: 701
Joined: Wed Apr 13, 2005 10:45 pm
Location: Idaho, USA

Post by Straker »

techjunkie wrote: 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! :D
What is it with you and pizzas? Is that all you eat? We already know what your drink... :wink:
Image Image
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

Hi srod.

This is stunning - perhaps a turning point for many coders!

Thank you very much!
@}--`--,-- A rose by any other name ..
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Thanks Dare2. Glad you like it.
I may look like a mule, but I'm not a complete ass.
ebs
Enthusiast
Enthusiast
Posts: 557
Joined: Fri Apr 25, 2003 11:08 pm

Post by ebs »

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
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

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).

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
Regards.
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 - 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:
  • #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
That's it. I think that's all the events I need to cover at this stage.

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! :D

Thanks to all those who have tested this code.
I may look like a mule, but I'm not a complete ass.
ebs
Enthusiast
Enthusiast
Posts: 557
Joined: Fri Apr 25, 2003 11:08 pm

Post by ebs »

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
Post Reply