|
| [WB18] Change background color of a button |
| Iniciado por guest, 05,may. 2017 13:34 - 6 respuestas |
| |
| | | |
|
| |
| Publicado el 05,mayo 2017 - 13:34 |
Hello to all
First, i apologize for this stupid question, but this is my situation:
i have 5 buttons . At runtime, when the user push a button it must assume a RED Background color and the other remain GRAY as background.
this is the portion of code: for j=1 to 5 if j=1 then {"Button_"+j}..Brushcolor=lightred else {"Button_"+j}..Brushcolor=lightgray end end Unfortunately it seems that the bg color cannot be changed at runtime. Is it right or do am i missing something?
This is a screenshot of the window
Thanks in advance Gianni |
| |
| |
| | | |
|
| | |
| |
| Publicado el 05,mayo 2017 - 14:35 |
Hi Gianni,
You can change it at runtime.
I have had issues with the iteration. You would find it works with using the proper name of the button.
I have just done a quick test and it works,
I made cmd_button_colour. server code, ajax "disabled"
IF Static_colour..BrushColor=LightRed THEN Static_colour..BrushColor=LightGray ELSE Static_colour..BrushColor=LightRed END
This works correctly. have a quick look on my site it is there at the moment - http://www.kitchenpreserves.co.uk/UK/page-about-us.php
Mike |
| |
| |
| | | |
|
| | |
| |
| Publicado el 05,mayo 2017 - 15:38 |
Hi
this code should work -IF- the button is a TEXT button. If it uses am image for the background, then the image is ABOVE your background color and will not be visible
Best regards |
| |
| |
| | | |
|
| | |
| |
| Publicado el 05,mayo 2017 - 21:35 |
Hi Gianni,
Another thing to consider is that if you use indirection the affected controls need to be defined as "dynamic" type in the GUI tab. Standard is "automatic", but since the controls are addressed via text, Webdev does not know the control needs to be dynamic.
Kind regards, Piet |
| |
| |
| | | |
|
| | |
| |
| Publicado el 08,mayo 2017 - 08:40 |
Hi to all
Thanks for your suggestions
Gianni |
| |
| |
| | | |
|
| | |
| |
| Publicado el 11,mayo 2017 - 20:29 |
Gianni,
I just implemented this exact feature in WM21. As Fabrice noted, buttons with an image like those from a skin template have the background color hidden.
My code does this:
in global declarations: gsXBtnImage is string = BTN_Antecedent..BackgroundImage
To change from the startup BG color: BTN_Antecedent..BackgroundImage = "" BTN_Antecedent..BrushColor = LightGreen
To return to the default BG: BTN_Antecedent..BackgroundImage = gsXBtnImage
Bill |
| |
| |
| | | |
|
| | |
| |
| Publicado el 12,mayo 2017 - 11:55 |
Hello Bill
Thanks for the tips
Gianni |
| |
| |
| | | |
|
| | | | |
| | |
|