kalayaan Posted June 3, 2004 Posted June 3, 2004 Hello, Is there a way that clicks on listbox entries can be monitored? I noticed that the current autoit gui build doesn't support clicks on listboxes and pictures while JP's old (AU3GUI) build did. I know this because I have scripts compiled with the old versions that when I run the uncompiled script today, the functionality is gone. What I wish to do is to have events triggered when the user clicks on a listbox entry. Is there a work around without including an extra button that you need to press after selecting a listbox entry? Thanks in advance for the help/info. Kala
CyberSlug Posted June 3, 2004 Posted June 3, 2004 This should work, but it will not detect a click if you click the already selected item. #cs - ### Generated by AutoBuilder 0.4 -- do not modify ### 394 278 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 list $list_1 List 1 20 20 150 140 0 0 #ce - ### End of Dump ### ;Script generated by AutoBuilder 0.4--but modified Opt("WinTitleMatchMode", 4) $win = "handle=" & GuiCreate("MyGUI", 392,273,(@DesktopWidth-392)/2, (@DesktopHeight-273)/2) $list_1 = GUISetControl("list", "List 1", 20, 20, 150, 140, 0x0);UNsorted GUISetControlData($list_1, "one|two|three|four|five|six", "two") GuiShow() WinActivate($win) Global $selected = GUIRead($list_1) While GuiMsg(0) <> -3 sleep(100) $current = GuiRead($list_1) If $selected <> $current Then MsgBox(4096,"Notify", $current & " is now selected!") $selected = $current EndIf WEnd Exit Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
kalayaan Posted June 3, 2004 Author Posted June 3, 2004 CS, as is usual for you, this is just brilliant! Works great even when I integrated the code in the select case block generated by AutoBuilder. Thanks again.
mlazovjp Posted June 4, 2004 Posted June 4, 2004 What I wish to do is to have events triggered when the user clicks on a listbox entry. Is there a work around without including an extra button that you need to press after selecting a listbox entry?Thanks for posting that question. I was wondering that, too.Also, thanks again CyberSlug for the great answer!
Guest Arctor Posted June 4, 2004 Posted June 4, 2004 Is there a way that clicks on listbox entries can be monitored? I noticed that the current autoit gui build doesn't support clicks on listboxes...Hi all, wonder why it does not work for you with the normal way. This small script without extra style-definition for the listbox works for me. I got AutoIt-v3.0.102 FileChangeDir(@ScriptDir) GUICreate("See what happens", 240, 160) $label1 = GuiSetControl("label", ":::::::::::::::::::", 10, 10, 200, 20, 0x1000) $listbox1 = GuiSetControl ("list", "", 10, 40, 200, 60) GuiSetControlNotify() GUISetControlData($listbox1,"item1|item2|item3|item4|item5") ;-------------------------------- While GUIMsg() > 0 if GuiRead() = $listbox1 Then $selItem = GuiRead($listbox1) GuiWrite($label1,0,$selItem) ;;;;;;;;;MsgBox (0, "", $selItem) EndIf Wend If you uncomment the MsgBox you can see that it works also when the user clicks on a selected item. arctor
jpm Posted June 4, 2004 Posted June 4, 2004 Hi all, wonder why it does not work for you with the normal way. This small script without extra style-definition for the listbox works for me. I got AutoIt-v3.0.102 FileChangeDir(@ScriptDir) GUICreate("See what happens", 240, 160) $label1 = GuiSetControl("label", ":::::::::::::::::::", 10, 10, 200, 20, 0x1000) $listbox1 = GuiSetControl ("list", "", 10, 40, 200, 60) GuiSetControlNotify() GUISetControlData($listbox1,"item1|item2|item3|item4|item5") ;-------------------------------- While GUIMsg() > 0 if GuiRead() = $listbox1 Then $selItem = GuiRead($listbox1) GuiWrite($label1,0,$selItem) ;;;;;;;;;MsgBox (0, "", $selItem) EndIf Wend If you uncomment the MsgBox you can see that it works also when the user clicks on a selected item. arctorfor me under XP sp1 it work the same comment or uncommented
therks Posted June 4, 2004 Posted June 4, 2004 for me under XP sp1 it work the same comment or uncommented Works exactly as he said it would for me, and I'm also on XP SP1. Are you on professional or home? Maybe it makes a difference? My AutoIt Stuff | My Github
Guest Arctor Posted June 5, 2004 Posted June 5, 2004 for me under XP sp1 it work the same comment or uncommented Hmm... I just tried it under XP-Home. (SP1) It works. On Win 98 too. Don't know why it doesn't work on your machine. BTW I Just figured out that: $listbox1 = GuiSetControl ("list", "", 10, 60, 100, 80, 0xA00001) produces a listbox which is unsorted, has a scrollbar an gives a notify on click. (0xA00003 is Standard, but it's sorted.) I still miss the horizontal scrollbar. I need it bad... arctor
Valik Posted June 5, 2004 Posted June 5, 2004 Does nobody realize styles are a hell of a lot easier to talk about when you use their symbolic names instead of the values?
jpm Posted June 5, 2004 Posted June 5, 2004 Works exactly as he said it would for me, and I'm also on XP SP1. Are you on professional or home? Maybe it makes a difference?Pro I don't think that make differences
Valik Posted June 5, 2004 Posted June 5, 2004 You might have to specify LBS_NOTIFY manually as one of the styles. I remember there was a bug that LBS_NOTIFY wasn't always added when it was supposed to be. I can't remember if that bug was fixed or not.
Guest arctor Posted June 5, 2004 Posted June 5, 2004 Does nobody realize styles are a hell of a lot easier to talk about when you use their symbolic names instead of the values?Sorry, I can't talk about the symbolic name when I don't know it.The value 0xA00001 for the list box I found out with trying.In the Helpfie are just 6 styles for the listbox registered.But there are a lot more. For example I tried 0xC00001 for a listbox.With this value I could move the control on the GUI window.I wish to get a list of all the styles, that are possible.Any suggestions?arctor
jpm Posted June 6, 2004 Posted June 6, 2004 (edited) Sorry, I can't talk about the symbolic name when I don't know it. The value 0xA00001 for the list box I found out with trying. In the Helpfie are just 6 styles for the listbox registered. But there are a lot more. For example I tried 0xC00001 for a listbox. With this value I could move the control on the GUI window. I wish to get a list of all the styles, that are possible. Any suggestions? arctorWHen I add the appendix about GUI style, I add all what I find in the Msdn doc about style. Very few where suppress in my mind not related with AutoIt GUI implementation. I will be glad to update the doc. Just point out the missing and the irrelevant Thanks Edited: here follow the code I know the value (I am not an expert in style value) #define LBS_NOTIFY 0x0001L #define LBS_SORT 0x0002L #define LBS_NOREDRAW 0x0004L #define LBS_MULTIPLESEL 0x0008L #define LBS_OWNERDRAWFIXED 0x0010L #define LBS_OWNERDRAWVARIABLE 0x0020L #define LBS_HASSTRINGS 0x0040L #define LBS_USETABSTOPS 0x0080L #define LBS_NOINTEGRALHEIGHT 0x0100L #define LBS_MULTICOLUMN 0x0200L #define LBS_WANTKEYBOARDINPUT 0x0400L #define LBS_EXTENDEDSEL 0x0800L #define LBS_DISABLENOSCROLL 0x1000L #define LBS_NODATA 0x2000L #if(WINVER >= 0x0400) #define LBS_NOSEL 0x4000L #endif /* WINVER >= 0x0400 */ #define LBS_STANDARD (LBS_NOTIFY | LBS_SORT | WS_VSCROLL | WS_BORDER) Edited June 6, 2004 by jpm
Arctor Posted June 6, 2004 Posted June 6, 2004 #define LBS_NOTIFY 0x0001L ...Thx for the list. arctor
kalayaan Posted June 8, 2004 Author Posted June 8, 2004 wonder why it does not work for you with the normal way.This small script without extra style-definition for the listbox works for me.I got AutoIt-v3.0.102Gee, now it DOES work. I can only guess that since I was using the unstable build during the time that Jon was tinkering with the notify stuff (GUIMsg(0)). And I have just recently updated to the latest unstable. That's just a guess though. Since I build my GUIs with the help of CyberSlug's AutoBuilder, I also tried transposing your code into the format generated by AutoBuilder using GuiMsg(0) and it works when before it didn't.So, everything's ok now. Thanks for the info.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now