Some of my customers have complained using some of my PureBASIC applications with ExplorerTreeGadgets when expanding a folder node with lots of files. The ExplorerTreeGadget doesn't switch to an hourglass cursor if you klick on a plus to expand a folder with lots of files or a partition with lots of folders. Especially on older PCs it seems to happen nothing for a while after the klick on the plus sign.
Thanks to srod's unbelievable EasyVENT library (http://www.purebasic.fr/english/viewtopic.php?t=21136) the solution is a snap:
Code: Select all
;*********************************************************************************
XIncludeFile "C:\Programme\EasyVENT\EasyVENT.PBI"
;*********************************************************************************
Declare ExpandCollapse(*Sender.PB_Sender)
Declare SetCursor(*Sender.PB_Sender)
Define WaitCursorHandle
OpenWindow(0, 0, 0, 300, 250, "ExplorerTree with hourglass cursor", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ExplorerTreeGadget(0, 10, 10, 280, 230, "C:\")
; ----- Set event handlers
SetEventHandler(GadgetID(0), #OnCollapseExpandSelection, @ExpandCollapse())
SetEventHandler(GadgetID(0), #OnSetCursor, @SetCursor())
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
End
;*********************************************************************************
; EVENT HANDLERS
;*********************************************************************************
Procedure ExpandCollapse(*Sender.PB_Sender)
Shared WaitCursorHandle
If *Sender\State = #EVENT_EXPAND
WaitCursorHandle = LoadCursor_(0, #IDC_WAIT)
SetCursor_(WaitCursorHandle)
EndIf
ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure
Procedure SetCursor(*Sender.PB_Sender)
Shared WaitCursorHandle
If WaitCursorHandle <> 0
DestroyCursor_(WaitCursorHandle)
WaitCursorHandle = 0
EndIf
ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure
