===>> Is there a function like DoEvents in Visual Basi
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
There is still a problem.
The WindowEvent() function eat all events that can't pass events anymore,
for example:
The WindowEvent() function eat all events that can't pass events anymore,
for example:
Code: Select all
Procedure DoEvents()
While WindowEvent():Wend
EndProcedure
OpenWindow(1,0,0,320,240,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"asdf")
CreateGadgetList(WindowID())
ButtonGadget(1,5,5,180,25,"Click me to get a msgbox!")
ListViewGadget(2,5,35,300,200)
fileNum.l=OpenFile(#PB_Any,"filelist.txt")
aline.s=ReadString()
While aline
AddGadgetItem(2,-1,aline)
aline=ReadString()
DoEvents()
Wend
Repeat
event.l=WaitWindowEvent()
If EventGadgetID()=1 And EventType()=#PB_EventType_LeftClick
; while file loading not finished,this line doesn't work
MessageRequester("asfsafd","asdfsadfa")
EndIf
Until event=#PB_Event_CloseWindow
Hello, Everyone.
Thanks for your help.
Thanks for your help.
Or else wirte all events process in a funciton separatly,like this:
Code: Select all
Procedure processEvents(event.l)
If EventGadgetID()=1 And EventType()=#PB_EventType_LeftClick
MessageRequester("asfsafd","asdfsadfa")
EndIf
If event=#PB_Event_CloseWindow
End
EndIf
EndProcedure
OpenWindow(1,0,0,320,240,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"asdf")
CreateGadgetList(WindowID())
ButtonGadget(1,5,5,180,25,"Click me to get a msgbox!")
ListViewGadget(2,5,35,300,200)
fileNum.l=OpenFile(#PB_Any,"filelist.txt")
aline.s=ReadString()
While aline
AddGadgetItem(2,-1,aline)
aline=ReadString()
processEvents(WindowEvent())
Wend
CloseFile(fileNum)
Repeat
event.l=WaitWindowEvent()
processEvents(event)
Until event=#PB_Event_CloseWindow
Hello, Everyone.
Thanks for your help.
Thanks for your help.
- SimpleMind
- Enthusiast
- Posts: 112
- Joined: Sun May 18, 2003 12:40 pm
- Location: Netherlands
Have you tried Hiding the treegadget first?
I found that most of the delay I was facing in updating TreeGadgets was in the redrawing.
Code: Select all
HideGadget(#Tree_Gadget, #True)
Update TreeGadget code ...
HideGadget(#Tree_Gadget, #False)
Ziltch - http://www.youtube.com/user/OZiltch
-
- PureBasic Expert
- Posts: 2812
- Joined: Fri Apr 25, 2003 4:51 pm
- Location: Portugal, Lisbon
- Contact:
You can put this inside your loop, it will refresh the GUI:
Code: Select all
UpdateWindow_(WindowID(#your_window_number))
Delay(1)