Processing in #HDN_BEGINTRACK notification does not prevent a double click on a divider.
Double-click is possible by positioning the mouse cursor exactly on the 4th divider, and it expands the hidden column.
Therefore, it is better to process #HDN_ITEMCHANGING notification.
Code: Select all
Procedure WindowCallback(hWnd,uMsg,wParam,lParam)
result=#PB_ProcessPureBasicEvents
Select uMsg
Case #WM_NOTIFY
*lpnm.NMHEADER = lParam
If *lpnm\hdr\hwndFrom = GetWindow_(GadgetID(0),#GW_CHILD) And *lpnm\hdr\code = #HDN_BEGINTRACK And *lpnm\iItem = 3
Debug "Start the divider drag."
EndIf
If *lpnm\hdr\hwndFrom = GetWindow_(GadgetID(0),#GW_CHILD) And *lpnm\hdr\code = #HDN_DIVIDERDBLCLICK And *lpnm\iItem = 3
Debug "The divider double-clicked."
EndIf
If *lpnm\hdr\hwndFrom = GetWindow_(GadgetID(0),#GW_CHILD) And *lpnm\hdr\code = #HDN_ITEMCHANGING And *lpnm\iItem = 3
ProcedureReturn 1
EndIf
EndSelect
ProcedureReturn result
EndProcedure
OpenWindow(0,0,0,320,240,"ListIcon",#PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ListIconGadget(0,0,0,320,240,"Name",80,#PB_ListIcon_GridLines)
AddGadgetColumn(0,1,"Type",80)
AddGadgetColumn(0,2,"Size",80)
AddGadgetColumn(0,3,"Hidden",0) ; Never want this column to be seen.
For i=1 To 5
AddGadgetItem(0,-1,"Name"+#LF$+"Type"+#LF$+"Size"+#LF$+"Hidden")
Next
SetWindowCallback(@WindowCallback())
While WaitWindowEvent() ! #PB_Event_CloseWindow : Wend