Sign in to follow this  
Followers 0
Synthetic

Capturing ListView item change

3 posts in this topic

Hi,

I'm pretty new to AutoIt scripting, and this is my first go at using the GUI commands.

I have my small GUI working pretty much as I want, but I've been testing using the mouse to activate controls. I recently used the keyboard to move between items in my ListView and was shocked to see that the event did not fire for the ListViewItem in question.

I'm currently using MessageLoop mode, although I may switch to OnEvent - especially if it will easily solve this oversight. I added the following to my loop and it doesn't fire with a keypress.

If $msg > 0 Then
    If msgbox(1, "msg", $msg) = 2 Then Exit
EndIf

Am I right in assuming I am going to have to implement a totally new layer to check for key presses? :shocked:

All help appreciated.

Share this post


Link to post
Share on other sites



Hi,

I'm pretty new to AutoIt scripting, and this is my first go at using the GUI commands.

I have my small GUI working pretty much as I want, but I've been testing using the mouse to activate controls. I recently used the keyboard to move between items in my ListView and was shocked to see that the event did not fire for the ListViewItem in question.

I'm currently using MessageLoop mode, although I may switch to OnEvent - especially if it will easily solve this oversight. I added the following to my loop and it doesn't fire with a keypress.

If $msg > 0 Then
    If msgbox(1, "msg", $msg) = 2 Then Exit
EndIf

Am I right in assuming I am going to have to implement a totally new layer to check for key presses? :shocked:

All help appreciated.

What do you want to happen when you click on an item in your listview?

If you just want to know which item is selected then you can add this line inside your while 1 loop

$Selecteditem = _GUICtrlListViewGetCurSel($MyListView);requires #include <GuiListView.au3>

and you could have something like

If $Selecteditem <> $lastItem then

do something about the change

$lastItem = $Selecteditem

endif


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

What do you want to happen when you click on an item in your listview?

If you just want to know which item is selected then you can add this line inside your while 1 loop

$Selecteditem = _GUICtrlListViewGetCurSel($MyListView);requires #include <GuiListView.au3>

and you could have something like

If $Selecteditem <> $lastItem then

do something about the change

$lastItem = $Selecteditem

endif

Thanks for the response martin.

I already have the ListView acting as I want when I click on an item with the mouse, it's just when I change item by using up or down it is not triggering an event and therefore not firing the code I already have.

That said, maybe I will just have to keep checking with _GUICtrlListViewGetCurSel() and act accordingly.

However, I assume this rules out using OnEvent, as no event will actually have fired? :shocked:

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
Sign in to follow this  
Followers 0