Nexx 0 Posted February 16, 2011 #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 438, 192, 124) $List1 = GUICtrlCreateList("", 160, 48, 41, 58) $readData = GUICtrlSetData(-1, "Bye|Bye2|Hello|Hello2") $Button1 = GUICtrlCreateButton("Button1", 272, 64, 89, 65) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() if $nMsg = $Button1 Then MsgBox(0, GUICtrlRead($ReadData), GUICtrlRead($ReadData)) EndIf Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $List1 EndSwitch WEnd Hey. As you can see what I wanna do is to read the selected item of the list. So when I click the button1, it should say Bye, Hello, Bye2, or Hello2, depending on which one I've selected. But it doesn't, the GUIctrlread reads "0". How can I read the relected item? Thanks! Share this post Link to post Share on other sites
AdmiralAlkex 125 Posted February 16, 2011 What does GUICtrlRead() wants?The control identifier (controlID) as returned by a GUICtrlCreate... function.Is that what you are giving it? No.Think about that. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Share this post Link to post Share on other sites
trancexx 1,013 Posted February 16, 2011 Oh, isn't this lovely. Anthropomorphism in action. ♡♡♡ . eMyvnE Share this post Link to post Share on other sites
AdmiralAlkex 125 Posted February 16, 2011 I don't get it. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Share this post Link to post Share on other sites
guinness 1,518 Posted February 16, 2011 http://www.psychwiki.com/wiki/Anthropomorphism. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Share this post Link to post Share on other sites
Nexx 0 Posted February 16, 2011 OK thanks, it was with $List1 not with that other one. Thanks again Share this post Link to post Share on other sites
AdmiralAlkex 125 Posted February 16, 2011 Oh, isn't this lovely.Anthropomorphism in action.Yes, it's very lovely.(I got it) .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Share this post Link to post Share on other sites
Nexx 0 Posted February 16, 2011 Hey, more problems here :S #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 438, 192, 124) $List1 = GUICtrlCreateList("", 160, 48, 41, 58) GUICtrlSetData(-1, "F1|F3|F4|F5") $Button1 = GUICtrlCreateButton("Button1", 272, 64, 89, 65) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() if $nMsg = $Button1 Then MsgBox(0, GUICtrlRead($List1), GUICtrlRead($List1)) HOTKEYSET(GUICtrlRead($List1), "parar") EndIf Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $List1 EndSwitch WEnd Func PARAR() Exit 0 EndFunc Hmmm, why does it show "F5" at the msgbox, but it doesn't exit when I click F5?, ideas? thanks Share this post Link to post Share on other sites
Jos 2,211 Posted February 16, 2011 Because you are not setting it correctly: HotKeySet("{" & GUICtrlRead($List1) & "}", "parar") SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Share this post Link to post Share on other sites
Nexx 0 Posted February 16, 2011 Because you are not setting it correctly: HotKeySet("{" & GUICtrlRead($List1) & "}", "parar") Thanks Share this post Link to post Share on other sites