1. Treeview w/Edit-Labels
- Posted by euman at bellsouth.net Jun 19, 2002
- 469 views
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. ==================================================================
2. Re: Treeview w/Edit-Labels
- Posted by "C. K. Lester" <cklester at yahoo.com> Jun 19, 2002
- 451 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. > ================================================================== > > > >
3. Re: Treeview w/Edit-Labels
- Posted by euman at bellsouth.net Jun 19, 2002
- 455 views
Correct Chris, the latest beta version of Win32lib is required. Version: 0.57.8 17/June/2002 dont forget sequence tvitem_handle in Win32lib.ew will need to be set as global. Maybe Derek will update all the handle housekeeping to be global? Euman euman at bellsouth.net
4. Re: Treeview w/Edit-Labels
- Posted by euman at bellsouth.net Jun 19, 2002
- 440 views
Ok Derek, Now that I know I dont need to globalize anything in win32lib to make programs work. I'll go on the hunt for the answer to my question. This should be pretty easy to figure out anyway. even still, this problem is alot easier solved if done in API... atleast I dont have to travel around the world to party with my next door neighbor. Windows creates the Edit control and I retrieve the handle to this edit control now I must process the edit control via subclassing. I dont suppose you have a one word command for this do ya Derek? Euman euman at bellsouth.net
5. Re: Treeview w/Edit-Labels
- Posted by tone.skoda at gmx.net Jun 19, 2002
- 461 views
Hello, I made a little library to have treeviews with items which have more lines, you can get it here: http://www10.brinkster.com/tskoda/euphoria.asp#CustomTreeView I destory that default edit box and create my own in its place. Like this: if code = TVN_BEGINLABELEDIT then edit_control = sendMessage(treewnd, TVM_GETEDITCONTROL, 0, 0) Void = w32Func (xDestroyWindow, {edit_control}) ... create my own edit box or richedit or whatever ----- Original Message ----- From: <euman at bellsouth.net> To: "EUforum" <EUforum at topica.com> Sent: Thursday, June 20, 2002 1:07 AM Subject: Re: Treeview w/Edit-Labels > > Ok Derek, > > Now that I know I dont need to globalize anything in win32lib to make programs > work. I'll go on the hunt for the answer to my question. > This should be pretty easy to figure out anyway. > even still, this problem is alot easier solved if done in API... > atleast I dont have to travel around the world to party with my next door neighbor. > > Windows creates the Edit control and I retrieve the handle to this edit control > now I must process the edit control via subclassing. I dont suppose you have a > one word command for this do ya Derek? > > Euman > euman at bellsouth.net > > > >
6. Re: Treeview w/Edit-Labels
- Posted by Derek Parnell <ddparnell at bigpond.com> Jun 22, 2002
- 458 views
----- Original Message ----- From: "jordah ferguson" <jorfergie03 at yahoo.com> To: "EUforum" <EUforum at topica.com> Subject: RE: Treeview w/Edit-Labels > > I was just creating a Tutorial for Editting treeview labels but for some > reason every time i press a key the Edit Control Loses Focus. > > Any help available, Because I don't have this problem in the demo I sent, I'd have to see your code to be of any help. Send it to me and I'll have a look. ------------- Derek.