Sign in to follow this  
Followers 0
Nexx

GUICtrlSetData

10 posts in this topic

#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



Oh, isn't this lovely.

Anthropomorphism in action.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

http://www.psychwiki.com/wiki/Anthropomorphism.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

OK thanks, it was with $List1 not with that other one. Thanks again

Share this post


Link to post
Share on other sites

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

Because you are not setting it correctly:

HotKeySet("{" & GUICtrlRead($List1) & "}", "parar")

Thanks

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