Hi folks,
I have a ListView, on which the Editable property is set to True.
I had read this old forum post: http://gambas.8142.n7.nabble.com/Column ... tml#a51776
Granted it's ColumnView, but I had hoped it would function similarly. I was hoping that I would be able to double-click to edit a ListView item. I want to be able to rename the entry after it's been created.
I started writing a modal dialogue for a corresponding "Rename" button, but if it's directly supported through the native component, I'd rather use that.
Any tips?
Thanks!
ListView.Editable, how does it work?
-
- Posts: 4
- Joined: Wednesday 9th May 2018 5:12am
- cogier
- Site Admin
- Posts: 1125
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: ListView.Editable, how does it work?
Hi computermouth and welcome to the forum.
I had a look at this issue and discovered that you can edit a list item by pressing the [F2] key. If you want to be able to edit by clicking on a list item you need a routine to catch the click event. Put the code below in 'Graphical application' and run it.
Let us know how you get on.
I had a look at this issue and discovered that you can edit a list item by pressing the [F2] key. If you want to be able to edit by clicking on a list item you need a routine to catch the click event. Put the code below in 'Graphical application' and run it.
hListView As ListView
Public Sub Form_Open()
Dim siCount As Short
Me.Arrangement = Arrange.Vertical
Me.Padding = 5
hListView = New ListView(Me) As "ListView1"
hListView.Expand = True
hListView.Editable = True
For siCount = 1 To 10
hListView.Add(Str(siCount), "Hello ComputerMouth " & Str(siCount))
Next
End
Public Sub ListView1_Click()
hListView.Current.Rename
End
EDIT: - You can change Public Sub ListView1_Click() to Public Sub ListView1_DblClick() for a double click rather that a single click.Let us know how you get on.
-
- Posts: 4
- Joined: Wednesday 9th May 2018 5:12am
Re: ListView.Editable, how does it work?
Oh, awesome. Thanks cogier!
That's certainly much less to upkeep over the modal dialog change I had been writing.
That's certainly much less to upkeep over the modal dialog change I had been writing.