ListIcon GetGadgetText etc
-
- Always Here
- Posts: 6425
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
ListIcon GetGadgetText etc
GetGadgetText() gets the content of column 0 of the selected row. This is redundant, GetGadgetItemText() can do it.
It would be much more useful if GetGadgetText() could get the whole ListIcon as a string, which then could for example be parsed or written to a file or used to rapidly populate another ListIcon with SetGadgetText().
Further, GetGadgetItemText(), which currently gets the content of a single cell, could have an option to collect a whole row.
Concerning the column (cell) separator. I think #LF$ is an awkward choice as it really has to be changed to suit writing to a file. Could we not have a function to set the column separator? Or just change it to a better one such as #TAB$?
It would be much more useful if GetGadgetText() could get the whole ListIcon as a string, which then could for example be parsed or written to a file or used to rapidly populate another ListIcon with SetGadgetText().
Further, GetGadgetItemText(), which currently gets the content of a single cell, could have an option to collect a whole row.
Concerning the column (cell) separator. I think #LF$ is an awkward choice as it really has to be changed to suit writing to a file. Could we not have a function to set the column separator? Or just change it to a better one such as #TAB$?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: ListIcon GetGadgetText etc
+1 for the request for GetGadgetText()
For compatibility, it would be better to introduce an optional parameter for whole lines.
Likewise for the separator (#LF$ can be used as a line break inside a cell in linux (and that's good ) and could cause a lot of chaos as column separator (and that's not good).
Regards, Charly
For compatibility, it would be better to introduce an optional parameter for whole lines.
Likewise for the separator (#LF$ can be used as a line break inside a cell in linux (and that's good ) and could cause a lot of chaos as column separator (and that's not good).
Regards, Charly
PureBasic 5.4-5.7, Linux: (X/L/K)Ubuntus+Mint - Windows XP (32Bit)
PureBasic Linux-API-Library & Viewer: http://www.chabba.de
PureBasic Linux-API-Library & Viewer: http://www.chabba.de
Re: ListIcon GetGadgetText etc
+1 for GetGadgetText()
Re: ListIcon GetGadgetText etc
Why?
GetgadgetText returns the selected item from column 0, which I find quite useful.
Any reason, why such a small and simple code as this is inadequate?
GetgadgetText returns the selected item from column 0, which I find quite useful.
Any reason, why such a small and simple code as this is inadequate?
Code: Select all
Macro cr : Chr(10) : EndMacro
Declare LeftClick()
Declare.s GetListIconFull(GadID.i, Index.i, Delimit.s = #TAB$)
Global x, y, ev, st.s
OpenWindow(0, 0, 0, 600, 600, "test", #PB_Window_ScreenCentered|#PB_Window_SystemMenu)
ListIconGadget(0, 0, 0, 610, 600, "C0", 50, #PB_ListIcon_FullRowSelect)
For x = 1 To 10 : AddGadgetColumn(0, x, "C" + Str(x), 50) : Next x
For y = 0 To 100 : For x = 0 To 10 : st + Str(Random(300)) + cr : Next x : AddGadgetItem(0, -1, st) : st = "" : Next y ; fill it with shit..
BindGadgetEvent(0, @LeftClick(), #PB_EventType_LeftClick)
Repeat
ev = WaitWindowEvent(5)
Until ev = #PB_Event_CloseWindow
Procedure LeftClick()
Protected ID.i = EventGadget()
If GetGadgetState(ID) > -1
Debug GetListIconFull(ID, GetGadgetState(ID), "-")
EndIf
EndProcedure
Procedure.s GetListIconFull(GadID.i, Index.i, Delimit.s = #TAB$)
Protected x, co.i = GetGadgetAttribute(GadID, #PB_ListIcon_ColumnCount) , st.s = ""
For x = 0 To co
If x < co : st + GetGadgetItemText(GadID, Index, x) + Delimit : Else : st + GetGadgetItemText(GadID, Index, x) : EndIf
Next x
ProcedureReturn Left(st, Len(st)-1)
EndProcedure
Current configurations:
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
Re: ListIcon GetGadgetText etc
@DK_PETER
very nice
Sorry, small update...
very nice
Sorry, small update...
Code: Select all
Procedure.s GetListIconFull(GadID.i, Index.i, Delimit.s = #TAB$)
Protected x, co.i = GetGadgetAttribute(GadID, #PB_ListIcon_ColumnCount), st.s = ""
co - 2
For x = 0 To co
st + GetGadgetItemText(GadID, Index, x) + Delimit
Next x
st + GetGadgetItemText(GadID, Index, x)
ProcedureReturn st
EndProcedure
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
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
-
- Always Here
- Posts: 6425
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: ListIcon GetGadgetText etc
Hi DK_PETER
...and concerning your code snippet (which we all have our own variant of) it's inefficient when heavy data displayed by several ListIcons needs to be handled in a real-world app.
We should be able to use the same delimiter for the data throughout, that's just common sense.
...because GetGadgetItemText() can do the same, for any column.GetgadgetText returns the selected item from column 0, which I find quite useful.
...and concerning your code snippet (which we all have our own variant of) it's inefficient when heavy data displayed by several ListIcons needs to be handled in a real-world app.
We should be able to use the same delimiter for the data throughout, that's just common sense.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: ListIcon GetGadgetText etc
@IdeasVacuum
Well, I have to disagree.
The team would still have to iterate each column.
The code could eaily be modified for several listIcongadgets..
Anyway...
Using GetGadgetText is a -1 from me.
Well, I have to disagree.
The team would still have to iterate each column.
The code could eaily be modified for several listIcongadgets..
Anyway...
Using GetGadgetText is a -1 from me.
Current configurations:
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
Re: ListIcon GetGadgetText etc
The ListIconGadget (MS ListView) does not support a command to read all SubItem at once.
So always read all the columns themselves
So always read all the columns themselves
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
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
-
- Always Here
- Posts: 6425
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: ListIcon GetGadgetText etc
mk-soft ...we don't always have to be limited by what Microsoft has provided - and what about the other platforms?
I think it should be possible for the PB team to pluck bulk data from the memory. It's worth looking at.
DK_PETER ...we could have the functionality as dedicated ListIcon commands.
GetListIconText(), SetListIconText()
....GetGadgetText() is currently a misleading function name when applied to ListIcons, because it doesn't do what the name suggests. GetGadgetItemText() is guilty too, since for ListIcons the whole row is the Item. GetGadgetItemText() could be enhanced with a #PB_Whole_Row option or we could have new functions:
GetListIconRow(), GetListIconColumn(), GetListIconCell()
Let's not say "everybody is used to using square wheels". Let's be ambitious and develop round wheels
I think it should be possible for the PB team to pluck bulk data from the memory. It's worth looking at.
DK_PETER ...we could have the functionality as dedicated ListIcon commands.
GetListIconText(), SetListIconText()
....GetGadgetText() is currently a misleading function name when applied to ListIcons, because it doesn't do what the name suggests. GetGadgetItemText() is guilty too, since for ListIcons the whole row is the Item. GetGadgetItemText() could be enhanced with a #PB_Whole_Row option or we could have new functions:
GetListIconRow(), GetListIconColumn(), GetListIconCell()
Let's not say "everybody is used to using square wheels". Let's be ambitious and develop round wheels
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.