Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2006

Tip: Looking for answers? Try searching our database.

Editing a multicolumn ListView

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Arrick - 13 Feb 2006 22:13 GMT
Hello

I need to allow users to freely edit a multicolumn list. (I'm using a
ListView specifically because it can be induced to scroll when a user
"nudges" the top or bottom with the mouse.) To allow users to edit fields I
throw up a Textbox over the selected field. (The ListView has facilities for
editing the first column, but I need all columns to be editable.) It works
unless the user scrolls the ListView while the editable Textbox has the focus
-- in this case the editable box stays where it is while the background
scrolls out from under it.

Is there a way I can 'pin' the Textbox to the ListView client, or at least
detect when the ListView is scrolled, so I can validate and hide the TextBox?

Thanks
Jared - 13 Feb 2006 23:45 GMT
> detect when the ListView is scrolled,

See class below, I found it on internet and have modified it so it works
when half visible item is clicked as well.

Also, you will need to update designer in 2 spots, from ListView to
xListView.  If you have any problem with that just reply.

Public Class xListView

'NOTE take from internet somewhere - pureley to capture topitem change from
scroll

' - but has proven to be helpfull on half item click as well

Inherits Windows.Forms.ListView

Private Const WM_VSCROLL As Integer = &H115

Enum ScrollBarActions As Integer

SB_LINEUP = &H0

SB_LINEDOWN = &H1

SB_PAGEUP = &H2

SB_PAGEDOWN = &H3

SB_THUMBPOSITION = &H4

SB_THUMBTRACK = &H5

SB_TOP = &H6

SB_BOTTOM = &H7

SB_ENDSCROLL = &H8

End Enum

Event IMovedEvent()

Private Var1() As String

Private Var2() As String

Protected Overrides Sub wndProc(ByRef m As Message)

'HACK fix attempt for selcting bottem item which is split

With m.WParam

If m.Msg.Equals(&H115) And .ToInt32 = ScrollBarActions.SB_ENDSCROLL Then

RaiseEvent IMovedEvent()

End If

'MESSAGE = SCROLLED, BUT ACTS LIKE SELECTED INDEX CHANGE(SINGULAR)

If m.Msg.Equals(&H113) Then

RaiseEvent IMovedEvent()

End If

End With

MyBase.WndProc(m)

End Sub

Private Sub xListView_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown

Select Case e.KeyCode

Case Keys.Up, Keys.Down, Keys.PageDown, Keys.PageUp

Console.WriteLine("Raising IMovedEvent")

RaiseEvent IMovedEvent()

End Select

End Sub

End Class
Arrick - 14 Feb 2006 23:18 GMT
Thanks -- overriding WndProc and detecting WM_VSCROLL was the idea I needed.

> > detect when the ListView is scrolled,
>
[quoted text clipped - 85 lines]
>
> End Class

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.