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 »

Konne wrote:Uhh, works with Vista.
Anyways srod can you help me with this question?
http://www.purebasic.fr/english/viewtop ... 24cd240e5d
Done. I have replied to the post with an example. :)
Last edited by srod on Thu Feb 08, 2007 3:50 pm, edited 1 time in total.
I may look like a mule, but I'm not a complete ass.
Konne
Enthusiast
Enthusiast
Posts: 434
Joined: Thu May 12, 2005 9:15 pm

Post by Konne »

thx
Apart from that Mrs Lincoln, how was the show?
Niffo
Enthusiast
Enthusiast
Posts: 504
Joined: Tue Jan 31, 2006 9:43 am
Location: France

Post by Niffo »

What about a Linux version ? :))
Niffo
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Niffo wrote:What about a Linux version ? :))
Great idea. As soon as you finish it, then please let me know!

:)
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 »

Bug fix. 01/07/07.

More of an omission than a bug (with panel gadgets) but it has been fixed.

:)
I may look like a mule, but I'm not a complete ass.
Niffo
Enthusiast
Enthusiast
Posts: 504
Joined: Tue Jan 31, 2006 9:43 am
Location: France

Post by Niffo »

When trying to download :
"The page cannot be found" :(
Niffo
User avatar
Sveinung
Enthusiast
Enthusiast
Posts: 142
Joined: Tue Oct 07, 2003 11:03 am
Location: Bergen, Norway

Post by Sveinung »

I get the same as Niffo

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

Post by srod »

Sorry! :oops: Uploaded the wrong file!
I may look like a mule, but I'm not a complete ass.
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Post by GeoTrail »

Hey Sveinung, are you who I think you are? :)
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Update - 6th August 2007. EasyVENT 2.0

This sees the removal of the 'in-house' drag and drop code for far simpler and more powerful handlers which utilise PB's new OLE drag and drop library (my thanks to Freak for this). This means that you can use EasyVENT to now drag and drop between applications and drag more than just text etc.

Although the drag/drop handlers are little more than a wrapper around the PB drag/drop library, EasyVENT does make dragging from ANY gadget/window very easy; easier than would otherwise be the case. This is because EasyVENT's #OnDragItemStart handlers can be attached to any gadget/window as opposed to PB's #PB_EventType_DragStart event type which fires for just a few types of gadget etc.

There are two demos in the EasyVENT 2.0 package which show just how much easier this is now than was the case with EasyVENT 1.0. In fact you can run both demos simultaneously and drag from one to the other quite merrily!

Note that if a drag image is required then you need to set a drag callback in your #OnDragItemStart handler.

Please see the first post for the downloads.
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: 14th September 2007. Version 2.01.
This is a minor update.

Have extended the scope of the event #OnItemSelected. Basically this event can be used with various gadget types, but now with ListIcons it will fire under the following circumstances :

i) an item has been selected, ii) an item has been deselected, iii) a checkbox (for those ListIcons with checkboxes in the 1st column) has been cleared, iv) a checkbox (for those ListIcons with checkboxes in the 1st column) has been checked.

iii) and iv) represent the extension of this event.

Please see the help manual and/or the ListIcon demo program for more details.

(Before anyone asks; a similar Event regarding checkboxes in TreeGadgets is not supported under Windows prior to Vista and so I have not included it in this version of EasyVENT. Still, it is not difficult to hack up some code to determine whether the user clicked a checkbox in a TreeGadget etc.)

Please see the first post for the revised download.
I may look like a mule, but I'm not a complete ass.
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

I think there may be a bug with EasyVents drag and drop code

Post by DoubleDutch »

I think there may be a bug with EasyVents drag and drop code. Here is the section with the possible bug (Event Dispatcher):

Code: Select all

   Case #PB_Event_GadgetDrop, #PB_Event_WindowDrop
;Now call default procedure.
      text$="EVENT_oldproc"
      result2 = GetProp_(hwnd, @text$)
      If result2 
        result= CallWindowProc_(GetProp_(hwnd, @text$), hWnd, uMsg, wParam, lParam) 
      EndIf

      If result
	      result = CallWindowProc_(result, hWnd, uMsg, wParam, lParam)
	    Else
	    	Debug("Zero returned!!!  On WindowsMe => crash!")
	    EndIf
	    
      If uMsg = #PB_Event_WindowDrop
        sender\hWnd = WindowID(wParam)
      Else
        sender\hWnd = GadgetID(wParam)
      EndIf
      pt\x = DesktopMouseX() : pt\y = DesktopMouseY()
      MapWindowPoints_(0, sender\hWnd, pt, 1)
      sender\mousex = pt\x
      sender\mousey = pt\y
      sender\button = #Event_LeftButton
      sender\message = #OnDropItem
      sender\item = EVENT_globals\gDragFrom
      EventCallHandler(@sender,result, @mesent) 
      ProcedureReturn result
I've marked what happens with a comment. The value for result seems to be zero all the time for a drag/drop? Have I initialised something incorrectly?

The zero does not crash XP or Vista, but does crash machines <NT.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Code: Select all

If result 
         result = CallWindowProc_(result, hWnd, uMsg, wParam, lParam) 
       Else 
          Debug("Zero returned!!!  On WindowsMe => crash!") 
       EndIf 
Where that code has come from is beyond me and the only surprising thing is that EasyVENT does not crash on all systems!

Simply remove those lines and it should work. I'm uploading a new version now.

Thanks.
I may look like a mule, but I'm not a complete ass.
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

Do you mean the actual check for zero?

I put in the check for zero, if there is no check then it will crash on <NT.

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

Post by srod »

No and yes!

Some of that code I cannot even find in my version of EasyVENT!

Remove all of:

Code: Select all

If result 
  result = CallWindowProc_(result, hWnd, uMsg, wParam, lParam) 
Else 
   Debug("Zero returned!!!  On WindowsMe => crash!") 
EndIf 
It has no place in the library.
I may look like a mule, but I'm not a complete ass.
Post Reply