FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV 2024
→
[WB18] Change background color of a button
[WB18] Change background color of a button
Débuté par Gianni Spano, 05 mai 2017 13:34 - 6 réponses
Connectez-vous…
Gianni Spano
#1
Posté le 05 mai 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
Signaler
0
0
cardcoder
#2
Posté le 05 mai 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
Signaler
0
0
Fabrice Harari
#3
Posté le 05 mai 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
Signaler
0
0
Piet van Zanten
#4
Posté le 05 mai 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
Signaler
0
0
Gianni Spano
#5
Posté le 08 mai 2017 - 08:40
Hi to all
Thanks for your suggestions
Gianni
Signaler
0
0
Bill Quinn
#6
Posté le 11 mai 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
Signaler
0
0
Gianni Spano
#7
Posté le 12 mai 2017 - 11:55
Hello Bill
Thanks for the tips
Gianni
Signaler
0
0
→ Revenir à WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte