XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently May 10th, 2025, 11:00 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Sustitute 00:00 ?...
PostPosted: December 11th, 2013, 6:42 am 
Offline
User avatar

Joined: June 12th, 2012, 11:05 am
Posts: 257
Location: Barcelona
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!


Top
 Profile  
 
 Post subject: Re: Sustitute 00:00 ?...
PostPosted: December 12th, 2013, 9:02 am 
Offline

Joined: October 26th, 2013, 8:17 am
Posts: 362
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


Top
 Profile  
 
 Post subject: Re: Sustitute 00:00 ?...
PostPosted: December 12th, 2013, 1:40 pm 
Offline
User avatar

Joined: June 12th, 2012, 11:05 am
Posts: 257
Location: Barcelona
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! ...


Top
 Profile  
 
 Post subject: Re: Sustitute 00:00 ?...
PostPosted: December 12th, 2013, 4:54 pm 
Offline

Joined: October 26th, 2013, 8:17 am
Posts: 362
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"
  }
}


Top
 Profile  
 
 Post subject: Re: Sustitute 00:00 ?...
PostPosted: December 13th, 2013, 1:51 am 
Offline
User avatar

Joined: June 12th, 2012, 11:05 am
Posts: 257
Location: Barcelona
Simply genial :) !!!!!
Thanks you very much Hamid!!!
Armando


Top
 Profile  
 
 Post subject: Re: Sustitute 00:00 ?...
PostPosted: December 17th, 2013, 5:40 am 
Offline
User avatar

Joined: June 12th, 2012, 11:05 am
Posts: 257
Location: Barcelona
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!


Top
 Profile  
 
 Post subject: Re: Sustitute 00:00 ?...
PostPosted: December 17th, 2013, 4:02 pm 
Offline

Joined: October 26th, 2013, 8:17 am
Posts: 362
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"
}
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 24 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB® Forum Software © phpBB Group