Page 1 of 2

Images in listicongadgets columns

Posted: Fri Jul 25, 2014 12:35 pm
by marcoagpinto
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.

Re: Images in listicongadgets columns

Posted: Fri Jul 25, 2014 12:51 pm
by Fangbeast
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!!

Re: Images in listicongadgets columns

Posted: Fri Jul 25, 2014 1:24 pm
by marcoagpinto
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

Re: Images in listicongadgets columns

Posted: Fri Jul 25, 2014 1:47 pm
by Fangbeast

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)
Don't know if this makes sense to you.

Re: Images in listicongadgets columns

Posted: Fri Jul 25, 2014 1:52 pm
by marcoagpinto
Thanks, Fangles.

But, can I replace icons with PNGs?

Re: Images in listicongadgets columns

Posted: Fri Jul 25, 2014 2:15 pm
by Fangbeast
marcoagpinto wrote:Thanks, Fangles.

But, can I replace icons with PNGs?
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.

Re: Images in listicongadgets columns

Posted: Fri Jul 25, 2014 3:58 pm
by DK_PETER
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.

Re: Images in listicongadgets columns

Posted: Fri Jul 25, 2014 4:16 pm
by marcoagpinto
I have adapted the code and I get the error:

Code: Select all

  If Program\ListIconGadgetHeader = 0   ; Add the deleted icon to the new imagelist
[16:15:25] [COMPILER] Line 12: The following variable doesn't have a 'Structure': Program.

Can you help?

Thanks!

Re: Images in listicongadgets columns

Posted: Fri Jul 25, 2014 11:00 pm
by Fangbeast
marcoagpinto wrote:I have adapted the code and I get the error:

Code: Select all

  If Program\ListIconGadgetHeader = 0   ; Add the deleted icon to the new imagelist
[16:15:25] [COMPILER] Line 12: The following variable doesn't have a 'Structure': Program.

Can you help?

Thanks!
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, change

If Program\ListIconGadgetHeader = 0

to

If Icon\ListIconGadgetHeader = 0

Because I moved the header into that structure for your example.

Re: Images in listicongadgets columns

Posted: Sun Jul 27, 2014 10:01 am
by marcoagpinto
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:

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
---------------

Re: Images in listicongadgets columns

Posted: Sun Jul 27, 2014 12:03 pm
by Fangbeast

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


Re: Images in listicongadgets columns

Posted: Sun Jul 27, 2014 11:37 pm
by marcoagpinto
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

Buaaaaaaaaaa...

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!

Re: Images in listicongadgets columns

Posted: Mon Jul 28, 2014 1:43 am
by Fangbeast
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?

Code: Select all

ChangeIcon(MyGadget.i, MyRow.i, MyColumn.i, MyIcon.i)
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?

Re: Images in listicongadgets columns

Posted: Mon Jul 28, 2014 8:48 am
by marcoagpinto
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?

Code: Select all

ChangeIcon(MyGadget.i, MyRow.i, MyColumn.i, MyIcon.i)
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?
Sorry... I have just PM'ed you and only now I read you were angry with that... sorry...

I am trying the command to add icons to column number 1, but icons appear in number 0:
Image

I am using PB 5.30.

Thanks for all your help!

Re: Images in listicongadgets columns

Posted: Mon Jul 28, 2014 9:03 am
by Fangbeast

Code: Select all

ChangeIcon(MyGadget.i, MyRow.i, MyColumn.i, MyIcon.i)
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

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.