I'm trying to track which Switch was switched before it was changed.
In the GotFocus event, I want to get the element number in the variable.
But gotfocus event doesn't work for Switch
LostFocus also does not work when switching to another element
Please help me figure this out.
Thank you for your quick response. Maybe you know how to distinguish who changed the state of Switch.chenged user or program. I was thinking of using GotFocus for this.
@TIMAI2 i want to follow your idea of setting up a variable, but how can i do that while i only have the .changed event? my switch can be changed automatically, but can also be triggered by a person when they click on it.. i wish there was something like a .clicked event.
The Changed() event can only be triggered by the user.
If an event occurred, the user clicked the switch.
This can be tracked in the global variable. (true/false)
About events in another element, change the states of all the others to false, and for the current element to true.
The above is not correct. Of course you can program the switch. In the below example i have used a button for demonstration purposes, but any other method, based upon some condition in the blocks can be used in the same way.
Yes, that's right. I was wrong.
Make your own global variable for each switch.
Make sure that it is always "true":
When calling "Changed()" in the program, change the corresponding one to "false" before "Changed()" then again to "true".
And in the "Changed()" event, monitor its status.
If "true" - the user clicked "click", if "false" the call is programmatic.
Bonjour à tous,
Je cherche à savoir comment maintenir un switch "on" ou "off" à chaque initialisation de l'application en fonction de si oui ou non la cellule de mon fichier Google Sheets lié est non vide ou vide. Auriez-vous la solution ? Impossible de trouver, je cherche depuis plusieurs jours.
Merci d'avance pour vos retours
You will need to test the google cell first (make a web call to the cell on the google sheet, and check if it is empty/non-empty) then set your switch accordingly. Do this at the start of your app, and prevent any other activity until this is done (progress dialog etc.)
Merci pour cette réponse rapide
Cependant, je n'ai pas qu'un seul switch mais 31 et je n'arrive pas à initier / créer une procédure globale pour lire la colonne et en fonction de si une cellule est vide ou non, mettre en correspondance indépendamment les switch individuellement. Et en retour (block "When Sheet1 Got Column Datas") les zones de textes "ChargesX" se remplissent avec le contenu de la colonne C, mais je souhaiterais que ces zones de textes associées aux switch soient instruites par la cellule correspondante de la colonne D. Si j'arrive à être clair
1 - Voici mes blocs pour la page "Charges" de l'application :
Votre réponse ne m'aide pas vraiment pourriez vous préciser un peu ce qui ne va pas dans ma démarche ?
Je souhaite que mes switch restent sur "on" à chaque initialisation de l'application ou à chaque modification du texte de la cellule concernée en colonne D. Ma liste de référence est en colonne C et je copie le montant vers la colonne D grâce aux switchs.
Mon problème est que je ne peux pas utiliser un "si la cellule est vide ou pleine" car le bloc "si / donc" ne gère pas cette condition directement avec les blocs d'appel "read row" ou "read column".
Je suis loin d'être expert, peut être faut-il ajouter un script ? ou peut-être comme vous dites je fonctionne à l'envers... Je suis vraiment au début de la construction des algorithmes.
Merci pour votre patience