[Solved]ScrollArea scrollbar height

Just starting out? Need help? Post your questions and find answers here.
User avatar
le_magn
Enthusiast
Enthusiast
Posts: 289
Joined: Wed Aug 24, 2005 12:11 pm
Location: Italia

[Solved]ScrollArea scrollbar height

Post 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
Last edited by le_magn on Tue Nov 26, 2024 11:07 pm, edited 1 time in total.
Image
User avatar
TI-994A
Addict
Addict
Posts: 2751
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: ScrollArea scrollbar height

Post 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()
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
User avatar
le_magn
Enthusiast
Enthusiast
Posts: 289
Joined: Wed Aug 24, 2005 12:11 pm
Location: Italia

Re: ScrollArea scrollbar height

Post 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.
Image
User avatar
TI-994A
Addict
Addict
Posts: 2751
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: ScrollArea scrollbar height

Post 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.
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
User avatar
le_magn
Enthusiast
Enthusiast
Posts: 289
Joined: Wed Aug 24, 2005 12:11 pm
Location: Italia

Re: [Solved]ScrollArea scrollbar height

Post 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
Image
Post Reply