Jump to content

ListView Edit Input with Tabulator Switching


Recommended Posts

Hi and Good Morning,

currently I would like to try to edit the input inside a ListView for a specific column and I got it already with the ListViewEditInput.au3 UDF (included in the attachment). I can't find out how to get the edit working with tabulator. 

Here is my example code:

#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#include <ListViewEditInput.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 373, 133, 192, 124)
$List1 = GUICtrlCreateListView("Col1|Col2|Col3", 0, 0, 369, 123)
GUICtrlCreateListViewItem("Test|Test|Test", $List1)
GUICtrlCreateListViewItem("Test1|Test1|Test1", $List1)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

__ListViewEditInput_StartUp($Form1)
__ListViewEditInput_AddListview($Form1,$List1,"2","All","E")
__ListViewEditInput_InitializeKeys($Form1)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

How can I change the code to let him switch the listview item by pressing the "TAB"-Key on the keyboard? It is currently configured that Col3 is editable.

 

Example pictures:

 

image.png.a391f2f83131b3866376e7dfaf4d7479.png

 

It should looks like by pressing the "TAB"-Key:

 

image.png.da9509b8f2716166a68d6aabd119334d.png

 

Thanks in advanced!

 

Greetings

 

ListViewEditInput.au3

Edited by Misuranai
Link to comment
Share on other sites

Looks like that you may not be using an updated version of that UDF, which you can find here: 


The author did an update specifically to support what you're looking for, though they only provided an example with the Enter and ESC keys.

I was interested in this, so I did play around with it and managed to add tabbing functionality, though it's not great. It also really only works if you set "All" on both the Columns and Rows. It may be possible to extend it further to loop through and look for the next available editable field, but that's more work than I'm willing to try out on this.

Give this version that I updated a shot, and see if it works. Again, make sure to set your ListView to 'All': __ListViewEditInput_AddListview($Form1, $List1, "All", "All", "E")

One annoyance with it was that for me, when I tabbed to the next column, it didn't visually 'highlight' or select the text in the cell. However when you tab into a cell it does have the WHOLE cell selected, and whatever you type will replace what's in the cell by default. Again, you might be able to change it around some to resolve that.

ListViewEditInput.au3

 

Edit: Actually I'm dumb, I didn't check the actual example that @Kanashius provided in that linked post. In that example he did add a function for supporting tabbing himself, I haven't tried it out, but it looks a lot simpler than my approach. Either way, check out the original authors updated file and example, or my updated one. Both should have what you're looking for. Mine also drops to the first column on the next row when you tab while at the end of a row.

Edited by mistersquirrle

We ought not to misbehave, but we should look as though we could.

Link to comment
Share on other sites

1 hour ago, mistersquirrle said:

Looks like that you may not be using an updated version of that UDF, which you can find here: 


The author did an update specifically to support what you're looking for, though they only provided an example with the Enter and ESC keys.

I was interested in this, so I did play around with it and managed to add tabbing functionality, though it's not great. It also really only works if you set "All" on both the Columns and Rows. It may be possible to extend it further to loop through and look for the next available editable field, but that's more work than I'm willing to try out on this.

Give this version that I updated a shot, and see if it works. Again, make sure to set your ListView to 'All': __ListViewEditInput_AddListview($Form1, $List1, "All", "All", "E")

One annoyance with it was that for me, when I tabbed to the next column, it didn't visually 'highlight' or select the text in the cell. However when you tab into a cell it does have the WHOLE cell selected, and whatever you type will replace what's in the cell by default. Again, you might be able to change it around some to resolve that.

ListViewEditInput.au3 22.58 kB · 4 downloads

 

Edit: Actually I'm dumb, I didn't check the actual example that @Kanashius provided in that linked post. In that example he did add a function for supporting tabbing himself, I haven't tried it out, but it looks a lot simpler than my approach. Either way, check out the original authors updated file and example, or my updated one. Both should have what you're looking for. Mine also drops to the first column on the next row when you tab while at the end of a row.

Hi,

thanks for the fast response and also the solution! Is that also possible to do it only for one column? I have a programm where I just want to tab on one column.

 

Best regards

Link to comment
Share on other sites

It's certainly possible, what you need is in my updated UDF file, since it has the code in there that handles both row and column tabbing. You would just remove the part that handles moving the column to the right and keep the part that moves the row down. Give it a shot, everything you should need is in the __ListViewEditInput_GoToNextCell() function of my file.

Again, Kanashius's example might also work for what you're looking to do, but I haven't looked at it enough to know.

We ought not to misbehave, but we should look as though we could.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...