Code: Select all
Structure linkdata
index$
link$
EndStructure
Global NewMap links.linkdata()
Procedure LVProc(hwnd, msg, wparam, lparam)
oldproc = GetProp_(hwnd, "oldproc")
gadget = GetDlgCtrlID_(hwnd)
Static lastitem=-1, lastsubitem=-1
Select msg
Case #WM_NCDESTROY
RemoveProp_(hwnd, "oldproc")
Case #WM_MOUSEMOVE
GetCursorPos_(@cp.POINT)
MapWindowPoints_(0,hwnd,@cp,1)
HitInfo.LVHITTESTINFO
Hitinfo\pt\x = cp\x
HitInfo\pt\y = cp\y
SendMessage_(hwnd,#LVM_SUBITEMHITTEST ,0,@HitInfo)
item = HitInfo\iItem
subitem = HitInfo\iSubItem
If item<>lastitem Or subitem<>lastsubitem
SetGadgetItemColor(gadget,lastitem,#PB_Gadget_FrontColor,#Blue,2)
lastitem = item
lastsubitem = subitem
If subitem = 2 And item >=0
SetGadgetItemColor(gadget,item,#PB_Gadget_FrontColor,#Red,2)
EndIf
EndIf
Case #WM_LBUTTONDOWN
GetCursorPos_(@cp.POINT)
MapWindowPoints_(0,hwnd,@cp,1)
HitInfo.LVHITTESTINFO
Hitinfo\pt\x = cp\x
HitInfo\pt\y = cp\y
SendMessage_(hwnd,#LVM_SUBITEMHITTEST ,0,@HitInfo)
item = HitInfo\iItem
subitem = HitInfo\iSubItem
If subitem = 2 And item>=0
Debug links(Str(GetGadgetItemData(gadget, item)))\link$
EndIf
EndSelect
ProcedureReturn CallWindowProc_(oldproc, hwnd, msg, wparam, lparam)
EndProcedure
OpenWindow(0,0,0,640,480,"",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
ListIconGadget(0,0,0,640,480,"Column 0", 155,#PB_ListIcon_GridLines)
SetProp_(GadgetID(0),"oldproc",SetWindowLongPtr_(GadgetID(0),#GWL_WNDPROC,@LVProc()))
AddGadgetColumn(0, 1, "Column 1", 155)
AddGadgetColumn(0, 2, "Column 2", 65)
AddGadgetColumn(0, 3, "Column 3", 245)
For i=0 To 20
AddGadgetItem(0, -1, "Stuff"+Chr(10)+"Things"+Chr(10)+"[Link "+Str(i)+"]"+Chr(10)+"Items")
SetGadgetItemColor(0,i,#PB_Gadget_FrontColor,#Blue,2)
SetGadgetItemData(0, i, i) ; necessary to preserve index on sorts or deletions
links(Str(i))\link$ = "Target --> "+Str(i)
Next
Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow
This is just one approach, there are several to choose from in presenting the link and storage-retrieval of targets. You could use hyperlink gadgets inside the listicon for example. I'm trying to keep it simple.