Page 1 of 1

[Solved]ScrollArea scrollbar height

Posted: Tue Nov 26, 2024 2:08 pm
by le_magn
Hello everyone, I have a small problem, I have a main window with two scrollArea gadgets, at program startup they are filled with more gadgets(variable number of gadgets), so far so good, I created a procedure to increase the vertical scroll area, but it works only the next time, pressing refresh on the button I created on the interface, the procedure that is called both for the refresh button and at program startup after the panes are filled is as follows, surely I am doing some nonsense wrong:

Code: Select all

Procedure Mia_RidimensionaScroll(fake = 0)
  Protected NumeroBloccati, NumeroSbloccati, DimensioneDestra, DimensioneSinistra
  ForEach ListaGiochi()
    If ListaGiochi()\Bloccato
      NumeroBloccati + 1
    Else
      NumeroSbloccati + 1
    EndIf
  Next
  
  If NumeroBloccati > 12
    DimensioneDestra = 429 + (((NumeroBloccati - 12) + 2) / 3) * 90
    SetGadgetAttribute(#ScrlArea_unLock, #PB_ScrollArea_InnerHeight, DimensioneDestra)
  Else
    SetGadgetAttribute(#ScrlArea_unLock, #PB_ScrollArea_InnerHeight, 429)
  EndIf
  
  If NumeroSbloccati > 12
    DimensioneSinistra = 429 + (((NumeroSBloccati - 12) + 2) / 3) * 90
    SetGadgetAttribute(#ScrlArea_Lock, #PB_ScrollArea_InnerHeight, DimensioneSinistra)
  Else
    SetGadgetAttribute(#ScrlArea_Lock, #PB_ScrollArea_InnerHeight, 429)
  EndIf
EndProcedure

Re: ScrollArea scrollbar height

Posted: Tue Nov 26, 2024 6:04 pm
by TI-994A
Hi @le_magn. From your recent posts, I've noticed that you're trying to create an image picker.

I've just posted a simple and lightweight tool that might fit your requirements. Have a look:

> PureBasic ImagePickerGadget()

Re: ScrollArea scrollbar height

Posted: Tue Nov 26, 2024 10:12 pm
by le_magn
TI-994A wrote: Tue Nov 26, 2024 6:04 pm Hi @le_magn. From your recent posts, I've noticed that you're trying to create an image picker.

I've just posted a simple and lightweight tool that might fit your requirements. Have a look:

> PureBasic ImagePickerGadget()
Hi TI-994A, thank you very much for the link to your code, I will look at it in depth these days, yes I am creating a launcher for steam game library, and I fill a ScrollAreaGadget with many gadgets, for each image it's total 4 gadgets(4 imagegadgets), because I need the events of all 4 elements, only drawback is that when it's so many images then the redraw operation becomes slow if I refresh the windows, so any help I get I'm very glad, and I try to take inspiration from your examples and solutions.

Re: ScrollArea scrollbar height

Posted: Wed Nov 27, 2024 1:10 pm
by TI-994A
le_magn wrote: Tue Nov 26, 2024 10:12 pmHi TI-994A, thank you very much for the link to your code, I will look at it in depth these days, yes I am creating a launcher for steam game library, and I fill a ScrollAreaGadget with many gadgets, for each image it's total 4 gadgets(4 imagegadgets), because I need the events of all 4 elements, only drawback is that when it's so many images then the redraw operation becomes slow if I refresh the windows, so any help I get I'm very glad, and I try to take inspiration from your examples and solutions.
Hello again, @le_magn. You're right; too many gadgets can really put a toll on performance and footprint.

I believe that the ImagePickerGadget() would suit your needs quite well. It's lightweight, cross-platform, and it works out of the box. Just plug & play! :lol:

BTW, I just posted an update to the module code. It now supports more image types and contains some additional fixes.

I hope that you'll progress well with this gadget. But please feel free to reach out if you might require any specific tweaks.

Re: [Solved]ScrollArea scrollbar height

Posted: Wed Nov 27, 2024 1:51 pm
by le_magn
Thank you very much TI-994A, I did some tests with your module and I must say I was impressed, I tested it with a folder of more than 400 images, the speed is impressive, I will probably use your module to rewrite later versions of my application, I'm going to take a look at the updated version of the module, in the meantime I thank you, you were really very kind