Page 2 of 2
Re: ScrollBarGadget stops Repeat Loop - how to prevent?
Posted: Mon Sep 26, 2022 6:07 pm
by mk-soft
@Olli,
It's all settled. The ScrollBarGadget stops the events when the mouse is pressed. So the same as with an open menu item. But it is OS internal and not PB internal. Therefore use the TrackBarGadget.
Re: ScrollBarGadget stops Repeat Loop - how to prevent?
Posted: Tue Sep 27, 2022 10:01 pm
by matalog
RE42 wrote: Tue Sep 20, 2022 9:27 am
Sorry, I had forgotten to write, that my described problem probably always appeares if a ScrollBarGadget is clicked. Please have a look at the example PureBasiic has published in the help for this purpose. Also there the loop stops when ScrollBarGadget is clicked. Is that caused by Windows? I'm using Windows 10 Home. Is there a way to force the loop to run, although a ScrollBarGadget is clicked? Thanks.
Which example is this you are talking about? I would like to have a look. Also, would you not share a shortened part of your code that exhibits this problem, so that you can be helped?
I would really like to learn if this is a shortcoming of Purebasic or a shortcoming of your code?!
Re: ScrollBarGadget stops Repeat Loop - how to prevent?
Posted: Tue Sep 27, 2022 10:37 pm
by matalog
mk-soft wrote: Mon Sep 26, 2022 6:07 pm
@Olli,
It's all settled. The ScrollBarGadget stops the events when the mouse is pressed. So the same as with an open menu item. But it is OS internal and not PB internal. Therefore use the TrackBarGadget.
Which events are stopped when the mouse is pressed on a scroll gadget?
Have we come up with an example to show this?
Re: ScrollBarGadget stops Repeat Loop - how to prevent?
Posted: Tue Sep 27, 2022 10:43 pm
by mk-soft
Sorry

but ...
Where is the problem to write a ScrollBarGadget test program yourself.
The timer hangs and all other events when the ScrollBarGadget is pressed. Therefore one takes a TrackBarGadget. Is OS specific.
Code: Select all
;-TOP
Procedure UpdateWindow()
Protected dx, dy
dx = WindowWidth(0)
dy = WindowHeight(0) - StatusBarHeight(0) - MenuHeight()
; Resize Gadgets
ResizeGadget(0, 10, 10, dx - 20, 30)
EndProcedure
Procedure Main()
Protected dx, dy, cnt
#WinStyle = #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget
If OpenWindow(0, #PB_Ignore, #PB_Ignore, 600, 400, "Test Window", #WinStyle)
; MenuBar
CreateMenu(0, WindowID(0))
MenuTitle("File")
; StatusBar
CreateStatusBar(0, WindowID(0))
AddStatusBarField(#PB_Ignore)
; Gadgets
dx = WindowWidth(0)
dy - WindowHeight(0) - StatusBarHeight(0) - MenuHeight()
ScrollBarGadget(0, 10, 10, dx - 20, 30, 0, 100, 1)
; Bind Events
BindEvent(#PB_Event_SizeWindow, @UpdateWindow(), 0)
AddWindowTimer(0, 1, 500)
; Main Loop
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Select EventWindow()
Case 0
Break
EndSelect
Case #PB_Event_Menu
Select EventMenu()
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
Case #PB_Event_Timer
Select EventTimer()
Case 1
cnt + 1
StatusBarText(0, 0, " Timer " + cnt)
EndSelect
EndSelect
ForEver
EndIf
EndProcedure : Main()
Re: ScrollBarGadget stops Repeat Loop - how to prevent?
Posted: Tue Sep 27, 2022 11:14 pm
by matalog
mk-soft wrote: Tue Sep 27, 2022 10:43 pm
Sorry

but ...
Where is the problem to write a ScrollBarGadget test program yourself.
The timer hangs and all other events when the ScrollBarGadget is pressed. Therefore one takes a TrackBarGadget. Is OS specific.
Code: Select all
;-TOP
Procedure UpdateWindow()
Protected dx, dy
dx = WindowWidth(0)
dy = WindowHeight(0) - StatusBarHeight(0) - MenuHeight()
; Resize Gadgets
ResizeGadget(0, 10, 10, dx - 20, 30)
EndProcedure
Procedure Main()
Protected dx, dy, cnt
#WinStyle = #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget
If OpenWindow(0, #PB_Ignore, #PB_Ignore, 600, 400, "Test Window", #WinStyle)
; MenuBar
CreateMenu(0, WindowID(0))
MenuTitle("File")
; StatusBar
CreateStatusBar(0, WindowID(0))
AddStatusBarField(#PB_Ignore)
; Gadgets
dx = WindowWidth(0)
dy - WindowHeight(0) - StatusBarHeight(0) - MenuHeight()
ScrollBarGadget(0, 10, 10, dx - 20, 30, 0, 100, 1)
; Bind Events
BindEvent(#PB_Event_SizeWindow, @UpdateWindow(), 0)
AddWindowTimer(0, 1, 500)
; Main Loop
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Select EventWindow()
Case 0
Break
EndSelect
Case #PB_Event_Menu
Select EventMenu()
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
Case #PB_Event_Timer
Select EventTimer()
Case 1
cnt + 1
StatusBarText(0, 0, " Timer " + cnt)
EndSelect
EndSelect
ForEver
EndIf
EndProcedure : Main()
I had written a Scrollbargadget test program, but it didn't seem to show the same problems.
When I use your program to test the scrollbargadget, on a Windows (8.1) system, it does not halt the timer at all. It however, temporarily stops the printing of the output of the timer to the statusbar. The timer then continues where it would have been if I had not had clicked it, even if I clicked it for 5 seconds (in that case, when I let go, it increments to 5 seconds later).
The exact same thing happens when I drag to resize the window for 5 seconds.
Is dragging of a resizable window succumbing to the same problem?
I am not an advanced user of Purebasic, but I have recently coded some gadgets in a bad way that did not allow it to update when another coding method, would have.
If you tell me that the timer's output being printed on screen pausing, while dragging the window size, is the exact same behaviour that you are describing then I can let this go. Otherwise, another method of coding may help here.
Re: ScrollBarGadget stops Repeat Loop - how to prevent?
Posted: Tue Sep 27, 2022 11:54 pm
by Olli
mk-soft wrote:Sorry

but ...
Where is the problem to write a ScrollBarGadget test program yourself.
Please be cool.
No code = no problem.
Re: ScrollBarGadget stops Repeat Loop - how to prevent?
Posted: Wed Sep 28, 2022 12:10 am
by Olli
ScrollBar is pressed down : bind event
ScrollBar is moved : bind event
ScrollBar is pressed "up" : bind event + classical event
Timer event is not affected : bind event
And absolutely no closeWindow event occurs without a click on the red cross.
Code: Select all
AddWindowTimer(timerWindow, timerId, timerDuration)
BindEvent(#PB_Event_Timer, *timerProc, timerWindow)
W10
So, I just wait the code which reveals a problem. If it is in the doc, it is to be told in the doc bugs section.
I think the events which are binded, have a higher priority than the normal events. I am curious : I add a closeWindow bind event to check it... Result : no problem...
So, the author of the subject should give the source code which let appear the problem, adding the OS in which he has seen it, this to write on bugs section, and remove the problem.