yab | yet another Basic for HAIKU

Full Version: transparency error in yab
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
www.lelldorin.de/screens/yab_tranparency_error.png

If i use buttons with transparency pictures and change then the background color the image of the button does not any more transparent.
Please show the code that caused this problem.
(12-24-2016, 04:13 PM)bbjimmy Wrote: [ -> ]Please show the code that caused this problem.

Why? It is only a image button and i use for the image button a picture (gif) with transparent color. It is not a special code or somethign like this.
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
Free Web Hosting