Problem changing a buttons text

Get help with using AutoHotkey and its commands and hotkeys
Posts: 180
Joined: 22 Feb 2016, 10:49

Problem changing a buttons text

25 Dec 2020, 21:30

I have created a GUI with a button, which should display "remove from favorites" when a page is already a favorite, and "add to favorites" when a page is not yet a favorite.

There is a small routine which should set the caption of the button according to the variable FavIndex

Code: Select all

s:=FavIndex?"remove from favorites":"add to favorites"
debug("GUIControl s=" . s, A_Linenumber) ; writes debug output to a file to verify if s is correct
When I create the GUI

Code: Select all

gui add,button,gsaffzeigen w100,xxx
gosub SetFavTitle
the procedure Set FavTitle works fine, the button displays the correct title (and not "xxx"), depending on the value of Favindex.

But every second, I call a timer routine whicks checks if something has changed:

Code: Select all

for ind, s in FavURLs
    if (saffUrl=s)    ; saffurl always contains the url of the currently displayed page 
gosub SetFavTitle	
exit         ; exit the timer routine
and in that case, the display of the button does not change, although the debug output in setfavtitle shows that the correct string value for the title is passed to the command GuiControl.

Is it necessary to make another command to display the button again?
User avatar
Posts: 2060
Joined: 02 Oct 2015, 12:15

Re: Problem changing a buttons text

26 Dec 2020, 01:25


Code: Select all

; Create button:
gui add,button,gsaffzeigen vsaffFav w100,xxx

; Change button:

Return to “Ask For Help”

Who is online

Users browsing this forum: ark, Bing [Bot], LC99, mikeyww, Spawnova and 35 guests