Page 1 of 1

ListIconGadget

Posted: Sat Mar 08, 2025 11:11 am
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!

Re: ListIconGadget

Posted: Sat Mar 08, 2025 11:29 am
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.

Re: ListIconGadget

Posted: Sat Mar 08, 2025 11:40 am
by infratec

Re: ListIconGadget

Posted: Sat Mar 08, 2025 11:51 am
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

Re: ListIconGadget

Posted: Sat Mar 08, 2025 12:02 pm
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

Re: ListIconGadget

Posted: Sat Mar 08, 2025 12:13 pm
by jak64
Hello BarryG,
Indeed this is what I am looking for but with only 2 columns.

Thanks

Re: ListIconGadget

Posted: Sat Mar 08, 2025 2:49 pm
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...

Re: ListIconGadget

Posted: Sat Mar 08, 2025 6:05 pm
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.

Re: ListIconGadget

Posted: Sun Mar 09, 2025 2:04 pm
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

Re: ListIconGadget

Posted: Sun Mar 09, 2025 2:15 pm
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.

Re: ListIconGadget

Posted: Sun Mar 09, 2025 3:48 pm
by RASHAD
Hi PBJim
The ComboBox in ListIcon just UPDATED