-
Moving the edit control created when a ListView label edit starts
The MSDN docs state:
"When label editing begins, an edit control is created, positioned, and
initialized. Before it is displayed, the list view control sends its parent
window an LVN_BEGINLABELEDIT notification message.
To customize label editing, implement a handler for LVN_BEGINLABELEDIT and
have it send an LVM_GETEDITCONTROL message to the list view control. If a
label is being edited, the return value will be a handle to the edit
control. Use this handle to customize the edit control by sending the usual
EM_XXX messages."
So, I tried implementing this, only it does not seem to work. The MoveWindow
call succeeds, but the edit control does not move... the EditControl method
is just a thin wrapper for LVM_GETEDITCONTROL.
Private Declare Function MoveWindow Lib "user32" (ByVal hWnd As Long, _
ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As
Long, ByVal bRepaint As Long) _
As Long
Private Sub lvwSettings_BeforeLabelEdit(Item As dsListView.ListItem, Cancel
As Boolean)
Dim hwndEdit As Long, rc As Long
hwndEdit = lvwSettings.EditControl
Debug.Print "hwndEdit := " & hwndEdit
rc = MoveWindow(hwndEdit, lvwSettings.ColumnHeaders(2).Left, Item.Top,
lvwSettings.ColumnHeaders(2).Width, _
lvwSettings.ColumnHeaders(2).Height, True)
'// rc = MoveWindow(hwndEdit, 320, 200, 140, 130, 1)
MsgBox "rc := " & rc, vbInformation, "lvwSettings_BeforeLabelEdit"
End Sub
I remember reading a VBPJ article about this (actually it was about the MS
ListView control) by Matt Hart, but I've misplaced my copy of it. It had
something to do with hooking WM_KILLFOCUS, EN_SETFOCUS, EN_UPDATE and other
such things... and his web site doesn't seem to have the article anymore.
--
Damit Senanayake | damit@mvps.org | http://vulcan.spaceports.com/~damit/
Please reply to newsgroups, not by e-mail. | ICQ: 6930718
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks