Page 2 of 2

Re: Fill a ScrollAreaGadget without flickering?

Posted: Tue Feb 11, 2020 3:33 pm
by srod
In which case Lebostein should just replace the text rather than repopulating every time.

Code: Select all

Procedure Rebuild()
  hWnd = GetParent_(GadgetID(#start_combo))
  SendMessage_(hWnd,#WM_SETREDRAW,#False,0)          ; <======================
  For line = 0 To #maxline
    SendMessage_(GadgetID(#start_combo + line),#WM_SETREDRAW,#False,0)
      For item = 0 To #max_item
        SetGadgetItemText(#start_combo + line, item, "Blablablup " + Str(item))
      Next
    SendMessage_(GadgetID(#start_combo + line),#WM_SETREDRAW,#True,0)           ; <##########################
    SetGadgetState(#start_combo + line, Random(#max_item))
  Next  

SendMessage_(hWnd,#WM_SETREDRAW,#True,0)                   ; <======================
RedrawWindow_(hWnd,#Null,#Null,#RDW_INVALIDATE)            ; <======================
EndProcedure

If OpenWindow(0, 0, 0, 405, 470, "ScrollAreaGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ScrollAreaGadget(0, 10, 10, 390,420, 575, 555, 30)
    For line = 0 To #maxline
      ComboBoxGadget(#start_combo + line, 10, 10 + line * 25, 230, 22)
      For item = 0 To #max_item
        AddGadgetItem(#start_combo + line, item, "Blablablup " + Str(item))
      Next
      StringGadget(#start_string + line, 250, 10 + line * 25, 80, 22, "")
    Next
  CloseGadgetList()
  ButtonGadget(1, 10, 430, 390,30, "Refresh")

   Repeat
      Select WaitWindowEvent()
         Case  #PB_Event_CloseWindow
            End
         Case  #PB_Event_Gadget
            Select EventGadget()
               Case 1: Rebuild()
            EndSelect
      EndSelect
   ForEver
EndIf

Re: Fill a ScrollAreaGadget without flickering?

Posted: Tue Feb 11, 2020 6:04 pm
by PureLust
@Lebostein: I've changed your original code to use [ComboBoxEx] from Thorsten1867 and ended up with ~19-20 ms.

So ... maybe worth to give it a try?

Re: Fill a ScrollAreaGadget without flickering?

Posted: Wed Feb 12, 2020 2:44 pm
by Lebostein
PureLust wrote:@Lebostein: I've changed your original code to use [ComboBoxEx] from Thorsten1867 and ended up with ~19-20 ms.

So ... maybe worth to give it a try?
Sounds interesting. Thanks.

Re: Fill a ScrollAreaGadget without flickering?

Posted: Mon Jun 14, 2021 10:14 pm
by SeregaZ
i have a question - how to correct use UseGadgetList() ?

i have some gadgets, and when i select them - it selected by paint FrameGadget over it. it some kind of select. so i have not enough space and start to think use ScrollArea gadget. i paint that ScrollArea with all gadgets, what it need, then i want to by some events - remove old select and paint new one. but that UseGadgetList() not work :( new FrameGadget paint under ScrollArea, but not over it.

Code: Select all

Enumeration
  #Window
  #ScrollArea
  #FrameSelect
  #Button
EndEnumeration

If OpenWindow(#Window, 100, 100, 300, 400, "TEST", #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered)
  
  ScrollAreaGadget(#ScrollArea, 10, 10, 280, 300, 260, 740)
    FrameGadget(#FrameSelect, 10, 10, 236, 24, "", #PB_Frame_Flat)
    CloseGadgetList()
    
  ButtonGadget(#Button, 10, 350, 50, 20, "add")
  
  ;SmartWindowRefresh(#Window, 1) 
  
  Repeat
    Select WaitWindowEvent()
        
      Case #PB_Event_Gadget
        If EventGadget() = #Button
          UseGadgetList(GadgetID(#ScrollArea))
          If IsGadget(#FrameSelect)
            FreeGadget(#FrameSelect)
          EndIf
          FrameGadget(#FrameSelect, 10, 50, 236, 24, "", #PB_Frame_Flat)
        EndIf

       Case #PB_Event_CloseWindow
         qiut = 1
   
     EndSelect
   Until qiut = 1

EndIf

End

Re: Fill a ScrollAreaGadget without flickering?

Posted: Tue Jun 15, 2021 12:11 am
by ChrisR
It works without problems with Open(Close)GadgetList
Although I don't understand why you delete the Frame and then recreate it (ResizeGadget)!

Code: Select all

Enumeration
  #Window
  #ScrollArea
  #FrameSelect
  #Button
EndEnumeration

If OpenWindow(#Window, 100, 100, 300, 400, "TEST", #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered)
  
  ScrollAreaGadget(#ScrollArea, 10, 10, 280, 300, 260, 740)
    FrameGadget(#FrameSelect, 10, 10, 236, 24, "", #PB_Frame_Flat)
    CloseGadgetList()
    
  ButtonGadget(#Button, 10, 350, 50, 20, "add")
  
  ;SmartWindowRefresh(#Window, 1) 
  
  Repeat
    Select WaitWindowEvent()
        
      Case #PB_Event_Gadget
        If EventGadget() = #Button
          Y = GadgetY(#FrameSelect)
          OpenGadgetList(#ScrollArea)   ;UseGadgetList(GadgetID(#ScrollArea))
          If IsGadget(#FrameSelect)
            FreeGadget(#FrameSelect)
          EndIf
          FrameGadget(#FrameSelect, 10, Y+20, 236, 24, "", #PB_Frame_Flat)
          CloseGadgetList()
        EndIf

       Case #PB_Event_CloseWindow
         quit = 1
   
     EndSelect
   Until quit = 1

EndIf

End

Re: Fill a ScrollAreaGadget without flickering?

Posted: Tue Jun 15, 2021 11:07 am
by SeregaZ
it is select. when i click on some gadget of the window - that frame is appear, to show select. so old one is need to delete. that is why i remove old and paint new select over gadget, that i select. thanks a lot.