Is there any way to just LOCK the column widths?
Lock Column width in #ListIconGadget
- Rook Zimbabwe
- Addict

- Posts: 4322
- Joined: Tue Jan 02, 2007 8:16 pm
- Location: Cypress TX
- Contact:
Lock Column width in #ListIconGadget
Aside from constantly checking the sizes of each column gadget in my program to insure that the user has not resized them... and then forcing them back to size...
Is there any way to just LOCK the column widths?
Is there any way to just LOCK the column widths?
- Fluid Byte
- Addict

- Posts: 2336
- Joined: Fri Jul 21, 2006 4:41 am
- Location: Berlin, Germany
Code: Select all
Procedure WindowCallback(hWnd,uMsg,wParam,lParam)
Select uMsg
Case #WM_NOTIFY
*lpnm.NMHDR = lParam
If *lpnm\hwndFrom = GetWindow_(GadgetID(0),#GW_CHILD) And *lpnm\code = #HDN_BEGINTRACK
ProcedureReturn 1
EndIf
EndSelect
ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure
OpenWindow(0,0,0,320,240,"void",#PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CreateGadgetList(WindowID(0))
ListIconGadget(0,0,0,320,240,"Name",160)
AddGadgetColumn(0,1,"Type",80)
AddGadgetColumn(0,1,"Size",60)
SetWindowCallback(@WindowCallback())
While WaitWindowEvent() ! #PB_Event_CloseWindow : WendWindows 10 Pro, 64-Bit / Whose Hoff is it anyway?
- netmaestro
- PureBasic Bullfrog

- Posts: 8452
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
@fluid byte, works fine but won't irritate the user nearly enough. Try this:
Code: Select all
OpenWindow(0,0,0,320,240,"void",#PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CreateGadgetList(WindowID(0))
ListIconGadget(0,0,0,320,240,"Name",160)
AddGadgetColumn(0,1,"Type",80)
AddGadgetColumn(0,1,"Size",60)
header = SendMessage_(GadgetID(0),#LVM_GETHEADER,0,0)
Repeat
ev = WaitWindowEvent(1)
GetWindowRect_(header, @wr.rect)
If PtInRect_(wr, DesktopMouseX(),DesktopMouseY())
ShowWindow_(header, #SW_HIDE)
dc = GetDC_(GadgetID(0))
TextOut_(dc, 100,0, PeekS(?begin), 15)
ReleaseDC_(GadgetID(0),dc)
Else
ShowWindow_(header, #SW_SHOW)
EndIf
Until ev = #WM_CLOSE
DataSection
begin:
Data.q 7453301692552738114,9400190730641523
Last edited by netmaestro on Fri Dec 21, 2007 4:05 am, edited 1 time in total.
BERESHEIT
- Rook Zimbabwe
- Addict

- Posts: 4322
- Joined: Tue Jan 02, 2007 8:16 pm
- Location: Cypress TX
- Contact:
- Fluid Byte
- Addict

- Posts: 2336
- Joined: Fri Jul 21, 2006 4:41 am
- Location: Berlin, Germany
Altough I was laughing hard netmaestros way has a flaw. It prevents header dragging and sorting. If you really want insist in limiting your gadet this way you can directly use #LVS_NOCOLUMNHEADER.
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
- netmaestro
- PureBasic Bullfrog

- Posts: 8452
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Keep going and we'll promote you to cane toad!
BTW, I didn't realise you could use PtInRect this way: PtInRect_(handle, x, y). My SDK says:
Code: Select all
BOOL PtInRect(
CONST RECT *lprc, // rectangle
POINT pt // point
);Dare2 cut down to size
- netmaestro
- PureBasic Bullfrog

- Posts: 8452
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada

