I have tried using LVM_EDITLABEL in several places including WM_NOTIFY, lParam and have not got it to work. Maybe I am misunderstanding it, but it seems this if for editing in place a item. If someone has an example, it sure would be appreciated. Thanks,


invoke SetFocus hLSV
invoke SendMessage,hLSV,LVM_EDITLABEL,1,0

Posted on 2009-03-23 05:45:48 by green
Your code looks right.. as far as I understand what you want to do. Wizzra once posted the same snippet and it seemed to work for him: here.

Do you have items in your listview when using this code?
Posted on 2009-03-23 07:50:28 by JimmyClif
Hi JimmyClif, thanks for the reply. The link you provided is one that I had looked at and I also checked aout masm32.com and the entire internet. I am evidently messing up somewhere and can't seem to figure it out. After working on API code for a day or so, I run out of ideas.
Posted on 2009-03-23 08:02:02 by green
Did you set the LVS_EDITLABELS property in your ListView?
Posted on 2009-03-23 08:22:59 by JimmyClif
Yes, copied this code from a masm example. The gridlines are visible and the colors are set, so I assume the rest is working.
		invoke SendMessage,hLSV,LVM_GETHEADER, 0, 0   ;// get handle to header 
mov hHeader,eax  ;// preserve header handle
invoke GetWindowLong, hHeader, GWL_STYLE  ;// get current window styles
xor eax,HDS_BUTTONS
invoke SetWindowLong,hHeader, GWL_STYLE, eax  ;// set the new header styles

; Setup extended styles like gridlines
mov    eax, LVS_EX_HEADERDRAGDROP or LVS_EX_SUBITEMIMAGES or LVS_EX_GRIDLINES or LVS_EDITLABELS
invoke  SendMessage, hLSV, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, eax
invoke  SendMessage, hLSV, LVM_SETTEXTCOLOR, 0, 00FFFFFFh
invoke  SendMessage, hLSV, LVM_SETBKCOLOR, 0, 00FF0000h
invoke  SendMessage, hLSV, LVM_SETTEXTBKCOLOR, 0,00FF0000h

Posted on 2009-03-23 11:38:00 by green
LVS_EDITLABELS is not an extended style - it's a regular Window Style.

I assume that's why it's failing.
Posted on 2009-03-23 11:40:47 by JimmyClif
My problem may lie in the fact I am using RADAsm ListView custom control. I tried GWL_STYLE  and GWL_EXSTYLE but they seem to be the same attribute; changing either one affects the other. I may have to create the ListView, but I was hoping to get this one to work, saves coding.
Posted on 2009-03-23 12:03:47 by green
Ok, created the ListView and LVS_EDITLABELS works on the first column, how is the second column accessed? After doing some searching, I am disappointed in the fact that only the first column can be edited using this method. Another futile chase and the fox won.
Posted on 2009-03-23 13:05:20 by green
Well, I could have told you straight up that only the first column can be accessed but a way I found around this issue was to create an hidden editfield and when it was time to edit the column I made it visible and placed it on the cell which was to be edited.

It was annoying as hell but I eventually made it work including the loosing focus, cancelling and accepting of the changes effect. I wish I had kept the source... (or for better words) I wish I knew where I used it and what I did with it.
Posted on 2009-03-23 14:41:10 by JimmyClif
What are you doing, getting old and senile like me? If you happen to find that code, I would definitely like to see it. Customizing is not easy, especially when I am limited on knowledge. M$ loves to screw with people I believe and I am sure they have some little way of editing any of the items they want in a ListView that is top secret or M$ is, well never mind. There is no way I will believe otherwise. In playing with VBA, I have found a lot of little tidbits that are undocumented. Thanks for your help...
Posted on 2009-03-23 14:55:10 by green
Masm Debilitates... It says it right under my avatar.. but here are some guidelines... I whopped up a half-a-project to see how I did that once and as far as I remember this is how:

1) Create an invisible Edit Window
1.1) SubClass it (see (5))
2) Set the Extended ListView Style to LVS_EX_FULLROWSELECT so that focus can change one whatever item you click on.
3) SubClass the ListView and intercept WM_LBUTTONDBLCLICK.
3.1) On Doubleclick get info which item is selected
3.2) Get horizontal position (Lparam of ListViewProc) of where user doubleclicked. using this number find out which column he clicked on.
3.3) Get info of text inside that column of that item
4) Move Edit Window on position of where that column starts with column width as lenght and row height as height.
4.1) Make it visible and set ListView SubText into it. (Also maybe confine the mouse to the editwindow with SetCapture so that the user can't just click away to some other window.)
5) Edit window needs to be subclassed to intercept button and loose of focus and return to accept changes.
6) Pray for it to work... I know mine did ... but I remember it to be a huge pain in the you know what.
Posted on 2009-03-24 19:11:22 by JimmyClif
WOW!!!! What you have suggested looks right but it is really going to take some writes and re-writes. As soon as I get my nerve up, I will give it a try. Thanks JimmyClif.

BTW, I selected "Notify me of replies." and so far I have not gotten a notification during this exchange or any other post I have made.
Posted on 2009-03-25 12:19:06 by green
Hi Green,

Here's a little demo I wrote to show some of the available functions of the listview, it might help to implement some features, its in GoAsm syntax but easily translated to MASM.

http://www.quickersoft.com/donkey/files/TestListView.zip
Posted on 2009-03-25 23:33:25 by donkey
Thanks donkey, all help appreciated. I have taken the first step and downloaded all GoAsm files and compiled/ran your demo just for practice. Now I am going to try and convert it to MASM and that may take some time.
Posted on 2009-03-26 19:34:07 by green