OK, I tried this out. And I get almost the same behavior. I am able to edit the first column -- regardless of what I click on, I always get the edit box in the first column.
I changed
If NewText > "" Then ModifyGadgetItem(Explorer,DispInfo.iItem,NewText,Explorer.items[DispInfo.iItem].flags,Explorer.items[DispInfo.iItem].icon,Explorer.items[DispInfo.iItem].tip)
to
If NewText > "" Then SetListBoxItem(explorer,NewText,DispInfo.iItem,column)
Then I manually set 'column' to various other values, and was able to change the text in other columns. But the edit box still appears on the first column.
I added a function to toggle LVS_EX_FULLROWSELECT. When it's turned off, you can't even click on columns other than the first one.
iSubItem is a field in tagNMLVDISPINFO, but it always seems to be 0. If it was returned, then it seems like I'd be able to tell which column to change...
I also notice that when I edit that first column, it blows away the rest of the columns in that row -- but that's easy enough to work around since they are sourced from data elsewhere.
Here's where I stand right now. A double-click in the grid area will toggle the full-row select on and off (you can change LVS_EX_FULLROWSELECT to LVS_EX_GRIDLINES to toggle the grid on and off).
Strict
' Listbox Item edit Text and Drag 'n Drop example.
' Ziltch 29 August 2006.
' You can use this code if you credit Ziltch!
' More stuff added by Raph
Extern "win32"
Function GetSysColor(index)
Function UpdateWindow(Hwd)
Function GetLogicalDriveStringsA(nBufferLength, lpBuffer:Byte Ptr)
Function SHGetSpecialFolderLocation(hwndOwner, nFolder, pIdl:Byte Ptr)
Function SHGetPathFromIDList( pidList ,lpBuffer:Byte Ptr)
Function GetWindowLong :Int(hWnd ,nIndex)= "GetWindowLongA@8"
Function GetActiveWindow :Int()= "GetActiveWindow@0"
Function SetWindowLongPtr :Int(hWnd ,nIndex,lNewLong:Byte Ptr )= "SetWindowLongA@12"
Function CallWindowProc:Int(lpPrevWndFunc,hWnd,uMsg,wParam,lParam) = "CallWindowProcA@20"
Function ImageList_BeginDrag( himlTrack, iTrack, dxHotspot, dyHotspot)
Function ImageList_DragShowNolock(fShow)
Function ImageList_DragMove(x,y)
Function SetCapture(GadgetHwd)
Function ChildWindowFromPoint(GadgetHwd, X, Y)
Function ReleaseCapture()
Function ImageList_EndDrag()
Function ImageList_Destroy(DragImageHwd:Byte Ptr)
EndExtern
Const HDN_ITEMCLICK = -302
Const GWL_WNDPROC = -4
Const WM_USER = $400
Const WM_NOTIFY = 78
Const IDCOMBOBOX = WM_USER + 102
Const GENERIC_READ = $80000000
Const GENERIC_WRITE = $40000000
Const FILE_SHARE_READ = 1
Const FILE_SHARE_WRITE = 2
Const OPEN_EXISTING = 3
Const CSIDL_FONTS = $14
Const WS_BORDER = $800000
Const WS_CAPTION = $c00000
Const WS_CHILD = $40000000
Const WS_CHILDWINDOW = $40000000
Const WS_CLIPCHILDREN = $2000000
Const WS_CLIPSIBLINGS = $4000000
Const WS_DISABLED = $8000000
Const WS_DLGFRAME = $400000
Const WS_GROUP = $20000
Const WS_HSCROLL = $100000
Const WS_ICONIC = $20000000
Const WS_MAXIMIZE = $1000000
Const WS_MAXIMIZEBOX = $10000
Const WS_MINIMIZE = $20000000
Const WS_MINIMIZEBOX = $20000
Const WS_OVERLAPPED = 0
Const WS_OVERLAPPEDWINDOW = $cf0000
Const WS_POPUP = $80000000
Const WS_POPUPWINDOW = $80880000
Const WS_SIZEBOX = $40000
Const WS_SYSMENU = $80000
Const WS_TABSTOP = $10000
Const WS_THICKFRAME = $40000
Const WS_TILED = 0
Const WS_TILEDWINDOW = $cf0000
Const WS_VISIBLE = $10000000
Const WS_VSCROLL = $200000
Const LBS_DISABLENOSCROLL = 4096
Const LBS_EXTENDEDSEL = $800
Const LBS_HASSTRINGS = 64
Const LBS_MULTICOLUMN = 512
Const LBS_MULTIPLESEL = 8
Const LBS_NODATA = $2000
Const LBS_NOINTEGRALHEIGHT = 256
Const LBS_NOREDRAW = 4
Const LBS_NOSEL = $4000
Const LBS_NOTIFY = 1
Const LBS_OWNERDRAWFIXED = 16
Const LBS_OWNERDRAWVARIABLE = 32
Const LBS_SORT = 2
Const LBS_STANDARD = $a00003
Const LBS_USETABSTOPS = 128
Const LBS_WANTKEYBOARDINPUT = $400
Const LVM_FIRST = $1000
Const LVM_GETCOLUMNA = (LVM_FIRST+25)
Const LVM_GETCOLUMNW = (LVM_FIRST+95)
Const LVM_SETCOLUMNA = (LVM_FIRST+26)
Const LVM_SETCOLUMNW = (LVM_FIRST+96)
Const LVM_INSERTCOLUMNA = (LVM_FIRST+27)
Const LVM_INSERTCOLUMNW = (LVM_FIRST+97)
Const LVM_DELETECOLUMN = (LVM_FIRST+28)
Const LVM_GETCOLUMNWIDTH = (LVM_FIRST+29)
Const LVM_GETITEMA = (LVM_FIRST+5)
Const LVM_GETITEMW = (LVM_FIRST+75)
Const LVM_SETITEMA = (LVM_FIRST+6)
Const LVM_SETITEMW = (LVM_FIRST+76)
Const LVM_INSERTITEMA = (LVM_FIRST+7)
Const LVM_INSERTITEMW = (LVM_FIRST+77)
Const LVM_DELETEITEM = (LVM_FIRST+8)
Const LVM_DELETEALLITEMS = (LVM_FIRST+9)
Const LVM_GETCALLBACKMASK= (LVM_FIRST+10)
Const LVM_SETCALLBACKMASK= (LVM_FIRST+11)
Const LVM_SETCOLUMNWIDTH = (LVM_FIRST+30)
Const LVM_GETTEXTCOLOR = (LVM_FIRST+35)
'Const LVM_SETTEXTCOLOR = (LVM_FIRST+36)
Const LVM_GETTEXTBKCOLOR = (LVM_FIRST+37)
'Const LVM_SETTEXTBKCOLOR = (LVM_FIRST+38)
Const LVM_SORTITEMS = (LVM_FIRST+48)
Const LVM_SETLISTBOXEXSTYLE = (LVM_FIRST+54)
Const LVM_GETLISTBOXEXSTYLE = (LVM_FIRST+55)
Const LVM_ARRANGE =(LVM_FIRST+22)
Const LVM_EDITLABELA =(LVM_FIRST+23)
Const LVM_EDITLABELW =(LVM_FIRST+118)
Const LVM_GETEDITCONTROL =(LVM_FIRST+24)
Const LVM_CREATEDRAGIMAGE = (LVM_FIRST + 33)
Const LVM_HITTEST = (LVM_FIRST + 18)
Const LVCF_FMT =1
Const LVCF_WIDTH =2
Const LVCF_TEXT =4
Const LVCF_SUBITEM =8
' #define LVCF_IMAGE 16
' #define LVCF_ORDER =32
' #define LVCFMT_LEFT =0
Const LVCFMT_RIGHT =1
Const LVCFMT_CENTER =2
Const LVCFMT_JUSTIFYMASK =3
Const LVN_FIRST = -100
Const LVN_LAST=-199
Const LVN_ITEMCHANGING= LVN_FIRST
Const LVN_ITEMCHANGED =(LVN_FIRST-1)
Const LVN_INSERTITEM =(LVN_FIRST-2)
Const LVN_DELETEITEM =(LVN_FIRST-3)
Const LVN_DELETEALLITEMS =(LVN_FIRST-4)
Const LVN_BEGINLABELEDIT = (LVN_FIRST-5)
Const LVN_BEGINLABELEDITW= (LVN_FIRST-75)
Const LVN_ENDLABELEDIT= (LVN_FIRST-6)
Const LVN_ENDLABELEDITW =(LVN_FIRST-76)
Const LVN_COLUMNCLICK =(LVN_FIRST-8)
Const LVN_BEGINDRAG =(LVN_FIRST-9)
Const LVN_BEGINRDRAG =(LVN_FIRST-11)
Const LVN_GETDISPINFOA =(LVN_FIRST-50)
Const LVN_GETDISPINFOW =(LVN_FIRST-77)
Const LVN_SETDISPINFOA =(LVN_FIRST-51)
Const LVN_SETDISPINFOW =(LVN_FIRST-78)
Const LVN_KEYDOWN =(LVN_FIRST-55)
Const LVCF_IMAGE= 16
Const LVCF_ORDER =32
Const LVIF_TEXT = 1
Const LVIF_IMAGE =2
Const LVIF_PARAM =4
Const LVIF_STATE =8
Const LVIF_INDENT =$10
Const LVIF_GROUPID =$100
Const LVIF_COLUMNS =$200
Const LVIF_NORECOMPUTE =$800
Const LVIF_DI_SETITEM =$1000
Const LVS_ICON =0
Const LVS_REPORT =1
Const LVS_SMALLICON =2
Const LVS_LIST =3
Const LVS_TYPEMASK =3
Const LVS_SINGLESEL =4
Const LVS_SHOWSELALWAYS =8
Const LVS_SORTASCENDING =16
Const LVS_SORTDESCENDING =32
Const LVS_SHAREIMAGELISTS =64
Const LVS_NOLABELWRAP =128
Const LVS_AUTOARRANGE =256
Const LVS_EDITLABELS =512
Const LVS_NOSCROLL =$2000
Const LVS_TYPESTYLEMASK =$fc00
Const LVS_ALIGNTOP =0
Const LVS_ALIGNLEFT =$800
Const LVS_ALIGNMASK =$c00
Const LVS_OWNERDRAWFIXED =$400
Const LVS_NOCOLUMNHEADER =$4000
Const LVS_NOSORTHEADER =$8000
Const LVS_TREEVIEW = $4000
Const LVS_EX_GRIDLINES = $1
Const LVS_EX_SUBITEMIMAGES = $2
Const LVS_EX_CHECKBOXES = $4
Const LVS_EX_TRACKSELECT = $8
Const LVS_EX_HEADERDRAGDROP = $10
Const LVS_EX_FULLROWSELECT = $20 'applies to report mode only
Const LVS_EX_ONECLICKACTIVATE = $40
Const LVS_EX_TWOCLICKACTIVATE = $80
Const LVS_EX_FLATSB = $100 'cannot be cleared - Win32 & IE4 only
Const LVS_EX_REGIONAL = $200 'Win32 & IE4 only
Const LVS_EX_INFOTIP = $400
Const LVIS_FOCUSED = $1
Const LVIS_SELECTED = $2
Const LVIS_CUT = $4
Const LVIS_DROPHILITED = $8
Const LVIS_OVERLAYMASK = $F00
Const LVIS_STATEIMAGEMASK = $F000
Const HDN_BEGINTRACK = -326
Const HDN_DIVIDERDBLCLICK=-325
Const HDN_ENDTRACK = -327
Const HDN_ITEMCHANGED = -321
Const HDN_ITEMCHANGING = -320
Const HDN_ITEMCLICKW = -322
Const HDN_ITEMDBLCLICK = -323
Const HDN_TRACK = -328
Const HDN_BEGINTRACKA = -306
Const HDN_DIVIDERDBLCLICKA = -305
Const HDN_ENDTRACKA = -307
Const HDN_ITEMCHANGEDA = -301
Const HDN_ITEMCHANGINGA = -300
Const HDN_ITEMCLICKA = -302
Const HDN_ITEMDBLCLICKA = -303
Const HDN_TRACKA = -308
Const ALPHABITS=$ff000000
Const GWL_STYLE = -16
Const GWL_EXSTYLE = -20
Type LVCOLUMN
Field mask
Field fmt
Field cx
Field pszText:Byte Ptr
Field cchTextMax
Field iSubItem
EndType
Type LVITEM
Field mask
Field iItem
Field iSubItem
Field iState
Field stateMask
Field pszText:Byte Ptr
Field cchTextMax
Field iImage
Field lParam
Field iIndent
Field iGroupId
Field cColumns
Field puColumns
EndType
Type LV_HITTESTINFO
Field ptX
Field ptY
Field flags
Field iItem
EndType
Type NMHDR
Field hwndFrom
Field idFrom
Field code
EndType
Type HD_NOTIFY
'Field hdr:Byte Ptr ' NMHDR
Field hwndFrom
Field idFrom
Field code
Field iItem
Field iButton
Field pitem
EndType
Type tagNMLVDISPINFO
Field hwndFrom
Field idFrom
Field code
Field mask
Field iItem
Field iSubItem
Field iState
Field stateMask
Field pszText:Byte Ptr
Field cchTextMax
Field iImage
Field lParam:Byte Ptr
Field iIndent
Field iGroupId
Field cColumns
Field puColumns
EndType
Type tagLVKEYDOWN
Field hwndFrom
Field idFrom
Field code
Field wVKey:Short
Field flags
EndType
Type tagNM_LISTVIEW
Field hwndFrom
Field idFrom
Field code
Field iItem
Field iSubItem
Field uNewState
Field uOldState
Field uChanged
Field ptActionX
Field ptActionY
Field lParam:Byte Ptr
EndType
Global ExplorerWindow:TGadget
Global Explorer:TGadget
Global ExplorerPanel:TGadget
Local Gadget:TGadget
Type ListItems
Field text:String
Field OldText:String
Field tip:String
Field SortKey:String
Field icon
EndType
Const SortText=0
Const SortDate=1
Const SortSize=2
Global SortGadget:TGadget
Global SortColumn
Function AddListBoxColumn(ListBox:TGadget,Column,HeadingText$,width,Style=0)
Local ListboxHwnd=QueryGadget(ListBox,QUERY_HWND)
Local col:LVCOLUMN = New LVCOLUMN
Col.mask = LVCF_WIDTH | LVCF_TEXT | LVCF_FMT
Col.fmt = Style
Col.cx = width
col.pszText = HeadingText$.ToCString()
Local ListBoxstyle = GetWindowLongA(ListboxHwnd , GWL_STYLE)
If (ListBoxstyle & LBS_MULTICOLUMN ) <> ( LBS_MULTICOLUMN ) Then
ListBoxstyle = ListBoxstyle | LBS_MULTICOLUMN
SetWindowLongA(ListboxHwnd , GWL_STYLE, ListBoxstyle ) 'change the style so that we have headings
EndIf
SendMessageA(ListboxHwnd,LVM_INSERTCOLUMNA,Column,Int(Byte Ptr Col))
End Function
Function SetListBoxExtendedStyle(ListBox:TGadget,Style:Int)
Local ListBoxHwnd:Int = QueryGadget(ListBox,QUERY_HWND)
SendMessageA(ListBoxHwnd,LVM_SETLISTBOXEXSTYLE,32,32)
End Function
Function getListBoxExtendedStyle(ListBox:TGadget, Style:Int)
Local ListBoxHwnd:Int = QueryGadget(ListBox,QUERY_HWND)
Local ret = SendMessageA(ListBoxHwnd,LVM_GETLISTBOXEXSTYLE,0,0)
If ret & Style
SetStatusText(ExplorerWindow, "Style " + Style + " is on")
Print "Style is on: " + ret
Else
SetStatusText(ExplorerWindow, "Style " + Style + " is off")
Print "Style is off: " + ret
End If
End Function
Function toggleListBoxExtendedStyle(ListBox:TGadget, Style:Int)
Local ListBoxHwnd:Int = QueryGadget(ListBox,QUERY_HWND)
Local ret:Int = SendMessageA(ListBoxHwnd,LVM_GETLISTBOXEXSTYLE,0,0)
Local StatusText$
If ret & Style = 0
ret = ret | Style
StatusText$ = "Style " + Style + " on"
Else
ret = ret ~ Style
StatusText$ = "Style " + Style + " off"
End If
SendMessageA(ListBoxHwnd,LVM_SETLISTBOXEXSTYLE,ret,ret)
SetStatusText(ExplorerWindow, StatusText$)
End Function
Function AddListBoxItem(ListBox:TGadget,text$,Row,Column)
Local ListboxHwnd=QueryGadget(ListBox,QUERY_HWND)
Local ColItem:LVITEM = New LVITEM
ColItem.mask = LVIF_TEXT
ColItem.iSubItem = Column
ColItem.iItem = Row
ColItem.pszText = text$.ToCString()
ColItem.cchTextMax = text$.length + 1
SendMessageA( ListboxHwnd,LVM_SETITEMA,0,Int(Byte Ptr ColItem))
ColItem=Null
End Function
Function GetListBoxItem:String(ListBox:TGadget,Row,Column)
Local ListboxHwnd=QueryGadget(ListBox,QUERY_HWND)
If ListboxHwnd Then
Local Ans$
Local TextBank:TBank=CreateBank(1024)
'Local Text:Byte[256]
Local ColItem:LVITEM = New LVITEM
ColItem.mask = LVIF_TEXT
ColItem.iSubItem = Column
ColItem.iItem = Row
ColItem.pszText = BankBuf(TextBank)
ColItem.cchTextMax = 255
SendMessageA( ListboxHwnd,LVM_GETITEMA,0,Int(Byte Ptr ColItem))
If ColItem.pszText <> Null
Ans$=Ans$.fromcstring(ColItem.pszText)
ColItem=Null
EndIf
Return Trim(Ans$)
EndIf
End Function
Function SetListBoxItem(ListBox:TGadget,text:String,Row,Column=0)
Local ListboxHwnd=QueryGadget(ListBox,QUERY_HWND)
If Column=0 Then
ListBox.items[Row].text = text
DebugLog "ListBox:TGadget text "+text
EndIf
If ListboxHwnd Then
Local ColItem:LVITEM = New LVITEM
ColItem.mask = LVIF_TEXT
ColItem.iSubItem = Column
ColItem.iItem = Row
ColItem.pszText = text.Tocstring()
ColItem.cchTextMax = Len(text)
Return SendMessageA( ListboxHwnd,LVM_SETITEMA,0,Int(Byte Ptr ColItem))
EndIf
End Function
Function ListBoxHeading(ListBox:TGadget,Column,text$,width=0)
Local ListboxHwnd=QueryGadget(ListBox,QUERY_HWND)
Local col:LVCOLUMN = New LVCOLUMN
If width = 0 Then
Col.mask = LVCF_TEXT| LVCF_FMT
Else
Col.mask = LVCF_TEXT| LVCF_FMT | LVCF_WIDTH
col.cx = width
EndIf
col.pszText = text$.ToCString()
Local ListBoxstyle = GetWindowLongA(ListboxHwnd , GWL_STYLE)
If listboxStyle & LVS_REPORT Then Print "Report is on"
If listboxStyle & LVS_EDITLABELS Then Print "edit labels is on"
If (ListBoxstyle & LVS_NOCOLUMNHEADER ) Then
ListBoxstyle = ListBoxstyle ~LVS_NOCOLUMNHEADER
EndIf
If ListBoxstyle & LVS_EDITLABELS=0 Then ListBoxstyle = ListBoxstyle | LVS_EDITLABELS
SetWindowLongA(ListboxHwnd , GWL_STYLE, ListBoxstyle ) 'change the style so that we have headings
SendMessageA(ListboxHwnd,LVM_SETCOLUMNA,Column,Int(Byte Ptr Col))
End Function
Function ListBoxColumnWidth(ListBox:TGadget,Column,width)
Local ListboxHwnd=QueryGadget(ListBox,QUERY_HWND)
Local col:LVCOLUMN = New LVCOLUMN
Col.mask = LVCF_WIDTH
col.cx = width
SendMessageA(ListboxHwnd,LVM_SETCOLUMNA,Column,Int(Byte Ptr Col))
End Function
Function ListBoxGadgetMultiSelect(ListBox:TGadget)
Local ListboxHwnd = QueryGadget(ListBox,QUERY_HWND)
Local ListBoxstyle = GetWindowLongA(ListboxHwnd , GWL_STYLE)
If (ListBoxstyle & LVS_SINGLESEL) = LVS_SINGLESEL Then
Return SetWindowLongA(ListboxHwnd , GWL_STYLE, ListBoxstyle ~ LVS_SINGLESEL ) 'change the style
EndIf
End Function
Const WM_SETTEXT = 12
Const WM_GETTEXT = 13
Const WM_GETTEXTLENGTH = 14
Function CreateExplorerWindow()
ExplorerWindow:TGadget=CreateWindow("Pic Explorer Window",100,100,700,470,Null,WINDOW_TITLEBAR|WINDOW_CLIENTCOORDS|WINDOW_STATUS)
ExplorerPanel = CreatePanel(5,35,545,430,ExplorerWindow,PANEL_ACTIVE|PANEL_BORDER)
Explorer = CreateListBox(2,2,537,394,ExplorerPanel)
ListBoxHeading(Explorer,0,"Name")
AddListBoxColumn(Explorer,1,"Type",40,0)
AddListBoxColumn(Explorer,2,"Modified",110,0)
AddListBoxColumn(Explorer,3,"Created",110,0)
AddListBoxColumn(Explorer,4,"Size",89,0)
'ListBoxGadgetMultiSelect(Explorer)
SetListBoxExtendedStyle(Explorer, LVS_EX_GRIDLINES)
For Local x:Int = 0 To 4
AddGadgetItem(Explorer, "Row " + String(x))
For Local y:Int = 1 To 9
AddListBoxItem(explorer, String(x*y), x, y)
Next
Next
EndFunction
Function NewWinProc:Int(hwnd:Int,MSG:Int,wParam:Int,lParam) "win32"
Local Tstr$
LVEditHandle =SetWindowLongA( QueryGadget(Explorer,QUERY_HWND), LVM_GETEDITCONTROL,0)
If LVEditHandle
DebugLog "LVEditHandle "+LVEditHandle
EndIf
If MSG = WM_NOTIFY Then
Local NotifyMess:HD_NOTIFY = New HD_NOTIFY
Local Tstr$
MemCopy( Byte Ptr(NotifyMess),Byte Ptr( lParam), SizeOf(HD_NOTIFY) )
If NotifyMess.code = LVN_BEGINLABELEDIT ' Then DebugLog "Begin Msg "+Hex(MSG) + " w "+Hex(wParam) + " l "+Hex(lParam) + " NotifyCode " +NotifyMess.code+" Item "+Hex$(NotifyMess.iItem)
Local DispInfo:tagNMLVDISPINFO = New tagNMLVDISPINFO
MemCopy( Byte Ptr(DispInfo),Byte Ptr( lParam), SizeOf(tagNMLVDISPINFO) )
DebugLog("from row " + dispinfo.iItem + ", col " + dispinfo.iSubItem)
EndIf
If NotifyMess.code = LVN_ENDLABELEDIT Then
Local DispInfo:tagNMLVDISPINFO = New tagNMLVDISPINFO
MemCopy( Byte Ptr(DispInfo),Byte Ptr( lParam), SizeOf(tagNMLVDISPINFO) )
Local NewText$ = Trim(Tstr$.fromcstring(DispInfo.pszText))
DebugLog("Finished edit from col " + dispinfo.iSubItem)
If NewText > "" Then SetListBoxItem(explorer,NewText,DispInfo.iItem,Dispinfo.iSubItem)
EndIf
EndIf
If oldWinProc <> 0 Then Return CallWindowProc(oldWinProc, hwnd, MSG, wParam,Int(Byte Ptr( lParam)))
EndFunction
Function NewListProc:Int(hwnd:Int,MSG:Int,wParam:Int,lParam) "win32"
If MSG = WM_NOTIFY Then
Local NotifyMess:HD_NOTIFY = New HD_NOTIFY
Local Tstr$
MemCopy( Byte Ptr(NotifyMess),Byte Ptr( lParam), SizeOf(HD_NOTIFY) )
If NotifyMess.code = HDN_ITEMCLICKW Then
SetStatusText(ExplorerWindow, "Column heading "+NotifyMess.iItem + " has been clicked.")
EndIf
EndIf
If oldListProc <>0 Then Return CallWindowProc(oldListProc, hwnd, MSG, wParam,Int(Byte Ptr( lParam)))
EndFunction
'
'------------------------------------------------------------------------
CreateExplorerWindow()
' Use subclassing To look For labeledit And drag/drop windows messages
Local ExplorerHwnd = QueryGadget(Explorer,QUERY_HWND)
Global oldListProc,oldWinProc,LVEditHandle ',DragingImageNow,DragImage:Byte Ptr
oldWinProc =SetWindowLongA(QueryGadget(ExplorerPanel,QUERY_HWND), GWL_WNDPROC,Int(Byte Ptr(NewWinProc)))
oldListProc =SetWindowLongA(QueryGadget(Explorer,QUERY_HWND), GWL_WNDPROC,Int(Byte Ptr(NewListProc)))
Repeat
WaitEvent()
Gadget= TGadget(EventSource())
Select EventID()
Case EVENT_GADGETACTION
Select Gadget
Case Explorer
Print "Toggling"
toggleListBoxExtendedStyle(explorer, LVS_EX_FULLROWSELECT)
End Select
Case EVENT_GADGETMENU
Select Gadget
Case Explorer
Print "Gadgetmenu in explorer"
EndSelect
Case EVENT_WINDOWCLOSE
Select gadget
Case ExplorerWindow
Exit
EndSelect
End Select
Forever