Jump to content

GUISetAccelerators problem with ListViewEditInput UDF

Recommended Posts

I want to use ENTER to Add to ListView and use ENTER to edit the ListView Items (by ListViewEdit UDF)

But It dont work!

Could anyone help me!!!

#Region ; GUI generated by GUIBuilderNxt Prototype 1.0

#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <Misc.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <ButtonConstants.au3>
#include <ListBoxConstants.au3>
#include <ListViewEditInput.au3>


Global $hMain = GuiCreate("MyGUI", 189, 186, -1, -1, $MainStyle)

Global $Input_1 = GuiCtrlCreateInput("", 20, 20, 80, 20)
Global $ADD = GuiCtrlCreateButton("ADD", 120, 20, 50, 20)
Global $List_3 = GuiCtrlCreateListView("Number | Name", 20, 50, 150, 130)

  Local $aAccelKeys[][] = [["{Enter}", $Add]]

   ;add listview, only edit col 1 and 2, doubleclick
   ;esc to cancel and enter to send
  ; __ListViewEditInput_InitializeKeys($hMain)
   ;register function, after editing a field
   ;register Function, when field not edited
    Switch GuiGetMsg()
        Case $GUI_EVENT_CLOSE

        Case $Add
           $Name = GUICtrlRead($Input_1)
           $Number = ControlListView("MyGui", "", $List_3, "GetItemCount") + 1
           GUICtrlCreateListViewItem($Number & "|" & $Name , $List_3)
           GUICtrlSetData($Input_1, "")
           ControlClick("MyGui", "", '[CLASS:Edit; INSTANCE:1]', "left")

Until False

P/S: The UDF I get from :



Edited by langthang084

Share this post

Link to post
Share on other sites
  1. You can't use GUISetAccelerators when included ListViewEditInput.au3, because __ListViewEditInput_InitializeKeys() also uses GUISetAccelerators.
  2. Use  $Number = _GUICtrlListView_GetItemCount($List_3)+1
Edited by AutoBert

Share this post

Link to post
Share on other sites

At first, you forgot to initialize the Enter and Escape key. Because of that, it would never do anything.

I have rewritten your Example and Edited my UDF, so you can pass your own Accelerator-Array (Except Enter and ESC. There you must give a function instead of the Control)

At the moment I have not enough time to edit the whole UDF, but after 16.02.2016 you can look there, I think I will add multiple Guis and Remove the use of Accelerators then.


Share this post

Link to post
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

  • Create New...