Images in listicongadgets columns
- marcoagpinto
- Addict
- Posts: 1045
- Joined: Sun Mar 10, 2013 3:01 pm
- Location: Portugal
- Contact:
Images in listicongadgets columns
We could use a command to place images in any column of a listicongadget.
Someone told me the code for Windows but it is huge and large to understand.
We could use a cross-platform solution.
Someone told me the code for Windows but it is huge and large to understand.
We could use a cross-platform solution.
- Fangbeast
- PureBasic Protozoa
- Posts: 4789
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: Images in listicongadgets columns
It's not huge (6 lines of code for the procedure +your icons???? Only if you add tons of icons to the imagelist for a gadget will the datasection grow (That's where I load my icons from) but it's not hard.
Fred said in another post to you that if he kept making solutions for everything, it would make the commandset huge and that would mean performance overheads (As far as I know).
I use simple code to put icons in every row provided for me years ago, in a lot of my programs and it is simple enough to understand with help (as I had lots of help) and never intend to do any other operating system.
To be perfectly honest, I'd rather get around my wishes with the API than get Fred to make too many commands and make me lazy. I'm lazy enough!!
Fred said in another post to you that if he kept making solutions for everything, it would make the commandset huge and that would mean performance overheads (As far as I know).
I use simple code to put icons in every row provided for me years ago, in a lot of my programs and it is simple enough to understand with help (as I had lots of help) and never intend to do any other operating system.
To be perfectly honest, I'd rather get around my wishes with the API than get Fred to make too many commands and make me lazy. I'm lazy enough!!
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
- marcoagpinto
- Addict
- Posts: 1045
- Joined: Sun Mar 10, 2013 3:01 pm
- Location: Portugal
- Contact:
Re: Images in listicongadgets columns
Fangbeast wrote:It's not huge (6 lines of code for the procedure +your icons???? Only if you add tons of icons to the imagelist for a gadget will the datasection grow (That's where I load my icons from) but it's not hard.
Fred said in another post to you that if he kept making solutions for everything, it would make the commandset huge and that would mean performance overheads (As far as I know).
I use simple code to put icons in every row provided for me years ago, in a lot of my programs and it is simple enough to understand with help (as I had lots of help) and never intend to do any other operating system.
To be perfectly honest, I'd rather get around my wishes with the API than get Fred to make too many commands and make me lazy. I'm lazy enough!!
Not 6 lines but 100:
http://www.purebasic.fr/english/viewtop ... 13&t=59807
- Fangbeast
- PureBasic Protozoa
- Posts: 4789
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: Images in listicongadgets columns
Code: Select all
Structure IconData ; Icon data structure
ListIconGadgetHeader.i ; This is the handle of the listicongadget image list
CatUnknown.i ; Unknown category icon
CatAeroplane.i ; Aeroplane icon
CatAmateur.i ; Amateur radio icon
CatAmbulance.i ; Ambulance icon
EndStructure
Global Icon.IconData ; Listicon icon replacements structure
Enumeration 1 ; I can refer to the loaded images anywhere in the program and load them to the image list
#CatUnknown
#CatAeroplane
#CatAmateur
#CatAmbulance
EndEnumeration
CatchImage(#CatUnknown, ?_CatUnknown) ; Load images into memory from the datasection references
CatchImage(#CatAeroplane, ?_CatAeroplane)
CatchImage(#CatAmateur, ?_CatAmateur)
CatchImage(#CatAmbulance, ?_CatAmbulance)
DataSection ; Datasection references
_CatUnknown: : IncludeBinary "Images\Category\Unknown.ico"
_CatAeroplane: : IncludeBinary "Images\Category\Aeroplane.ico"
_CatAmateur: : IncludeBinary "Images\Category\Amateur.ico"
_CatAmbulance: : IncludeBinary "Images\Category\Ambulance.ico"
EndDataSection
Declare ChangeIcon(MyGadget.i, MyRow.i, MyColumn.i, MyIcon.i); Update each collumn of a ListIconGadget with a user defined icon as needed
Declare BuildImageList() ; Rebuild the image list as it gets trashed by the clear command
Procedure
LVG.lv_item
LVG\mask = #LVIF_IMAGE | #LVIF_TEXT
LVG\iItem = MyRow.i
LVG\iSubItem = MyColumn.i
ChangeText.s = GetGadgetItemText(MyGadget.i, MyRow.i, MyColumn.i)
LVG\pszText = @ChangeText.s
LVG\iImage = MyIcon.i
SendMessage_(GadgetID(MyGadget.i), #LVM_SETITEM, 0, @LVG)
EndProcedure
Procedure BuildImageList() ; Rebuild the image list as it gets trashed by the clear command
If Program\ListIconGadgetHeader = 0 ; Add the deleted icon to the new imagelist
Program\ListIconGadgetHeader = ImageList_Create_(16, 16, #ILC_MASK | #ILC_COLOR32, 0, 4) ; 4 = number of icons we are adding
EndIf
Icon\CatUnknown = ImageList_ReplaceIcon_(Program\ListIconGadgetHeader, -1, ImageID(#CatUnknown)) ; Add the category icons to the new imagelist
Icon\CatAeroplane = ImageList_ReplaceIcon_(Program\ListIconGadgetHeader, -1, ImageID(#CatAeroplane))
Icon\CatAmateur = ImageList_ReplaceIcon_(Program\ListIconGadgetHeader, -1, ImageID(#CatAmateur))
Icon\CatAmbulance = ImageList_ReplaceIcon_(Program\ListIconGadgetHeader, -1, ImageID(#CatAmbulance))
SendMessage_(GadgetID(#MyGadgetName), #LVM_SETIMAGELIST, #LVSIL_SMALL, Program\ListIconGadgetHeader) ; Set the new imagelist to the gadget
ImageList_SetBkColor_(Program\ListIconGadgetHeader, #CLR_NONE) ; Set the icon background transparent
SendMessage_(GadgetID(#MyGadgetName), #LVM_SETEXTENDEDLISTVIEWSTYLE, #LVS_EX_SUBITEMIMAGES, #LVS_EX_SUBITEMIMAGES)
;
EndProcedure
;1 Open your window
;2 Run BuildImageList() to set the icons to the gadget that you want to have more icons for.
;3 Anywhere in your program, use this command:
;
; ChangeIcon(#MyGadget, LineNumberToChange.i, ColumnNumberToChange.i, Icon\CatUnKnown)
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
- marcoagpinto
- Addict
- Posts: 1045
- Joined: Sun Mar 10, 2013 3:01 pm
- Location: Portugal
- Contact:
Re: Images in listicongadgets columns
Thanks, Fangles.
But, can I replace icons with PNGs?
But, can I replace icons with PNGs?
- Fangbeast
- PureBasic Protozoa
- Posts: 4789
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: Images in listicongadgets columns
Don't know, suspect not with my setup but I think RASHAD came up with a solution in another post in answer to a question of mine.marcoagpinto wrote:Thanks, Fangles.
But, can I replace icons with PNGs?
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
Re: Images in listicongadgets columns
marcoagpinto wrote: Not 6 lines but 100:
http://www.purebasic.fr/english/viewtop ... 13&t=59807
But, can I replace icons with PNGs?
@marcoagpinto
Really dude...Convert the pngs to icons.
The purpose of programmming is to use the commandset
and create something. 100 lines is absolutely nothing! I find it extremely scary,
that some people, needs a new command for each 'bump' they stumble into.
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.
- marcoagpinto
- Addict
- Posts: 1045
- Joined: Sun Mar 10, 2013 3:01 pm
- Location: Portugal
- Contact:
Re: Images in listicongadgets columns
I have adapted the code and I get the error:
[16:15:25] [COMPILER] Line 12: The following variable doesn't have a 'Structure': Program.
Can you help?
Thanks!
Code: Select all
If Program\ListIconGadgetHeader = 0 ; Add the deleted icon to the new imagelist
Can you help?
Thanks!
- Fangbeast
- PureBasic Protozoa
- Posts: 4789
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: Images in listicongadgets columns
Sorry about that. I normally use another structure for program variables. I keep things like handles in ProgramData (Global Program\ProgramData and icons in IconData) In this case, changemarcoagpinto wrote:I have adapted the code and I get the error:
[16:15:25] [COMPILER] Line 12: The following variable doesn't have a 'Structure': Program.Code: Select all
If Program\ListIconGadgetHeader = 0 ; Add the deleted icon to the new imagelist
Can you help?
Thanks!
If Program\ListIconGadgetHeader = 0
to
If Icon\ListIconGadgetHeader = 0
Because I moved the header into that structure for your example.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
- marcoagpinto
- Addict
- Posts: 1045
- Joined: Sun Mar 10, 2013 3:01 pm
- Location: Portugal
- Contact:
Re: Images in listicongadgets columns
Hello
I have converted the images to icons, but I now get images in the first column and in the second:
Here are the icons:
https://dl.dropboxusercontent.com/u/30674540/icons.zip
The source code:
FangBeast,
Can you help?
Thanks!
Kind regards,
>Marco A.G.Pinto
---------------
I have converted the images to icons, but I now get images in the first column and in the second:
Here are the icons:
https://dl.dropboxusercontent.com/u/30674540/icons.zip
The source code:
Code: Select all
Declare weapons_types()
Declare ChangeIcon(MyGadget.i, MyRow.i, MyColumn.i, MyIcon.i); Update each collumn of a ListIconGadget with a user defined icon as needed
Declare BuildImageList(gadget_id) ; Rebuild the image list as it gets trashed by the clear command
; Enumeration
Enumeration 1
;- Icons for Weapons listicongadget by Fangbeast (forum user)
#CatUnknown
#CatAeroplane
#CatAmateur
#CatAmbulance
;- Window Weapons types
#WINDOW_WEAPONS
#LISTGADGET_WEAPONS
EndEnumeration
UsePNGImageDecoder()
ExamineDesktops()
Structure IconData ; Icon data structure
ListIconGadgetHeader.i ; This is the handle of the listicongadget image list
CatUnknown.i ; Unknown category icon
CatAeroplane.i ; Aeroplane icon
CatAmateur.i ; Amateur radio icon
CatAmbulance.i ; Ambulance icon
EndStructure
Global Icon.IconData ; Listicon icon replacements structure
; Load images into memory from the datasection references
LoadImage(#CatUnknown,"./weapons_types_na.ico")
LoadImage(#CatAeroplane,"./weapons_types_gun.ico")
LoadImage(#CatAmateur,"./weapons_types_explosive.ico")
LoadImage(#CatAmbulance,"./weapons_types_blade.ico")
; Open the main window
ExamineDesktops()
t=OpenWindow(#WINDOW_WEAPONS,0,0,1024,768,"Weapons Editor",#PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered | #PB_Window_Maximize)
If t=0 : MessageRequester("Error", "Can't open a window.") : EndIf
weapons_types()
Procedure weapons_types()
; Create List Icon Gadget
ListIconGadget(#LISTGADGET_WEAPONS,10,10,20+15+440+30+40+80+350,120+200-30-40-10-5,"ID",80-10-10,#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
AddGadgetColumn(#LISTGADGET_WEAPONS,1,"Type",40+20+15)
AddGadgetColumn(#LISTGADGET_WEAPONS,2,"Name",120+15+10+10)
; Run BuildImageList() to set the icons to the gadget that you want to have more icons for.
; Icons for Weapons listicongadget by Fangbeast (forum user)
BuildImageList(#LISTGADGET_WEAPONS)
t$="1"+Chr(10)+"N/A"+Chr(10)+"Unknown"
AddGadgetItem(#LISTGADGET_WEAPONS,-1,t$)
ChangeIcon(#LISTGADGET_WEAPONS,0,1,Icon\CatUnknown)
t$="2"+Chr(10)+"Gun"+Chr(10)+"Pistol"
AddGadgetItem(#LISTGADGET_WEAPONS,-1,t$)
ChangeIcon(#LISTGADGET_WEAPONS,1,1,Icon\CatAeroplane)
t$="3"+Chr(10)+"TNT"+Chr(10)+"Explosive"
AddGadgetItem(#LISTGADGET_WEAPONS,-1,t$)
ChangeIcon(#LISTGADGET_WEAPONS,2,1,Icon\CatAmateur)
t$="4"+Chr(10)+"Blade"+Chr(10)+"Knife"
AddGadgetItem(#LISTGADGET_WEAPONS,-1,t$)
ChangeIcon(#LISTGADGET_WEAPONS,3,1,Icon\CatAmbulance)
; Wait for the user to press the OKAY or CANCEL button
cancel=#False
Repeat
Event=WaitWindowEvent()
; Pressed the close gadget in the window
If Event=#PB_Event_CloseWindow
cancel=#True
EndIf
Until cancel=#True
EndProcedure
Procedure ChangeIcon(MyGadget.i, MyRow.i, MyColumn.i, MyIcon.i)
LVG.lv_item
LVG\mask = #LVIF_IMAGE | #LVIF_TEXT
LVG\iItem = MyRow.i
LVG\iSubItem = MyColumn.i
ChangeText.s = GetGadgetItemText(MyGadget.i, MyRow.i, MyColumn.i)
LVG\pszText = @ChangeText.s
LVG\iImage = MyIcon.i
SendMessage_(GadgetID(MyGadget.i), #LVM_SETITEM, 0, @LVG)
EndProcedure
Procedure BuildImageList(gadget_id) ; Rebuild the image list as it gets trashed by the clear command
If Icon\ListIconGadgetHeader = 0 ; Add the deleted icon to the new imagelist
Icon\ListIconGadgetHeader = ImageList_Create_(16, 16, #ILC_MASK | #ILC_COLOR32, 0, 4) ; 4 = number of icons we are adding
EndIf
Icon\CatUnknown = ImageList_ReplaceIcon_(Icon\ListIconGadgetHeader, -1, ImageID(#CatUnknown)) ; Add the category icons to the new imagelist
Icon\CatAeroplane = ImageList_ReplaceIcon_(Icon\ListIconGadgetHeader, -1, ImageID(#CatAeroplane))
Icon\CatAmateur = ImageList_ReplaceIcon_(Icon\ListIconGadgetHeader, -1, ImageID(#CatAmateur))
Icon\CatAmbulance = ImageList_ReplaceIcon_(Icon\ListIconGadgetHeader, -1, ImageID(#CatAmbulance))
SendMessage_(GadgetID(gadget_id), #LVM_SETIMAGELIST, #LVSIL_SMALL, Icon\ListIconGadgetHeader) ; Set the new imagelist to the gadget
ImageList_SetBkColor_(Icon\ListIconGadgetHeader, #CLR_NONE) ; Set the icon background transparent
SendMessage_(GadgetID(gadget_id), #LVM_SETEXTENDEDLISTVIEWSTYLE, #LVS_EX_SUBITEMIMAGES, #LVS_EX_SUBITEMIMAGES)
EndProcedure
FangBeast,
Can you help?
Thanks!
Kind regards,
>Marco A.G.Pinto
---------------
- Fangbeast
- PureBasic Protozoa
- Posts: 4789
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: Images in listicongadgets columns
Code: Select all
Declare ChangeIcon(MyGadget.i, MyRow.i, MyColumn.i, MyIcon.i)
Declare BuildImageList()
Enumeration 1
#CatUnknown
#CatAeroplane
#CatAmateur
#CatAmbulance
#WINDOW_WEAPONS
#LISTGADGET_WEAPONS
EndEnumeration
UsePNGImageDecoder()
Structure IconData ; Icon data structure
ListIconGadgetHeader.i ; This is the handle of the listicongadget image list
CatUnknown.i ; Unknown category icon
CatAeroplane.i ; Aeroplane icon
CatAmateur.i ; Amateur radio icon
CatAmbulance.i ; Ambulance icon
EndStructure
Global Icon.IconData
LoadImage(#CatUnknown, "Images\weapons_types_na.ico")
LoadImage(#CatAeroplane, "Images\weapons_types_gun.ico")
LoadImage(#CatAmateur, "Images\weapons_types_explosive.ico")
LoadImage(#CatAmbulance, "Images\weapons_types_blade.ico")
Procedure ChangeIcon(MyGadget.i, MyRow.i, MyColumn.i, MyIcon.i)
LVG.lv_item
LVG\mask = #LVIF_IMAGE | #LVIF_TEXT
LVG\iItem = MyRow.i
LVG\iSubItem = MyColumn.i
ChangeText.s = GetGadgetItemText(MyGadget.i, MyRow.i, MyColumn.i)
LVG\pszText = @ChangeText.s
LVG\iImage = MyIcon.i
SendMessage_(GadgetID(MyGadget.i), #LVM_SETITEM, 0, @LVG)
EndProcedure
Procedure BuildImageList()
If Icon\ListIconGadgetHeader = 0
Icon\ListIconGadgetHeader = ImageList_Create_(16, 16, #ILC_MASK | #ILC_COLOR32, 0, 4)
EndIf
Icon\CatUnknown = ImageList_ReplaceIcon_(Icon\ListIconGadgetHeader, -1, ImageID(#CatUnknown))
Icon\CatAeroplane = ImageList_ReplaceIcon_(Icon\ListIconGadgetHeader, -1, ImageID(#CatAeroplane))
Icon\CatAmateur = ImageList_ReplaceIcon_(Icon\ListIconGadgetHeader, -1, ImageID(#CatAmateur))
Icon\CatAmbulance = ImageList_ReplaceIcon_(Icon\ListIconGadgetHeader, -1, ImageID(#CatAmbulance))
SendMessage_(GadgetID(#LISTGADGET_WEAPONS), #LVM_SETIMAGELIST, #LVSIL_SMALL, Icon\ListIconGadgetHeader)
ImageList_SetBkColor_(Icon\ListIconGadgetHeader, #CLR_NONE)
SendMessage_(GadgetID(#LISTGADGET_WEAPONS), #LVM_SETEXTENDEDLISTVIEWSTYLE, #LVS_EX_SUBITEMIMAGES, #LVS_EX_SUBITEMIMAGES)
EndProcedure
If OpenWindow(#WINDOW_WEAPONS, 0, 0, 1024, 768, "Weapons Editor", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered | #PB_Window_Maximize) <> 0
ListIconGadget(#LISTGADGET_WEAPONS, 10, 10, 975, 235, "ID", 60, #PB_ListIcon_FullRowSelect | #PB_ListIcon_AlwaysShowSelection)
AddGadgetColumn(#LISTGADGET_WEAPONS, 1, "Type", 75)
AddGadgetColumn(#LISTGADGET_WEAPONS, 2, "Name", 155)
BuildImageList()
AddGadgetItem(#LISTGADGET_WEAPONS, -1, "1" + Chr(10) + "N/A" + Chr(10) + "Unknown")
ChangeIcon(#LISTGADGET_WEAPONS, 0, 0, Icon\CatUnknown)
AddGadgetItem(#LISTGADGET_WEAPONS, -1, "2" + Chr(10) + "Gun" + Chr(10) + "Pistol")
ChangeIcon(#LISTGADGET_WEAPONS, 1, 0, Icon\CatAeroplane)
AddGadgetItem(#LISTGADGET_WEAPONS, -1, "3" + Chr(10) + "TNT" + Chr(10) + "Explosive")
ChangeIcon(#LISTGADGET_WEAPONS, 2, 0, Icon\CatAmateur)
AddGadgetItem(#LISTGADGET_WEAPONS, -1, "4" + Chr(10) + "Blade" + Chr(10) + "Knife")
ChangeIcon(#LISTGADGET_WEAPONS, 3, 0, Icon\CatAmbulance)
cancel = #False
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_CloseWindow
cancel = #True
EndIf
Until cancel = #True
Else
MessageRequester("Error", "Can't open a window.")
EndIf
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
- marcoagpinto
- Addict
- Posts: 1045
- Joined: Sun Mar 10, 2013 3:01 pm
- Location: Portugal
- Contact:
Re: Images in listicongadgets columns
Buaaaaaaaaaa...Fangbeast wrote:Code: Select all
Declare ChangeIcon(MyGadget.i, MyRow.i, MyColumn.i, MyIcon.i) Declare BuildImageList() Enumeration 1 #CatUnknown #CatAeroplane #CatAmateur #CatAmbulance #WINDOW_WEAPONS #LISTGADGET_WEAPONS EndEnumeration UsePNGImageDecoder() Structure IconData ; Icon data structure ListIconGadgetHeader.i ; This is the handle of the listicongadget image list CatUnknown.i ; Unknown category icon CatAeroplane.i ; Aeroplane icon CatAmateur.i ; Amateur radio icon CatAmbulance.i ; Ambulance icon EndStructure Global Icon.IconData LoadImage(#CatUnknown, "Images\weapons_types_na.ico") LoadImage(#CatAeroplane, "Images\weapons_types_gun.ico") LoadImage(#CatAmateur, "Images\weapons_types_explosive.ico") LoadImage(#CatAmbulance, "Images\weapons_types_blade.ico") Procedure ChangeIcon(MyGadget.i, MyRow.i, MyColumn.i, MyIcon.i) LVG.lv_item LVG\mask = #LVIF_IMAGE | #LVIF_TEXT LVG\iItem = MyRow.i LVG\iSubItem = MyColumn.i ChangeText.s = GetGadgetItemText(MyGadget.i, MyRow.i, MyColumn.i) LVG\pszText = @ChangeText.s LVG\iImage = MyIcon.i SendMessage_(GadgetID(MyGadget.i), #LVM_SETITEM, 0, @LVG) EndProcedure Procedure BuildImageList() If Icon\ListIconGadgetHeader = 0 Icon\ListIconGadgetHeader = ImageList_Create_(16, 16, #ILC_MASK | #ILC_COLOR32, 0, 4) EndIf Icon\CatUnknown = ImageList_ReplaceIcon_(Icon\ListIconGadgetHeader, -1, ImageID(#CatUnknown)) Icon\CatAeroplane = ImageList_ReplaceIcon_(Icon\ListIconGadgetHeader, -1, ImageID(#CatAeroplane)) Icon\CatAmateur = ImageList_ReplaceIcon_(Icon\ListIconGadgetHeader, -1, ImageID(#CatAmateur)) Icon\CatAmbulance = ImageList_ReplaceIcon_(Icon\ListIconGadgetHeader, -1, ImageID(#CatAmbulance)) SendMessage_(GadgetID(#LISTGADGET_WEAPONS), #LVM_SETIMAGELIST, #LVSIL_SMALL, Icon\ListIconGadgetHeader) ImageList_SetBkColor_(Icon\ListIconGadgetHeader, #CLR_NONE) SendMessage_(GadgetID(#LISTGADGET_WEAPONS), #LVM_SETEXTENDEDLISTVIEWSTYLE, #LVS_EX_SUBITEMIMAGES, #LVS_EX_SUBITEMIMAGES) EndProcedure If OpenWindow(#WINDOW_WEAPONS, 0, 0, 1024, 768, "Weapons Editor", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered | #PB_Window_Maximize) <> 0 ListIconGadget(#LISTGADGET_WEAPONS, 10, 10, 975, 235, "ID", 60, #PB_ListIcon_FullRowSelect | #PB_ListIcon_AlwaysShowSelection) AddGadgetColumn(#LISTGADGET_WEAPONS, 1, "Type", 75) AddGadgetColumn(#LISTGADGET_WEAPONS, 2, "Name", 155) BuildImageList() AddGadgetItem(#LISTGADGET_WEAPONS, -1, "1" + Chr(10) + "N/A" + Chr(10) + "Unknown") ChangeIcon(#LISTGADGET_WEAPONS, 0, 0, Icon\CatUnknown) AddGadgetItem(#LISTGADGET_WEAPONS, -1, "2" + Chr(10) + "Gun" + Chr(10) + "Pistol") ChangeIcon(#LISTGADGET_WEAPONS, 1, 0, Icon\CatAeroplane) AddGadgetItem(#LISTGADGET_WEAPONS, -1, "3" + Chr(10) + "TNT" + Chr(10) + "Explosive") ChangeIcon(#LISTGADGET_WEAPONS, 2, 0, Icon\CatAmateur) AddGadgetItem(#LISTGADGET_WEAPONS, -1, "4" + Chr(10) + "Blade" + Chr(10) + "Knife") ChangeIcon(#LISTGADGET_WEAPONS, 3, 0, Icon\CatAmbulance) cancel = #False Repeat Event = WaitWindowEvent() If Event = #PB_Event_CloseWindow cancel = #True EndIf Until cancel = #True Else MessageRequester("Error", "Can't open a window.") EndIf
It still doesn't work.
I want the icons to appear in column 1 and not in column 0.
For column 0 I could have used the PureBasic command that exists...
Could someone help?
Thanks!
- Fangbeast
- PureBasic Protozoa
- Posts: 4789
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: Images in listicongadgets columns
Marco, stop PMing me and then repeating the same thing here, and try to do some testing yourself before complaining that it doesn't work.
The ChangeIcon command is easy enough to use and you could have tested it a bit more or do you want me to do everything for you?
You didn't say which column before, just that both columns were being filled.
Use the ChangeIcon command for all columns or you are going to be mixed up.
I gave you the routine to do it, what's wrong with it?
MyGadget.i ; The gadget constant to use
MyRow.i ; The row number to change the icon in
MyColumn.i ; The column number to change the icon in
MyIcon.i ; The icon to use
Why aren't you just trying it?
The ChangeIcon command is easy enough to use and you could have tested it a bit more or do you want me to do everything for you?
You didn't say which column before, just that both columns were being filled.
Use the ChangeIcon command for all columns or you are going to be mixed up.
I gave you the routine to do it, what's wrong with it?
Code: Select all
ChangeIcon(MyGadget.i, MyRow.i, MyColumn.i, MyIcon.i)
MyRow.i ; The row number to change the icon in
MyColumn.i ; The column number to change the icon in
MyIcon.i ; The icon to use
Why aren't you just trying it?
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
- marcoagpinto
- Addict
- Posts: 1045
- Joined: Sun Mar 10, 2013 3:01 pm
- Location: Portugal
- Contact:
Re: Images in listicongadgets columns
Sorry... I have just PM'ed you and only now I read you were angry with that... sorry...Fangbeast wrote:Marco, stop PMing me and then repeating the same thing here, and try to do some testing yourself before complaining that it doesn't work.
The ChangeIcon command is easy enough to use and you could have tested it a bit more or do you want me to do everything for you?
You didn't say which column before, just that both columns were being filled.
Use the ChangeIcon command for all columns or you are going to be mixed up.
I gave you the routine to do it, what's wrong with it?
MyGadget.i ; The gadget constant to useCode: Select all
ChangeIcon(MyGadget.i, MyRow.i, MyColumn.i, MyIcon.i)
MyRow.i ; The row number to change the icon in
MyColumn.i ; The column number to change the icon in
MyIcon.i ; The icon to use
Why aren't you just trying it?
I am trying the command to add icons to column number 1, but icons appear in number 0:

I am using PB 5.30.
Thanks for all your help!
- Fangbeast
- PureBasic Protozoa
- Posts: 4789
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: Images in listicongadgets columns
Code: Select all
ChangeIcon(MyGadget.i, MyRow.i, MyColumn.i, MyIcon.i)
MyRow.i ; The row number to change the icon in
MyColumn.i ; The column number to change the icon in
MyIcon.i ; The icon to use
Marco, I am not angry. You just don't have to pm me and then post the same thing in the forum as well. Keep programming things in the forum where they belong so others can see it and help.
As for showing in two columns, I explained the ChangeIcon options above, the fixed code I gave you should work on 5.3, they work here.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet