Done. I have replied to the post with an example.Konne wrote:Uhh, works with Vista.
Anyways srod can you help me with this question?
http://www.purebasic.fr/english/viewtop ... 24cd240e5d
Using event handlers - (obsolete version)
					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.
						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.
			
			
									
									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.
						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.
			
			
									
									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.
						- DoubleDutch
 - 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
I think there may be a bug with EasyVents drag and drop code. Here is the section with the possible bug (Event Dispatcher): 
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.
			
			
									
									
						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 resultThe zero does not crash XP or Vista, but does crash machines <NT.
Code: Select all
If result 
         result = CallWindowProc_(result, hWnd, uMsg, wParam, lParam) 
       Else 
          Debug("Zero returned!!!  On WindowsMe => crash!") 
       EndIf 
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.
						- DoubleDutch
 - Addict

 - Posts: 3220
 - Joined: Thu Aug 07, 2003 7:01 pm
 - Location: United Kingdom
 - Contact:
 
No and yes!
Some of that code I cannot even find in my version of EasyVENT!
Remove all of:
It has no place in the library.
			
			
									
									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 
I may look like a mule, but I'm not a complete ass.
						
