I expected that so I am using always Maybe to be in the safe side
Listicongadget column identity
Re: Listicongadget column identity
Thanks Shardik for testing
I expected that so I am using always Maybe to be in the safe side
I expected that so I am using always Maybe to be in the safe side
Egypt my love
- Mindphazer
- Enthusiast

- Posts: 487
- Joined: Mon Sep 10, 2012 10:41 am
- Location: Savoie
Re: Listicongadget column identity
Hi RASHAD, very nice trick indeed. It doesn't work on MacOS because SetGadgetItemColor() is not supported on MacOSX...
Edit : sorry, i hadn't seen Shardik's reply...
MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
...and unfortunately... Windows at work...
Re: Listicongadget column identity
I had seen your Maybe and I'm very grateful that you are cautious about the use in other operatings systems when not having tested it. I have already stated several times that I am very impressed about your clever and ingenious solutions in Windows to try native PB solutions without any Windows API.RASHAD wrote: Sat Feb 25, 2023 2:53 am Thanks Shardik for testing
I expected that so I am using always Maybe to be in the safe side![]()
Unfortunately these solutions are often not working correctly in Linux and MacOS although theoretically they should work. But the implementation of PureBasic functions in Linux and MacOS are often very different, so that the corner cases you use sometimes only work in Windows.
Re: Listicongadget column identity
@Mindphazer
Thank you for testing much appreciated
@Shardik
No one of the forum members [users of Linux or Mac] should be worry as long as we have you here
I am astonished that you have all these energy to control the 3 OS while I am struggling hard with just one [Windows]
I keep archiving your solutions for Linux and Mac just in case I will be enforced to use any
Thanks Shardik for everything
Thank you for testing much appreciated
@Shardik
No one of the forum members [users of Linux or Mac] should be worry as long as we have you here
I am astonished that you have all these energy to control the 3 OS while I am struggling hard with just one [Windows]
I keep archiving your solutions for Linux and Mac just in case I will be enforced to use any
Thanks Shardik for everything
Egypt my love
- Mindphazer
- Enthusiast

- Posts: 487
- Joined: Mon Sep 10, 2012 10:41 am
- Location: Savoie
Re: Listicongadget column identity
True. Thanks for all your efforts to make a code crossplatform
MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
...and unfortunately... Windows at work...
Re: Listicongadget column identity
hello all,
here is another alternative, if you want to use the background color differently.
Happy coding and stay healthy.
here is another alternative, if you want to use the background color differently.
Code: Select all
EnableExplicit
; Some shortcoming: first column must be visible, because the shift cannot be taken into account.
; ---------------------------------------------------------------------------------------------------------------------
Procedure.i ListIcon_GetColumnMouseClick(Gadget, MousePosX, MousePosY) ; index of the Column or -1 in case of failure
Protected column, count, width
count = GetGadgetAttribute(Gadget, #PB_ListIcon_ColumnCount)
For column = 0 To count - 1
width + GetGadgetItemAttribute(Gadget, 0, #PB_ListIcon_ColumnWidth, column)
If MousePosX < width
ProcedureReturn Column ; success, zero based index of column
EndIf
Next column
ProcedureReturn -1 ; failure, not a valid column ...
EndProcedure
; ---------------------------------------------------------------------------------------------------------------------
Procedure main()
Protected i, x, y, line$
If OpenWindow(0,0,0,640,480,"Test",#PB_Window_SystemMenu| #PB_Window_ScreenCentered)
ListIconGadget(0,10,10,620,460,"-0-",32,#PB_ListIcon_GridLines)
AddGadgetColumn(0,1,"Column 1",110)
AddGadgetColumn(0,2,"Column 2",100)
AddGadgetColumn(0,3,"Column 3",100)
AddGadgetColumn(0,4,"Column 4",100)
AddGadgetColumn(0,5,"Column 5",100)
For i = 0 To 16
line$ = LSet(Str(i),3," ")
AddGadgetItem(0, -1, "-0-" + Chr(10)+"Text on Line "+line$+" in Column 1"+Chr(10)+"Text on Line "+line$+" in Column 2"+Chr(10)+"Text on Line "+line$+" in Column 3")
Next
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break ; bye
Case #PB_Event_Gadget
Select EventGadget()
Case 0
Select EventType()
Case #PB_EventType_LeftClick
x = WindowMouseX(0)
y = WindowMouseY(0)
Debug "Column " + Str(ListIcon_GetColumnMouseClick(0, x, y))
EndSelect
EndSelect
EndSelect
ForEver
EndIf
EndProcedure
main()
Last edited by Axolotl on Mon Feb 27, 2023 3:23 pm, edited 1 time in total.
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
Re: Listicongadget column identity
Hi Axolotl
Sorry but it fails if you dragged and changed any column width to exceed the the listicon width and needed for Hal scroll
More work to do
Sorry but it fails if you dragged and changed any column width to exceed the the listicon width and needed for Hal scroll
More work to do
Egypt my love
Re: Listicongadget column identity
@RASHAD,
you are right. I need to consider the column shift. However, so far I can't find a PB-standard method for this.
you are right. I need to consider the column shift. However, so far I can't find a PB-standard method for this.
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
Re: Listicongadget column identity
Sorry for the delay in answering - have been away.
Many thanks for the responses one of which I shall implement.
2015 ?????????????
Guess I am old and doddering but concerned that not only did I not remember this but when I searched the other day, whatever terms I used did not signal that thread.
Seems strange that the one function I suggested back then has not been implemented to complement the GetGadgetState for tabular lists.
Regards,
epog10
Many thanks for the responses one of which I shall implement.
2015 ?????????????
Guess I am old and doddering but concerned that not only did I not remember this but when I searched the other day, whatever terms I used did not signal that thread.
Seems strange that the one function I suggested back then has not been implemented to complement the GetGadgetState for tabular lists.
Regards,
epog10


