Announcement

Collapse
No announcement yet.

Change color of button once pressed

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Change color of button once pressed

    Hi everyone,

    I was hoping someone could help me.

    I have a small application which has maybe 12 buttons that do various tasks. I would like to be able to change the color of the button once it is pressed so i can see right away what buttons i have pressed and what buttons i have left to press.

    Any help is appreciated.

  • #2
    Buttons are merely zipped files renamed with a .btn extension. They contain png images (one image for each button state. ie. up/hover/down/disabled) and an XML file which specifies display properties. You can edit the color of any button manually by changing the png images. Or you can edit/build buttons according to your needs using the built-in Button Maker utility under the Tools menu.

    Additionally, you can control the appearance (properties) of a button programatically by:

    i) setting up a table of Button Properties
    ii) calling those properties via the Button.SetProperties command. eg.
    Code:
    -- Button object properties table.
    tblBtnProps = {};
    tblBtnProps.ButtonFile = "";
    tblBtnProps.Text = "";
    tblBtnProps.FontName = "Verdana";
    tblBtnProps.FontSize = 15;
    tblBtnProps.FontWeight = FW_BOLD;
    tblBtnProps.FontItalic = false;
    tblBtnProps.FontStrikeout = false;
    tblBtnProps.FontScript = ANSI_CHARSET;
    tblBtnProps.FontAntiAlias = true;
    tblBtnProps.FontUnderline = false;
    tblBtnProps.XOffset = 0;
    tblBtnProps.YOffset = 0;
    tblBtnProps.LeftMargin = 0;
    tblBtnProps.RightMargin = 0;
    tblBtnProps.Style = BTNSTYLE_STANDARD;
    tblBtnProps.ToggleState = BTN_UP;
    tblBtnProps.Cursor = CURSOR_HAND;
    tblBtnProps.TooltipText = "";
    tblBtnProps.Y = 0;
    tblBtnProps.X = 0;
    tblBtnProps.Height = 54;
    tblBtnProps.Width = 198;
    tblBtnProps.Enabled = true;
    tblBtnProps.Visible = true;
    tblBtnProps.ResizeLeft = false;
    tblBtnProps.ResizeRight = false;
    tblBtnProps.ResizeTop = false;
    tblBtnProps.ResizeBottom = false;
    tblBtnProps.HighlightSound = SND_STANDARD;
    tblBtnProps.HighlightSoundFile = "";
    tblBtnProps.ClickSound = SND_STANDARD;
    tblBtnProps.ClickSoundFile = "";
    tblBtnProps.ColorNormal = Math.HexColorToNumber("FFFFFF");
    tblBtnProps.ColorHighlight = Math.HexColorToNumber("FFFFFF");
    tblBtnProps.ColorDown = Math.HexColorToNumber("FFFFFF");
    tblBtnProps.ColorDisabled = Math.HexColorToNumber("FFFFFF");
    tblBtnProps.Alignment = ALIGN_CENTER;
    
    -- call the button properties with:
    Button.SetProperties("Button1", tblBtnProps);
    RTM, it's all in there.

    Comment

    Working...
    X