#Image_appointment_date is the main icon used in collumn 0 when the gadget is initally populated. Code example below (main program is getting a bit big to constantly repost)
Code: Select all
Procedure ChangeIcon(mygadget.l, myrow.l, mycolumn.l, myicon.l)
LVG.lv_item
LVG\mask = #LVIF_IMAGE | #LVIF_TEXT
LVG\iItem = myrow
LVG\iSubItem = mycolumn
changetext.s = GetGadgetItemText(mygadget, myrow, mycolumn)
LVG\pszText = @changetext.s
LVG\iImage = myicon
SendMessage_(GadgetID(mygadget), #LVM_SETITEM, 0, @LVG)
EndProcedure
Enumeration
#Image_appointment_date
#Image_appointment_time
#Image_appointment_category
#Image_appointment_notes
EndEnumeration
;=======================
; Grab the images to memory for use
;=======================
CatchImage(#Image_appointment_date, ?_PTK_appointment_date)
CatchImage(#Image_appointment_time, ?_PTK_appointment_time)
CatchImage(#Image_appointment_category, ?_PTK_appointment_category)
CatchImage(#Image_appointment_notes, ?_PTK_appointment_notes)
;==============================================================================================================================
; Any stored and included data
;==============================================================================================================================
DataSection
_PTK_appointment_date : IncludeBinary "Images\date.ico"
_PTK_appointment_time : IncludeBinary "Images\time.ico"
_PTK_appointment_category : IncludeBinary "Images\category.ico"
_PTK_appointment_notes : IncludeBinary "Images\notes.ico"
EndDataSection
;-------------------------------------------------------------------------
; Create a new image list and add icons to it.
;-------------------------------------------------------------------------
hImgList.l = ImageList_Create_(16, 16, #ILC_MASK | #ILC_COLOR32, 0, 15)
timeicon.l = ImageList_ReplaceIcon_(hImgList, -1, UseImage(#Image_appointment_time))
categoryicon.l = ImageList_ReplaceIcon_(hImgList, -1, UseImage(#Image_appointment_category))
notesicon.l = ImageList_ReplaceIcon_(hImgList, -1, UseImage(#Image_appointment_notes))
SendMessage_(GadgetID(#Gadget_appointment_appointments), #LVM_SETIMAGELIST,#LVSIL_SMALL, hImgList)
ImageList_SetBkColor_(hImgList, #CLR_NONE)
SendMessage_(GadgetID(#Gadget_appointment_appointments), #LVM_SETEXTENDEDLISTVIEWSTYLE, #LVS_EX_SUBITEMIMAGES, #LVS_EX_SUBITEMIMAGES)
First add the item to my gadget..
Code: Select all
AddGadgetItem(#Gadget_appointment_appointments, -1, LineIn.s, UseImage(#Image_appointment_date))
Code: Select all
program\counter + 1 ; Track items in my list
ChangeIcon(#Gadget_appointment_appointments, program\counter - 1, 1, timeicon)
ChangeIcon(#Gadget_appointment_appointments, program\counter - 1, 2, categoryicon)
ChangeIcon(#Gadget_appointment_appointments, program\counter - 1, 3, notesicon)