Re: Treeview w/Edit-Labels
- Posted by "C. K. Lester" <cklester at yahoo.com> Jun 19, 2002
- 452 views
Mine crashes with a "What is setNotifyHandler?" error. I'm guessing you're using the latest 'n' greatest Win32Lib, eh? ----- Original Message ----- From: <euman at bellsouth.net> To: "EUforum" <EUforum at topica.com> Subject: Treeview w/Edit-Labels > > Hello all, > > Im experimenting with Treeview w/Edit-Labels and provide a snippet of code (below) > There are issues with this, first, windows explicitly creates the edit control > and you can obtain the handle to this edit control but Im not sure how to add this > control to our housekeeping sequences so I can subclass or control the edit controls > behavior. Any ideas? Also, how would I (from my subclassed edit control) send info > back to my treeview so I can stop the edit process I setup in the treeview control. > There are several parameters that need to be considered if the user of the program > sets the focus to another control or either wants to save the edit or cancel. This is > a pretty safisticated process. "Im hoping someone has code already" > > include win32lib.ew > > object junk > > constant > MainWin = create( Window, "Treeview Edit Label Demo", 0, 1, 1, 492, 380, { WS_DLGFRAME, WS_SYSMENU}) > ,TV = create(TreeView, "TreeView", MainWin, 10, 22, 464, 310, > or_all({TVS_HASLINES,TVS_LINESATROOT,TVS_HASBUTTONS,TVS_EDITLABELS, TVS_SHOWSELALWAYS}) ) > ,TVPopup = create( Popup, "", TV, 0, 0, 0, 0, 0 ) > ,TVItem1 = create( MenuItem, "Create a New", TVPopup, 0, 0, 0, 0, 0 ) > > constant > closefolder = addIcon( extractIcon( "clsdfold.ico" )) > ,openfolder = addIcon( extractIcon( "openfold.ico" )) > > procedure TVpopup(integer self, integer event, sequence parms) -- popup mnu for TV > if parms[1] = WM_RBUTTONDOWN then > popup(TVPopup, parms[2], parms[3] ) > end if > end procedure > setHandler(TV, w32HMouse, routine_id("TVpopup")) > > function TVEdit(integer id, atom hWnd, atom wParam, atom lParam) > atom Edit_id > Edit_id = w32Func( xSendMessage, {getHandle(TV), TVM_GETEDITCONTROL, 0, 0 } ) > w32Proc( xSetFocus, {Edit_id} ) > -- from here there needs to be a trap for end of edit, etc. > -- so we can save the info or dismiss. > return 0 > end function > junk = setNotifyHandler( TVN_BEGINLABELEDIT, routine_id("TVEdit")) > > sequence folders > folders = {} > folders &= addTVItem( TV, closefolder, closefolder, "Right Click in Treeview for popup menu" , 0 ) > folders &= addTVItem( TV, closefolder, closefolder, "Item One" , folders[1] ) > expandItem( 1 ) > > procedure AddFamily(integer self, integer event, sequence parms ) > integer len, index > > folders &= addTVItem( TV, openfolder, openfolder, "", folders[1] ) > len = length(folders) > index = folders[len] > junk = w32Func( xSendMessage, {getHandle(TV), TVM_EDITLABEL, 0, tvitem_handle[index] } ) > end procedure > setHandler(TVItem1, w32HClick, routine_id("AddFamily")) > > WinMain( MainWin,Normal ) > > Euman > euman at bellsouth.net > > ================================================================== > The information contained in this message may be confidential > and is intended to be exclusively for the addressee. Should you > receive this message unintentionally, please do not use the contents > herein and notify the sender immediately by return e-mail. > ================================================================== > > > >