Jump to content

Clearing GUI List Control?


Justen
 Share

Recommended Posts

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
Link to comment
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
Link to comment
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.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...