Re:'F2' to Edit Item in Listview

new topic     » topic index » view thread      » older message » newer message

Hi Chris, 
 
setNotifyHandler(LVN_BEGINLABELEDITA 
  
doesnt seem to be working in this demo I just tried 
to whip-up for you. Im using Win32lib (58.2) 
also, using loadLVInfo needs a fix for the problem  
it poses... 
 
Derek will probably blow me away on this one ! 
 
If setNotifyHandler(LVN_COLUMNCLICK  
works then why doesnt LVN_BEGINLABELEDITA? 
 
without warning 
include win32lib.ew 
object junk 
with trace 
 
constant 
MainWin =  create( Window, "Listview Edit Demo by Euman 2003", 0, 10, 10, 530,
 400, { WS_DLGFRAME, WS_SYSMENU})
,Listview  create(ListView, "", MainWin, 10, 3,505, 357,
or_all({LVS_REPORT,LVS_SHOWSELALWAYS))
 
 insertLVColumn(Listview,1,0,LVCFMT_LEFT,75,"H-M-S",0) 
 insertLVColumn(Listview,1,0,LVCFMT_LEFT,75,"M-D-Y",0) 
 insertLVColumn(Listview,1,0,LVCFMT_LEFT,100,"Size",0) 
 insertLVColumn(Listview,1,0,LVCFMT_LEFT,100,"Attr",0) 
 insertLVColumn(Listview,1,0,LVCFMT_LEFT,148,"Name",0) 
 
function LVEdit(integer id, atom hWnd, atom wParam, atom lParam) 
  integer lColumn 
trace(1) 
    id = getId( fetch( lParam, NMHDR_hwndFrom ))   
    lColumn = fetch( lParam, NMLISTVIEW_iSubItem ) + 1 
    return kReturnNow 
end function  
junk = setNotifyHandler(LVN_BEGINLABELEDITA, routine_id("LVEdit")) 
 
function LVClick(integer id, atom hWnd, atom wParam, atom lParam) 
  integer lColumn 
trace(1) 
    id = getId( fetch( lParam, NMHDR_hwndFrom ))   
    lColumn = fetch( lParam, NMLISTVIEW_iSubItem ) + 1 
    return kReturnNow 
end function  
junk = setNotifyHandler(LVN_COLUMNCLICK, routine_id("LVClick")) 
 
-------------------------------- 
procedure EditOnKeyDown(integer self, integer event, sequence parms) 
-------------------------------- 
    integer index 
    if find(parms[1],{VK_F2}) then 
    junk = w32Func( xSendMessage, {getHandle(self), LVM_GETEDITCONTROL, 0, 0} ) 
    else 
        return 
    end if   
end procedure 
setHandler(Listview, w32HKeyDown, routine_id("EditOnKeyDown")) 
 
procedure PopulateLV(integer self, integer event, sequence parms) 
sequence d, data 
   d = dir(current_dir()) 
   data = {} 
   for i = 1 to length(d) do 
       data = append(data,{d[i][1],d[i][2],d[i][3],d[i][4..6],d[i][7..9]}) 
   end for 
   loadLVInfo(Listview, data) 
end procedure 
setHandler(MainWin, w32HOpen, routine_id("PopulateLV")) 
 
WinMain( MainWin,Normal ) 
 
Euman

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu