Page 1 of 1

Using ListIconGadget with #PB_ListIcon_ColumnAlignment

Posted: Wed Apr 03, 2024 9:29 am
by Lord
Hi!

With PBv6.10 you can set the alignment for each column in a ListIconGadget.
Question:
What is the recommendet value for "Item" in SetGadgetItemAttribute()?
Is it #PB_Ignore, #PB_Any or what?
"Item" seems to have no relevance. You can only set alignement for the header.

How do I get the column when I click on header?
This example does always return "0" (tested on Win7 with PB v6.10):

Code: Select all

OpenWindow(1, 10, 10, 640, 480,"")

ListIconGadget(1, 0, 0, WindowWidth(1), WindowHeight(1), "Col 1", 120, #PB_ListIcon_FullRowSelect)
AddGadgetColumn(1, 1, "Col 2", 120)
AddGadgetColumn(1, 2, "Col 3", 120)
AddGadgetColumn(1, 3, "Col 4", 120)

SetGadgetItemAttribute(1, #PB_Ignore, #PB_ListIcon_ColumnAlignment, #PB_ListIcon_Right, 0)
SetGadgetItemAttribute(1, #PB_Ignore, #PB_ListIcon_ColumnAlignment, #PB_ListIcon_Center, 1)
SetGadgetItemAttribute(1, #PB_Ignore, #PB_ListIcon_ColumnAlignment, #PB_ListIcon_Center, 2)
SetGadgetItemAttribute(1, #PB_Ignore, #PB_ListIcon_ColumnAlignment, #PB_ListIcon_Right, 3)

AddGadgetItem(1, -1, "Row 1"+#LF$+"Row 2"+#LF$+"Row 3"+#LF$+"Row 4")
AddGadgetItem(1, -1, "Row 1"+#LF$+"Row 2"+#LF$+"Row 3"+#LF$+"Row 4")
AddGadgetItem(1, -1, "Row 1"+#LF$+"Row 2"+#LF$+"Row 3"+#LF$+"Row 4")
AddGadgetItem(1, -1, "Row 1"+#LF$+"Row 2"+#LF$+"Row 3"+#LF$+"Row 4")

Repeat:
  event=WaitWindowEvent()
  Select event
    Case #PB_Event_Gadget
      Select EventGadget()
        Case 1
          Select EventType()
            Case #PB_EventType_ColumnClick
              Debug GetGadgetAttribute(1, #PB_EventType_ColumnClick)
          EndSelect
      EndSelect
    Case #PB_Event_CloseWindow
      Break
  EndSelect
ForEver 

Re: Using ListIconGadget with #PB_ListIcon_ColumnAlignment

Posted: Wed Apr 03, 2024 9:59 am
by HeX0R
it's #PB_ListIcon_ClickedColumn instead of #PB_EventType_ColumnClick for GetGadgetAttribute()

And I think #PB_ListIcon_ColumnAlignment should be mentioned in the help of SetGadgetItemAttribute()

Re: Using ListIconGadget with #PB_ListIcon_ColumnAlignment

Posted: Wed Apr 03, 2024 11:07 am
by BarryG
Lord wrote: Wed Apr 03, 2024 9:29 amWhat is the recommendet value for "Item" in SetGadgetItemAttribute()?
Is it #PB_Ignore, #PB_Any or what?
"Item" seems to have no relevance.
The manual says: "The 'Item' parameter is ignored", so it can be literally anything. I personally use #PB_Ignore so I remember it's not needed when I read my code later.

Re: Using ListIconGadget with #PB_ListIcon_ColumnAlignment

Posted: Wed Apr 03, 2024 11:58 am
by Lord
Hi HeX0R and BarryG!

Thank you for your explainations.
Now it works as it should.