Hiding Button Background Color

About Monkey 2 Forums Monkey 2 Programming Help Hiding Button Background Color

This topic contains 7 replies, has 4 voices, and was last updated by  impixi 2 years, 2 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #7081

    Cole Chapman
    Participant

    I have a button with an image being rendered onto it so I do not need the grey background color.  In the docs it says I can set the alpha of BackgroundColor or BorderColor to 0 and it will not render it but I can’t seem to get that aspect to work and it continues to render.

    Any ideas?

    #7088

    Mark Sibly
    Keymaster

    Hi,

    Not sure if it’s the problem, but this is probably not doing what you expect:

    button.Style.BorderColor.A = 0

    Color values are ‘structs’ and structs are returned by value, so BorderColor is actually returning a copy of the border color, so you’re only modifying a copy which will have no effect. In fact, I think the compiler is supposed to catch this, could be an mx2cc bug.

    #7089

    Mark Sibly
    Keymaster

    The button’s gray background is actually due to the Skin and SkinColor style properties.

    My advice for skinning a gui would be to use App.Theme.Load() with a ‘theme file’. Alas no demo of this yet, but it’s used by Ted2 to load themes.

    #7094

    impixi
    Participant

    *Very* basic example:

    [/crayon]
    #7106

    Cole Chapman
    Participant

    Thank you! Thats exactly what I am after.  I am able to set the button image and alter colors on hover and active but how do I change the image?  To change colors you change iconColor but to change the image I have tried image, icon, etc and none of them seem to do the trick…

     

    Also what is the attribute called when you hover a standard button and a darker border appears around it?

    #7110

    impixi
    Participant

    Here’s a “better” example, doing things “properly”, using only skins this time. Themes should be stored in a “assets/themes” folder along with the relevant skin images. Bizarrely, setting the initial “UP”/default state skin in the theme file isn’t working – I must be missing something obvious. Instead I set the required image as the icon on Button creation. I’ll update this example when/if I figure it out…

    BTW: In this example use “skinColor” if you want to change the button state colors.

    [/crayon]

    Yes, someone needs to document MojoX: it’s actually a very powerful GUI library. Currently you need to poke around the module’s source files (and the TED source code) to figure it out, and that can take ages. 😉

    #7111

    Danilo
    Participant

    +1 for the MojoX GUI docs!

    #7113

    impixi
    Participant

    I’m seriously considering writing some comprehensive Mojo/MojoX docs. However, it would be a big job and distract me from my current project… Probably worth it though… We’ll see…

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.