XWidgetSoft Forum https://xwidget.com/bbs/ |
|
Sustitute 00:00 ?... https://xwidget.com/bbs/viewtopic.php?f=7&t=3891 |
Page 1 of 1 |
Author: | Armando [ December 11th, 2013, 6:42 am ] |
Post subject: | Sustitute 00:00 ?... |
How can sustitue "00:00" with "plug" into the text settings. Because ":" is used as code... I don't know if I am clear... sorry Thanks! |
Author: | hamid [ December 12th, 2013, 9:02 am ] |
Post subject: | Re: Sustitute 00:00 ?... |
Armando wrote: How can sustitue "00:00" with "plug" into the text settings. Because ":" is used as code... I don't know if I am clear... sorry Thanks! i don't understand your question correctly... but if you mean using ":" in "00:00" in the script code: you can use 00:00 in the "" and it will be translated as text: "00:00" and will be shown: 00:00 also you can use plus sign [+] to attach more than one text, like this: "00"+":"+"00" that will be shown: 00:00 |
Author: | Armando [ December 12th, 2013, 1:40 pm ] |
Post subject: | Re: Sustitute 00:00 ?... |
Thanks for your patience! What I'm traying is this: I want that when the "lifetime" battery (remaining charging time) is equal to "00:00" instead of showing that (00:00), that text be replaced by the text: "FULL". Usually I can easily replace a text, using the "sustitute" function. The sustitute function uses ":" to indicate that what is after the colon replaces what is before the colon... So if precisely what I want to replace is a text which includes the colon ... I have a problem ... Is now understand? Sorry, but I'm not good with English! ... |
Author: | hamid [ December 12th, 2013, 4:54 pm ] |
Post subject: | Re: Sustitute 00:00 ?... |
Armando wrote: Thanks for your patience! What I'm traying is this: I want that when the "lifetime" battery (remaining charging time) is equal to "00:00" instead of showing that (00:00), that text be replaced by the text: "FULL". Usually I can easily replace a text, using the "sustitute" function. The sustitute function uses ":" to indicate that what is after the colon replaces what is before the colon... So if precisely what I want to replace is a text which includes the colon ... I have a problem ... Is now understand? Sorry, but I'm not good with English! ... i think the function you are using is "substitute" or maybe its different in other languages anyway, i couldn't found a way to use ":" in substitute but you can use another way to do that: in the functions tab in designer there is a Event "OnChange" for text objects use it and add this to the code for it: Code: function text1OnChange(Sender)
{ if(text1.Text=="00:00") { text1.Text="FULL" } } |
Author: | Armando [ December 13th, 2013, 1:51 am ] |
Post subject: | Re: Sustitute 00:00 ?... |
Simply genial ![]() Thanks you very much Hamid!!! Armando |
Author: | Armando [ December 17th, 2013, 5:40 am ] |
Post subject: | Re: Sustitute 00:00 ?... |
I have a problem: when Text1.text it's no equal to "00.00" (it's change) what code I should write? Something like this: function text1OnChange(Sender) { if(text1.Text=="00:00") { text1.Text=" " } else { text1.Text=text1.Text; } } But this script doesn't work. Can you help me? Is writing correctly the "else" instruction? Thanks! |
Author: | hamid [ December 17th, 2013, 4:02 pm ] |
Post subject: | Re: Sustitute 00:00 ?... |
you don't need to write [else] for your above code, because text1.Text is always equal to text1.Text; it's not a need to use [else] command after each [if] command. so if you want text1.text change only if it is equal to "00:00" you could doing only with if command (no need of else command): Code: function text1OnChange(Sender) { if(text1.Text=="00:00") { text1.Text=" " } } but if you want to change text1.Text for other conditions than "00:00": then you will need [else] like this: Code: function text1OnChange(Sender) { if(text1.Text=="00:00") { text1.Text=" " } else { text1.Text="something else" } } and also if you want to change text1.Text only if it's not "00:00" then you will need to use "!=" (this means not equal) instead of "==" (this means equal): Code: function text1OnChange(Sender)
{ if(text1.Text!="00:00") { text1.Text="this is not equal to 00:00" } } |
Page 1 of 1 | All times are UTC - 8 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |