It seems that the background color for the image is set when the button is added. to work around this, when the background color is changed, re-add the button image. Since the button has the same name it seems to work just fine:
Code:
#!yab
doc Place a description of your
doc program here.
doc
doc Author, date, license
// set DEBUG = 1 to print out all messages on the console
DEBUG = 1
settingsdir$="/boot/home/config/settings/"
OpenWindow()
// Main Message Loop
dim msg$(1)
while(not leavingLoop)
nCommands = token(message$, msg$(), "|")
for everyCommand = 1 to nCommands
if(DEBUG and msg$(everyCommand)<>"") print msg$(everyCommand)
switch(msg$(everyCommand))
case "_QuitRequested"
case "MainWindow:_QuitRequested"
leavingLoop = true
break
case "test"
t=t+1
if t=1 then
DRAW SET "BGColor", 100,110,110, "mainview"
else
DRAW SET "BGColor", 100,155,155, "mainview"
t=0
endif
button image 25, 25, "test", settingsdir$+"test_pressed.png", settingsdir$+"test.png", "", "mainview"
break
default
end switch
next everyCommand
wend
CloseWindow()
end
// Setup the main window here
sub OpenWindow()
window open 100,100 to 600,500, "MainWindow", "Main Window"
view 0,0 to 500,400, "mainview" ,"MainWindow"
DRAW SET "BGColor", 100,155,155, "mainview"
button image 25, 25, "test", settingsdir$+"test_pressed.png", settingsdir$+"test.png", "", "mainview"
end sub
// Close down the main window
sub CloseWindow()
window close "MainWindow"
return
end sub