Showing results 1 to 6 of 6

Thread: Background Color of Button doesn´t change

  1. #1
    Join Date
    24.05.2012
    Location
    Augsburg
    Posts
    30

    Frage Background Color of Button doesn´t change

    Hi,

    i want to change the Background color of buttons in the RT in a function, when clicking on it
    i do in a macro

    public void Macro_ColorChange
    {
    this.DynPictures().Item("Picture1").Elements().Item("Button1").BackColor = 0xA0ACB3;
    this.DynPictures().Item("Picture1").Elements().Item("Button2").BackColor = 0x32CD32;
    }

    But this only works if i set a breakpoint at this place and step with F8 over the lines.


    help needed.

    Regards
    Armin

  2. #2

    Default Re: Background Color of Button doesn´t change

    Hi Armin,

    Have you considered using the dynamic color settings at the button, using a variable to define e.g. the background color?

    Best regards,
    Mark

  3. #3

    Default Re: Background Color of Button doesn´t change

    Hi Armin,

    When you do want to set the color through the API, call the "update" method after setting the BackColor property:

    this.DynPictures().Item("Picture1").Elements().Item("Button1").Update();

    Note that this color change will be reset after a reload, while a color change via dynamic colors using variables, remains "remanent".

    Regards,
    Mark

  4. #4
    Join Date
    24.05.2012
    Location
    Augsburg
    Posts
    30

    Daumen hoch Re: Background Color of Button doesn´t change

    Quote Originally Posted by markclemens View Post
    Hi Armin,

    When you do want to set the color through the API, call the "update" method after setting the BackColor property:

    this.DynPictures().Item("Picture1").Elements().Item("Button1").Update();

    Note that this color change will be reset after a reload, while a color change via dynamic colors using variables, remains "remanent".

    Regards,
    Mark
    Ok, you are right - i will use the variables.
    Thank you

  5. #5
    Join Date
    21.05.2014
    Posts
    32

    Default Re: Background Color of Button doesn´t change

    Hi mark,

    Can I also realize this one using variables to for backcolor

    suppose there are 20(or more than that) buttons. I want a change in colour of a button on click. and when another button is clicked, I want all the buttons to reset to their original colours except this new one.

    Thanks!
    Jyo

  6. #6

    Default Re: Background Color of Button doesn´t change

    Hi Jyo,

    Yes, that would also be possible. Depending on your needs, you could create an array of 20 Boolean variables and when one of these becomes TRUE, reset all the others to "FALSE" and use the limit colors of the Boolean variables to colorize buttons.

    Best regards,
    Mark

Similar Threads

  1. How to set CEL list single line background color.
    By antonetti in forum zenon Supervisor
    Replies: 2
    Last Post: 13th June 2013, 08:39
  2. Replies: 1
    Last Post: 7th June 2013, 16:14
  3. Replies: 3
    Last Post: 1st May 2013, 21:31
  4. how to change text and color of invisible button
    By tanveerali in forum zenon Supervisor
    Replies: 1
    Last Post: 14th February 2011, 00:09
  5. Option button background color wrong
    By russelldrown in forum VBA
    Replies: 19
    Last Post: 5th May 2009, 12:51

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •