Page 5 of 9
Posted: Thu Aug 24, 2006 2:44 pm
by Derek
Ok thanks.
Will try it later.
Off to work

Posted: Thu Aug 24, 2006 4:33 pm
by fsw
Just downloaded your actual version and it works fine here.
Posted: Thu Aug 24, 2006 8:07 pm
by Derek
Just got in and tried it.
Works brilliantly, will use in some programs for sure.
Thanks for sharing.
Posted: Fri Sep 01, 2006 8:36 pm
by srod
**Small update: 1st september 2006.
Have added one extra event (#OnErase) to assist with custom painting and reducing flicker etc.
Also added an example on drag/drop using Windows ImageLists.
See first post for the download link.
Posted: Sun Oct 08, 2006 12:24 pm
by srod
**Update : 8 October 2006.
Have fixed a few bugs over the last few weeks and incorporated some improvements from Clipper (with thanks) in regards to editing tree labels.
Bugs fixed relate to drag/drop and panel gadget selection etc.
Posted: Wed Oct 11, 2006 8:24 pm
by srod
**Update : 11 October 2006.
On request, I have added a new event: #OnUnhandledWinMessage
which allows the developer to easily trap all unhandled Windows messages (and those for which there is no corresponding EasyVENT event) and most unhandled EasyVENT events.
This avoids having to mix EasyVENT with PB callback functions, although there's no reason why you cannot mix the two.
It does avoid duplication however.
Please see the user guide for more details.
Posted: Thu Dec 28, 2006 10:29 am
by Flype
hello srod,
Can you add some extra fields to the PB_Sender structure such as UserData ?
Code: Select all
Structure PB_Sender
hwnd.l ;
message.l ;
mousex.l ; Client co-ordinates relative to the underlying control (not the parent window)
mousey.l ; Client co-ordinates relative to the underlying control (not the parent window)
button.l ; For click events this indicates which mouse button was clicked etc.
; #EVENT_LEFTBUTTON etc.
item.l ; Used with certain events \ controls to indicate a particular item.
state.l ; Gives extra information for certain events.
text$ ; Gives extra information for certain events.
uMsg.l ; Windows callback message parameter (when appropriate)
wParam.l ; Windows callback message parameter (when appropriate)
lParam.l ; Windows callback message parameter (when appropriate)
userData1.l ; *
userData2.l ; * UserData - For user private use.
userData3.l ; *
EndStructure
Posted: Thu Dec 28, 2006 12:01 pm
by srod
Hi,
the PB_Sender structure is only valid within the underlying event handler so I am not sure where such fields would be initialised and where they would be stored between calls?
If you are looking for static data that can be shared between the different event handlers, then you could combine multiple handlers into one procedure and then use static variables etc.
**EDIT**
I've had a look and it is easy enough to do what you're after by declaring the 'sender' variable as static within the EventDespatcher procedure within the EasyVENT library.
However, this causes problems in that the EventDespatcher proc needs to remain fully re-entrant in the sense that one event can cause others to fire before the original event handler has completed it's work etc. This makes using such a static structure quite precarious as the fields of the *sender variable within your event handler will thus appear to change for no good reason and at almost random times.
For this reason I would suggest that you adopt the ploy detailed above.

Posted: Thu Dec 28, 2006 2:14 pm
by Flype
ok thank you srod for all those explanations (my request was intended to be use for drag'n'drop between two listicongadgets).
another question :
is it possible to drag'n'drop more than one items at once between two listicons (with the flag #PB_ListIcon_MultiSelect) ?
Posted: Thu Dec 28, 2006 3:26 pm
by Flype
Flype wrote:is it possible to drag'n'drop more than one items at once between two listicons (with the flag #PB_ListIcon_MultiSelect) ?
i've written a small demo for multiselection.
do you think it's a good way to do this ?
Code: Select all
XIncludeFile "EasyVENT.pbi" : DisableExplicit
Declare.l DragItem(*sender.PB_Sender)
Declare.l DropItem(*sender.PB_Sender)
;-
;-
Enumeration 1
#gStore
#gBasket
EndEnumeration
If OpenWindow(0, 100, 100, 350, 320, "MultiSelect Drag'n'Drop", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
LoadImage(0, "icon.ico")
If CreateGadgetList(WindowID(0))
ListIconGadget(#gStore, 10, 10, 160, 300, "Store", 150, #PB_ListIcon_FullRowSelect|#PB_ListIcon_MultiSelect)
ListIconGadget(#gBasket, 180, 10, 160, 300, "Basket", 150, #PB_ListIcon_FullRowSelect|#PB_ListIcon_MultiSelect)
SetGadgetColor(#gStore, #PB_Gadget_BackColor, (#Green|$DFDFDF))
SetGadgetColor(#gBasket, #PB_Gadget_BackColor, (#Blue |$DFDFDF))
EndIf
For i = 1 To 15
AddGadgetItem(#gStore, -1, StringField("Apple,Apricot,Banana,Blackberry,Cherry,Grape,Kiwi,Lemon,Mango,Orange,Peach,Pear,Pineapple,Strawberry,Vanilla", i, ","), ImageID(0))
Next
SetEventHandler(GadgetID(#gStore), #OnDragItemStart, @DragItem())
SetEventHandler(GadgetID(#gStore), #OnDragItemEnd, @DropItem())
SetEventHandler(GadgetID(#gBasket), #OnDragItemStart, @DragItem())
SetEventHandler(GadgetID(#gBasket), #OnDragItemEnd, @DropItem())
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
;-
;-
Procedure.l DragItem(*sender.PB_Sender)
Protected i.l, a.l = GetDlgCtrlID_(*sender\hwnd)
For i = 0 To CountGadgetItems(a) - 1
If GetGadgetItemState(a, i) & #PB_ListIcon_Selected
*sender\text$ + GetGadgetItemText(a, i, 0) + ", "
EndIf
Next
ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure
Procedure.l DropItem(*sender.PB_Sender)
Protected i.l, a.l = #gStore, b.l = #gBasket
If *sender\hwnd = GadgetID(#gStore) : Swap a, b : EndIf
For i = CountGadgetItems(a) - 1 To 0 Step -1
If GetGadgetItemState(a, i) & #PB_ListIcon_Selected
AddGadgetItem(b, -1, GetGadgetItemText(a, i, 0), ImageID(0))
RemoveGadgetItem(a, i)
EndIf
Next
ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure
Posted: Fri Dec 29, 2006 12:39 am
by Intrigued
I'm trying to use this offering (looks great! Thanks!) but I get an error: Structure not found: PB_Sender. I'm believing it's because I have not installed the files in the proper area. I put such inside of the PureBasic main directory. I then did a copy of the exact path to the EasyVENT.pbi file. It then gives that error I stated above.
If someone would clue me into what I am doing wrong or have overlooked to get this going proper like. I am using PB 4.01 (will update here to 4.02)
TIA
Posted: Fri Dec 29, 2006 7:14 am
by Fangbeast
G'day. You put the EasyVent stuff in the same directory as the application you are developing. Or modify any IncludFile directives in your code and the EasyVent files to point to the right directories that all the files are in.
Posted: Fri Dec 29, 2006 4:51 pm
by NoahPhense
Who wrote this crap.
j/k VERY nice..
- np

Posted: Sat Dec 30, 2006 5:01 am
by Intrigued
Fangbeast wrote:G'day. You put the EasyVent stuff in the same directory as the application you are developing. Or modify any IncludFile directives in your code and the EasyVent files to point to the right directories that all the files are in.
I am just trying to run one of the demos (have tried to get several going) running.
I put the Easyvent folder (the unzipped contents of Easyvent are in here) onto my system's Desktop (and the root (C:\) directory) and opened the folder and tried to run those demos and see get the same error. That's why I'm scratching my head in confusion. All the files including the EasyVENT.pbi file and still no go.
Surely I am overlooking something?
TIA
Posted: Sat Dec 30, 2006 6:00 am
by Fangbeast
I said above "Or modify any IncludFile directives in your code and the EasyVent files to point to the right directories that all the files are in."
because some of the code in EasyVent has some lines as in below.
"XIncludeFile "c:\Pure basic\Easyvent\EasyVENTResident.pbi"
See the path it is pointing to? You must modify that path to either point to your own directory (where you put the files) or turn it into a relative path.
"XIncludeFile "EasyVENTResident.pbi"
Check all "XIncludeFile" lines to make sure they are correct for your system.