ListIconGadget - Callback procedure to detect column header

Just starting out? Need help? Post your questions and find answers here.
Holly
User
User
Posts: 10
Joined: Sat May 24, 2003 6:05 am
Location: Tampa, Florida

Post by Holly »

Is there a way to lock the width of the columns in the ListIconGadget so that users cannot adjust the width with their mouse? Thanks.
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Post by rsts »

Sorry for the post - I think I was able to find an example which met my needs.

Hi,
I'm looking for an example to let me determine when a listicongadget column header has been clicked and which one has been clicked.

I've changed the examples above so they will compile and run under PB 4, but once they run and I make any selection (actually click anywhere) the window just goes dead and I have to kill the program.

Anyone who can make one of these work or provide a working example of selecting a column header based on clicking it? Or point me to a working example - I've been searching for quite a while, and this is the best I could come up with.

cheers

Edit - the one below sems to be hanging on the messagerequester, but once i disable that, it seems to meet my needs.

Guess I should have checked messagerequester earlier.

Procedure wndproc(hwnd,msg,wParam,lParam)
Shared hlv
ret=#PB_ProcessPureBasicEvents

Select msg

Case #WM_NOTIFY
*pnmhdr.NMHDR=lParam
If *pnmhdr\code=#LVN_COLUMNCLICK ;column click
*pnmlistview.NMLISTVIEW=lParam
If *pnmlistview\hdr\hwndFrom=hlv ;comes from our listicon
Column=*pnmlistview\iSubItem
MessageRequester("",Str(Column),0)
EndIf
EndIf

EndSelect
ProcedureReturn ret
EndProcedure


hwnd=OpenWindow(0,100,100,300,150,"Column Click",#PB_Window_SystemMenu)
CreateGadgetList(hwnd)

hlv=ListIconGadget(1,10,10,250,100,"Column 0",80)

AddGadgetColumn(1,1,"Column 1",80)
AddGadgetColumn(1,2,"Column 2",80)

SetWindowCallback(@wndproc())

Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow
Post Reply