[Class] LV_InCellEdit - update on 2015-12-15
Re: [Class] LV_InCellEdit - update on 2015-12-15
And so, I'll wait for the next release to update the library on my script!
Re: [Class] LV_InCellEdit - update on 2015-12-15
It has been released already!
Re: [Class] LV_InCellEdit - update on 2015-12-15
Great! keep up the good work!
Re: [Class] LV_InCellEdit - update on 2015-12-15
Hello just me, I'm noticing that on my script using LV_InCellEdit sometimes the gui freezes and then I remember that you said this:
So my question is what can I do to avoid these freezes? , I noticed that when I change the focus of the gui to another window and return back again, the gui unfreeze it, is there a fix to this problem? I almost finish with my script but this situation that freezes the gui changes it all..just me wrote: LV_InCellEdit() is a very time critical function which might cause the ListView or the whole Gui to freeze.
Re: [Class] LV_InCellEdit - update on 2015-12-15
Unfortunately, I didn't find a work-around as yet. It seems to be related to AHK's processing of mouse click notifications, particularly left clicks, but I cannot even say which click at which time will produce the issue.
(See here).
(See here).
Re: [Class] LV_InCellEdit - update on 2015-12-15
Hello just me, I noticed that when I send text to the edit cell via: Send, SendInput, etc the edit field moves all way to the left, is there a way to fix this? Thank you.
Re: [Class] LV_InCellEdit - update on 2015-12-15
I guess it has the same reason as the 'fast typing' issue. Some EN_UPDATE notification is passed directly to the ListView which will reposition the edit control in this case. If my last changes do not prevent the issue, I see no other option as yet.
Re: [Class] LV_InCellEdit - update on 2015-12-15
Well, maybe later you could find a solution I guess, the thing is that I'm using hotstrings to replace vocals with accents like "!a::á" something like that, but with that issue it won't work as desired. But anyways, thank you for the support, just me.
Re: [Class] LV_InCellEdit - update on 2015-12-15
What would be the best way to update this class to account for if the cell has a subitem image set? I included LV_EX.ahk and updated the LVN_BEGINLABELEDIT function like so:
This moved the edit field over to the right so the image isn't blocked (though IDK how this would effect a listview without subitem images). I also want the edit to span all the way over to the right edge of the cell but I'm not sure how to modify This.EW to achieve that either.
Code: Select all
; -------------------------------------------------------------------------------------------------------------------
; LVN_BEGINLABELEDIT notification
; -------------------------------------------------------------------------------------------------------------------
LVN_BEGINLABELEDIT(L) {
Static Indent := 4 ; indent of the Edit control, 4 seems to be reasonable for XP, Vista, and 7
If (This.Item = -1) || (This.SubItem = -1)
Return True
H := This.HWND
SendMessage, 0x1018, 0, 0, , % "ahk_id " . H ; LVM_GETEDITCONTROL
This.HEDIT := ErrorLevel
, VarSetCapacity(ItemText, 2048, 0) ; text buffer
, VarSetCapacity(LVITEM, 40 + (A_PtrSize * 5), 0) ; LVITEM structure
, NumPut(This.Item, LVITEM, 4, "Int")
, NumPut(This.SubItem, LVITEM, 8, "Int")
, NumPut(&ItemText, LVITEM, 16 + A_PtrSize, "Ptr") ; pszText in LVITEM
, NumPut(1024 + 1, LVITEM, 16 + (A_PtrSize * 2), "Int") ; cchTextMax in LVITEM
SendMessage, % (A_IsUnicode ? 0x1073 : 0x102D), % This.Item, % &LVITEM, , % "ahk_id " . H ; LVM_GETITEMTEXT
This.ItemText := StrGet(&ItemText, ErrorLevel)
; Call the user function, if any
If (This.EditUserFunc)
This.EditUserFunc.Call("BEGIN", This.HWND, This.HEDIT, This.Item + 1, This.Subitem + 1, This.ItemText)
ControlSetText, , % This.ItemText, % "ahk_id " . This.HEDIT
If (This.SubItem > 0) && (This.Blank) {
Empty := ""
, NumPut(&Empty, LVITEM, 16 + A_PtrSize, "Ptr") ; pszText in LVITEM
, NumPut(0,LVITEM, 16 + (A_PtrSize * 2), "Int") ; cchTextMax in LVITEM
SendMessage, % (A_IsUnicode ? 0x1074 : 0x102E), % This.Item, % &LVITEM, , % "ahk_id " . H ; LVM_SETITEMTEXT
}
VarSetCapacity(RECT, 16, 0)
, NumPut(1, RECT, 0, "Int")
, NumPut(This.SubItem, RECT, 4, "Int")
SendMessage, 0x1038, This.Item, &RECT, , % "ahk_id " . H ; LVM_GETSUBITEMRECT
cellCoords := LV_EX_GetSubItemRect(This.HWND, This.SubItem, This.Item, 1)
This.EX := NumGet(RECT, 0, "Int") + This.LX + This.DX + Indent + cellCoords.W
, This.EY := NumGet(RECT, 4, "Int") + This.LY + This.DY
If (This.OSVersion < 6)
This.EY -= 1 ; subtract 1 for WinXP
If (This.SubItem = 0) {
SendMessage, 0x101D, 0, 0, , % "ahk_id " . H ; LVM_GETCOLUMNWIDTH
This.EW := ErrorLevel
}
Else
This.EW := NumGet(RECT, 8, "Int") - NumGet(RECT, 0, "Int")
This.EW -= Indent
, This.EH := NumGet(RECT, 12, "Int") - NumGet(RECT, 4, "Int")
; Register WM_COMMAND handler
, This.CommandFunc := ObjBindMethod(This, "On_WM_COMMAND")
, OnMessage(0x0111, This.CommandFunc)
; Register hotkeys
If !(This.Next)
This.RegisterHotkeys()
This.Cancelled := False
This.Next := False
Return False
}
Re: [Class] LV_InCellEdit - update on 2015-12-15
Hi kczx3!
As far as I can see you made three changes to LVN_BEGINLABELEDIT():The first change causes the LVM_GETSUBITEMRECT messages to retrieve the bounding rectangle of the icon or small icon instead of the the bounding rectangle of the entire item (LVIR_ICON = 1). The same rectangle will be retrieved by the added LV_EX_GetSubItemRect() call (param 4 = 1). Why do you want to get the same rectangle twice?
As far as I can see you made three changes to LVN_BEGINLABELEDIT():
Code: Select all
VarSetCapacity(RECT, 16, 0)
, NumPut(1, RECT, 0, "Int") ; <<<<<<<<<< added
, NumPut(This.SubItem, RECT, 4, "Int")
SendMessage, 0x1038, This.Item, &RECT, , % "ahk_id " . H ; LVM_GETSUBITEMRECT
cellCoords := LV_EX_GetSubItemRect(This.HWND, This.SubItem, This.Item, 1) ; <<<<<<<<<< added
This.EX := NumGet(RECT, 0, "Int") + This.LX + This.DX + Indent + cellCoords.W ; <<<<<<<<<< changed
How about a quick test?...(though IDK how this would effect a listview without subitem images)
LV_InCellEdit() tries to mimic the default behaviour of the built-in edit control. So the width of the edit depends on its content. This is implemented in On_WM_COMMAND() using the LVM_GETSTRINGWIDTH message (0x1011 / 0x1057).I also want the edit to span all the way over to the right edge of the cell ...
-
- Posts: 47
- Joined: 09 Oct 2014, 11:44
Re: [Class] LV_InCellEdit - update on 2015-12-15
Sorry didnt have time to read other comments....implemented your code and loved it but had to
Remove it for 2 reasons...1) it had a tendency to add a leading space and 2) you can no longer use controlget to get mass data from LVs
Remove it for 2 reasons...1) it had a tendency to add a leading space and 2) you can no longer use controlget to get mass data from LVs
Re: [Class] LV_InCellEdit - update on 2015-12-15
Hi canisdibellum.
I'm not sure what you are talking about.
I'm not sure what you are talking about.
I never noticed such an issue and nobody else reported it as yet.1) it had a tendency to add a leading space
What do you mean? The class is using ControlGet internally without any known problems.2) you can no longer use controlget to get mass data from LVs
-
- Posts: 47
- Joined: 09 Oct 2014, 11:44
Re: [Class] LV_InCellEdit - update on 2015-12-15
1. Literally.....I can't remember if it was cells that were created as "blank" (it would make sense that if a cell held no data from an lv_add that it would populate w/ a space and i didnt think to look for it) or if it was just edited cells that developed the leading space.....i had to go and manually fix a lot of instances where the cells had a space before the data.just me wrote:Hi canisdibellum.
I'm not sure what you are talking about.I never noticed such an issue and nobody else reported it as yet.1) it had a tendency to add a leading spaceWhat do you mean? The class is using ControlGet internally without any known problems.2) you can no longer use controlget to get mass data from LVs
2. It looks like your script uses some sort of transparent overlay over the lv.....try to use the windowspy built in to scite to determine the classnn and you will see what i mean...and using classnn that worked before implementation doesnt work either
The gui i was using this with had 4 tab3 tabs each with a massive LV on each and i only implemented on the one on the second tab. When i would use controlget the outputvar would be blank no matter what and when i used windowspy to figure out if the class nn changed or something i couldn't get a listview nn at all from any of my lvs.
Note: ControlGet and retrieving the classnn worked before implementing your script and started working again once i removed the last remnant.
Re: [Class] LV_InCellEdit - update on 2015-12-15
Well I will check it.1. Literally.....I can't remember if it was cells that were created as "blank" (it would make sense that if a cell held no data from an lv_add that it would populate w/ a space and i didnt think to look for it) or if it was just edited cells that developed the leading space.....i had to go and manually fix a lot of instances where the cells had a space before the data.
The class doesn't use 'some sort of transparent overlay'. But the Tab3 control might behave so. Why don't you use the HWND instead of the ClassNN?canisdibellum wrote:2. It looks like your script uses some sort of transparent overlay over the lv.....try to use the windowspy built in to scite to determine the classnn and you will see what i mean...and using classnn that worked before implementation doesnt work either.
Re: [Class] LV_InCellEdit - update on 2015-12-15
Well I did some tests but wasn't able to reproduce the issue.I wrote:Well I will check it.1. Literally.....I can't remember if it was cells that were created as "blank" (it would make sense that if a cell held no data from an lv_add that it would populate w/ a space and i didnt think to look for it) or if it was just edited cells that developed the leading space.....i had to go and manually fix a lot of instances where the cells had a space before the data.
Return to “Scripts and Functions (v1)”
Who is online
Users browsing this forum: Gewerd_Strauss, Google [Bot] and 218 guests