Sign in to follow this  
Followers 0
Justen

Clearing GUI List Control?

3 posts in this topic

#1 ·  Posted (edited)

I'm new to AutoIt3, and I would like to clear the GUI List control of all data. So it will be cleared.

I was thinking it can be done with GUICtrlSetData. But I do not know what message needs to be sent.

(This isn't the full script)

$List1 = GUICtrlCreateList("Accounts", 112, 40, 161, 227)

Func Event_Button1()
   $UsernamePath = FileOpenDialog ("Select Account List...", @ScriptDir, "Text files (*.txt)", 1, "Accounts.txt")
   LoadAccountArray()
;Here is where we clear the list control
   For $i = 1 to $Account[0]
      GuiCtrlSendMsg($List1, 0x0180, 0, $Account[$i])
  Next
  Return
EndFunc

func LoadAccountArray()
   $Account = StringSplit (FileRead($UsernamePath), Chr(10))
   For $i = 1 to $Account[0]
      $Account[$i] = StringStripCR($Account[$i])
   Next
EndFunc

Any thoughts?

Edited by Justen

Share this post


Link to post
Share on other sites



Yes, use GuiCtrlSetData, simple like this:

Func Event_Button1()
   $UsernamePath = FileOpenDialog ("Select Account List...", @ScriptDir, "Text files (*.txt)", 1, "Accounts.txt")
   LoadAccountArray()
   GuiCtrlSetData($List1,"");Here is where we clear the list control
   For $i = 1 to $Account[0]
      GuiCtrlSendMsg($List1, 0x0180, 0, $Account[$i])
  Next
  Return
EndFunc

Share this post


Link to post
Share on other sites

Yes, use GuiCtrlSetData, simple like this:

Func Event_Button1()
   $UsernamePath = FileOpenDialog ("Select Account List...", @ScriptDir, "Text files (*.txt)", 1, "Accounts.txt")
   LoadAccountArray()
   GuiCtrlSetData($List1,"");Here is where we clear the list control
   For $i = 1 to $Account[0]
      GuiCtrlSendMsg($List1, 0x0180, 0, $Account[$i])
  Next
  Return
EndFunc
This is exactly what I needed. Thank you :P.

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