Posted: Thu Mar 15, 2007 2:29 am
Holy slow coach, beaten by the deadly duo; batman + netmaestro yet again!
Oh well, I'll post what I hacked up anyhow:
@Joakim Christiansen: to alleviate your AddGadgetItem() woes, you could simply use AddGadgetItem() with an empty string and then set individual cells with SetGadgetItemText() etc. This might be slightly less problematic.

Oh well, I'll post what I hacked up anyhow:
Code: Select all
#LVM_GETHEADER = #LVM_FIRST+31
Procedure.l callback(hWnd, uMsg, wParam, lParam)
result = #PB_ProcessPureBasicEvents
Select uMsg
Case #WM_NOTIFY
*nmh.NMHDR=lParam
Select *nmh\code
Case #NM_RCLICK
If *nmh\hwndFrom = SendMessage_(GadgetID(0),#LVM_GETHEADER,0,0)
;Now identify which item was clicked.
GetCursorPos_(hdhittest.HD_HITTESTINFO\pt)
ScreenToClient_(*nmh\hwndFrom, hdhittest\pt)
SendMessage_(*nmh\hwndFrom, #HDM_HITTEST, 0, @hdhittest)
Debug "Clicked header item " + Str(hdhittest\iItem)
EndIf
EndSelect
EndSelect
ProcedureReturn result
EndProcedure
If OpenWindow(0, 100, 100, 300, 100, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If CreateGadgetList(WindowID(0))
ListIconGadget(0, 5, 5, 290, 90, "Name", 100, #PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
AddGadgetColumn(0, 1, "Address", 250)
AddGadgetItem(0, -1, "Harry Rannit"+Chr(10)+"12 Parliament Way, Battle Street, By the Bay")
AddGadgetItem(0, -1, "Ginger Brokeit"+Chr(10)+"130 PureBasic Road, BigTown, CodeCity")
SetWindowCallback(@callback())
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
EndIf