Refill ListBox appends to the list

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
kdaube
Posts: 86
Joined: 02 Nov 2015, 03:11

Refill ListBox appends to the list

23 Jul 2017, 06:51

Dear all,
I want to change the contents of the listbox (in this test by button):

Code: Select all

global wordList := "word-1|word-2"

Gui, Add, ListBox,  x005 y005 w170 h120 multi   vWords,     %wordlist%
Gui, Add, Button,   x200 y005 w120 h020         gChange,    Change content 
Gui, Show,          x800 y300 h150 w350
Return

Change:
  Gui, Submit, noHide 
  wordList := "word-3|word-4"
  GuiControl,, Words, %wordList%
Return

GuiClose:   
ExitApp
But the contents of the box is enlarged with each action of the butt - rather than filled with new content.
Whre is my error?

Thank You for any help
Klaus Daube
Klaus Daube, Zürich, CH
Guest

Re: Refill ListBox appends to the list

23 Jul 2017, 07:47

Just start the new list with a | so wordList := "|word-3|word-4"
User avatar
kdaube
Posts: 86
Joined: 02 Nov 2015, 03:11

Re: Refill ListBox appends to the list

23 Jul 2017, 12:31

Hello Guest: Thank You very much - but how could I know?
Klaus Daube, Zürich, CH
Guest

Re: Refill ListBox appends to the list

23 Jul 2017, 13:21

GuiControl wrote:Tab/DropDownList/ComboBox/ListBox: Param3 should contain a pipe-delimited list of entries to be appended at the end of the control's list. To replace (overwrite) the list instead, include a pipe as the first character (e.g. |Red|Green|Blue).
-- Source: https://autohotkey.com/docs/commands/GuiControl.htm

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mikeyww, OrangeCat and 81 guests