ListIconGadget

Just starting out? Need help? Post your questions and find answers here.
jak64
Enthusiast
Enthusiast
Posts: 639
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

ListIconGadget

Post by jak64 »

Hello,
I don't understand the use of the ListIconGadget gadget!

I am creating a ListIconGadget with 3 columns.

I would like, by clicking, for example, on the second column of an element (without having to click on the first, to be able to change its value, a bit like in an Excel table).

This is not possible, except, apparently, to have to scan and test all the lines.

I honestly don't see the use of this gadget!
infratec
Always Here
Always Here
Posts: 7662
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: ListIconGadget

Post by infratec »

jak64 wrote: Sat Mar 08, 2025 11:11 am I honestly don't see the use of this gadget!
Then simply don't use it :wink:

But honestly: without a code example I don't help you, because (as already wrtitten multiple times) it costs to many time of many people
to code an example.
If you provide one, everybody can extend it and have not to write it from scratch.

If you write an example it costs you 15 minutes.
If 10 people wants to help you it costs 10 x 15 minutes. What a waste of time.
infratec
Always Here
Always Here
Posts: 7662
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: ListIconGadget

Post by infratec »

BarryG
Addict
Addict
Posts: 4219
Joined: Thu Apr 18, 2019 8:17 am

Re: ListIconGadget

Post by BarryG »

jak64 wrote: Sat Mar 08, 2025 11:11 amI don't understand the use of the ListIconGadget gadget!
It's to show columns and rows of data; kind of like you said for Excel. But unlike Excel, it's not an interactive spreadsheet gadget.

Maybe you want something like this? -> https://www.purebasic.fr/english/viewtopic.php?t=54022

I just tried it and you can click and edit cells, sort columns, have images in cells, etc. Screenshot:

Image
jak64
Enthusiast
Enthusiast
Posts: 639
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

Re: ListIconGadget

Post by jak64 »

Hello infratec,
Indeed, an example is worth a thousand words.

In the following small example, I want to:

By clicking, for example on "white" of the third line, change "white" to "orange". If I now click again on "orange", I would like to change "orange" to "green".
If I click on "green", then I change to "white" and the cycle repeats itself each time I click.

I only want to click on the "white" and not on the first column (CCCCCCCCC in the example)

Code: Select all

EnableExplicit

Global fenetre.i
Global event.i
Global liste_icon.i
Global i.i
Global resultat.i=-1

fenetre = OpenWindow(#PB_Any, 0, 0, 800,600, "Test ListIconGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
liste_icon = ListIconGadget(#PB_Any, 10,10, 330, 550, "Titre série", 250)
AddGadgetColumn(liste_icon, 1, "Etat", 60)

For i = 0 To 25
  AddGadgetItem(liste_icon, -1, RSet(Chr(i + 65), 8, Chr(i + 65)) + Chr(10) + "white")
Next i

Repeat
  event = WaitWindowEvent()
  
  Select event
      
    Case #PB_Event_Gadget
      Select EventGadget()
          
        Case liste_icon
          Select EventType()       
            Case #PB_EventType_LeftClick
              resultat = GetGadgetState(liste_icon)
              ; ?????????????????????????????? 
          EndSelect
          
      EndSelect
      
  EndSelect
  
Until Event = #PB_Event_CloseWindow
jak64
Enthusiast
Enthusiast
Posts: 639
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

Re: ListIconGadget

Post by jak64 »

Hello BarryG,
Indeed this is what I am looking for but with only 2 columns.

Thanks
User avatar
jacdelad
Addict
Addict
Posts: 2029
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: ListIconGadget

Post by jacdelad »

Just a sidenote: speaking for Windows, the ListIconGadget (or ListView as it's called natively by Windows) was never intended to work like Excel, though it already provides all needed messages and notifications to react on clicking on a specific cell. It was meant as an addition and enhancement of the ListBox (ListViewGadget in terms of PureBasic). The ListBox is limited in matters of columns, count of items, and messages, plus it also does not provide a header, sorting, icons and so on and so on...
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
jak64
Enthusiast
Enthusiast
Posts: 639
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

Re: ListIconGadget

Post by jak64 »

Hello everyone,
Thanks for all your messages.

After thinking about it, I found the solution for what I want to do by using a ScrollAreaGadget().

I can add as many gadgets as I want by aligning them and it works very well for what I want to do.

Thanks again for taking your time to help me.
User avatar
mk-soft
Always Here
Always Here
Posts: 6315
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: ListIconGadget

Post by mk-soft »

Said hasn't been in touch for a long time and I've already edited a few things.
It is therefore better to use MyGrid_16Feb22.

GitHub: https://github.com/mk-soft-65/MyGrid/tr ... e-function
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PBJim
Enthusiast
Enthusiast
Posts: 296
Joined: Fri Jan 19, 2024 11:56 pm

Re: ListIconGadget

Post by PBJim »

jak64 wrote: Sat Mar 08, 2025 11:11 am I am creating a ListIconGadget with 3 columns. I would like, by clicking, for example, on the second column of an element (without having to click on the first, to be able to change its value, a bit like in an Excel table).
I would say that your requirement may be better met by Rashad's grid. The code for this grid is short and easily maintainable and can look and operate closer to Visual Basic's Data Grid, which you might have been referring to, Jak64 :

https://www.purebasic.fr/english/viewto ... 50#p630250

The link mentioned by Barry looks impressive on the face of it but for me at least, it wasn't practical to consider using in a professional application — most of the time all we need is the ability to input and validate cells, as Visual Basic's Data Grid provides.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4991
Joined: Sun Apr 12, 2009 6:27 am

Re: ListIconGadget

Post by RASHAD »

Hi PBJim
The ComboBox in ListIcon just UPDATED
Egypt my love
Post Reply