Sign in to follow this  
Followers 0
SlimShady

Empty listbox

4 posts in this topic

I would like to reset/empty the listboxes.

But I can't make it work.

I want to click on the refresh button to clear the listboxes.

See my script below.

Opt ("GUINotifyMode", 1)
   $Width = (@DesktopWidth / 4) * 3
   $Height = (@DesktopHeight / 4) * 3
   $Title = "File & Dir Compare"
   GUICreate($Title, $Width, $Height, -1, -1, BitOR(0x00010000, 0x00020000))
   
   Global $List_width
   $List_width = $Width / 2 - 30
   $label_1 = GUISetControl("label", "...", 15, 80, $List_width, 15)
   GUISetControlEx(-1, 0, 512 + 32, "", 0x000000, 0xffffff)
   
   $label_2 = GUISetControl("label", "...", $List_width + 40, 80, $List_width, 15)
   GUISetControlEx(-1, 0, 512 + 32, "", 0x000000, 0xffffff)
   
   $list_left = GUISetControl("list", "ListLeft", 15, 100, $List_width, $Height - 160, BitOR(0x0001, 0x0080, 0x1000))
   GUISetControlData(-1, "Item 1|Item 2")
   $list_right = GUISetControl("list", "ListRight", $List_width + 40, 100, $List_width, $Height - 160, BitOR(0x0001, 0x0080, 0x1000))
   GUISetControlData(-1, "Item 1|Item 2")

   $Refresh_btn = GUISetControl("button", Chr(164), $List_width + 20, $Height / 4, 15, 15, 0x8000)
   GUISetControlFont(-1, 13, 400, "")

   $CopyToLeft_btn = GUISetControl("button", Chr(171), $List_width + 20, $Height / 2, 15, 15, 0x8000)
   GUISetControlFont(-1, 13, 400, "")

   
   $CopyToRight_btn = GUISetControl("button", Chr(187), $List_width + 20, $Height / 2 + 20, 15, 15, 0x8000)
   GUISetControlFont(-1, 13, 400, "")
   
   $OK_btn = GUISetControl("button", "OK", $Width / 2 - 80, $Height - 55, 70, 20)
   GUISetControlEx(-1, 512)
   
   $Exit_Btn = GUISetControl("button", "Exit", $Width / 2 + 10, $Height - 55, 70, 20)
   
  ;$Filenames_dir1 = ListFiles ($inputdir_1)
  ;$Filenames_dir2 = ListFiles ($inputdir_2)
   
  ;OutPutFilenames ($Filenames_dir1, $Filenames_dir2, $inputdir_1, $inputdir_2)
  ;ProgressBar ("end", 0)
   
   GUIShow()
   
   $PrevAct = ""
   While 1
      $msg = GUIMsg()
      If $msg = -3 OR $msg = $Exit_btn Then
          GUIDelete()
          Exit
      Else
          GUIWrite($label_1, 256)
          If $msg = $Refresh_btn Then
             GUIWrite($list_left, -1, "")
             GUIWrite($list_right, -1, "")
          EndIf
      EndIf
      Sleep(100)
   WEnd

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Try writing just a pipe character "|".

Edit: Oh wait, you have to use GuiSetControlData() on a listbox, not GuiWrite().

Edited by Valik

Share this post


Link to post
Share on other sites

Sh*t... I forgot...

It's just confusing that 2 functions do the same: add/change text of controls.

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