Bug with ClearGadgetItems + EditorGadget
Posted: Sun Oct 21, 2018 2:06 am
PB 5.62 (x64) tested on Win 7 & win 10
An EditorGadget is filled with enough elements to show scrolling bar. If I scroll using the bar and then erase all elements with Clear button (ClearGadgetItems) , the scrolling bar stays on
and everything is screwed-up if adding new elements with keyboard. Scrolling with the mouse wheel does not produce the problem
The following code shows my Work Around: Note the 2 lines before ClearGadgetItems,
I'm setting the focus on EditorGadget and bringing cursor at the end , it brings back scrolling bar to good position and solves the problem
Line after ClearGadgetItems is optional, it removes the cursor by setting focus on Clear button
An EditorGadget is filled with enough elements to show scrolling bar. If I scroll using the bar and then erase all elements with Clear button (ClearGadgetItems) , the scrolling bar stays on
and everything is screwed-up if adding new elements with keyboard. Scrolling with the mouse wheel does not produce the problem
Code: Select all
If OpenWindow(0, 0, 0, 260, 150, "ClearGadgetItems", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
EditorGadget(0,10,10,240,100)
For a = 1 To 50
AddGadgetItem (0, -1, "Element "+Str(a))
Next
ButtonGadget(1, 10, 120, 200, 20, "Clear")
Repeat
Evenement = WaitWindowEvent()
If Evenement = #PB_Event_Gadget
If EventGadget() = 1
ClearGadgetItems(0)
EndIf
EndIf
Until Evenement = #PB_Event_CloseWindow
EndIf
I'm setting the focus on EditorGadget and bringing cursor at the end , it brings back scrolling bar to good position and solves the problem
Line after ClearGadgetItems is optional, it removes the cursor by setting focus on Clear button
Code: Select all
If OpenWindow(0, 0, 0, 260, 150, "ClearGadgetItems", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
EditorGadget(0,10,10,240,100)
For a = 1 To 50
AddGadgetItem (0, -1, "Element "+Str(a))
Next
ButtonGadget(1, 10, 120, 200, 20, "Clear")
Repeat
Evenement = WaitWindowEvent()
If Evenement = #PB_Event_Gadget
If EventGadget() = 1
SetActiveGadget(0)
AddGadgetItem (0, -1, "")
ClearGadgetItems(0)
SetActiveGadget(1)
EndIf
EndIf
Until Evenement = #PB_Event_CloseWindow
EndIf