XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently May 10th, 2025, 1:59 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Save VARs
PostPosted: September 3rd, 2012, 11:14 am 
Offline

Joined: September 2nd, 2012, 2:37 am
Posts: 17
Could you give any information about how SaveValue and SaveIni work?
I need to use vars like 'cookie' for settings ;)


Top
 Profile  
 
 Post subject: Re: Save VARs
PostPosted: September 3rd, 2012, 4:37 pm 
Offline
User avatar

Joined: May 12th, 2012, 8:32 pm
Posts: 594
you can uses setValue to save config, etc:

Code:
setValue("myconfig1","aaa");
saveIni;



and when widget Onload, you can load values,etc:

Code:
var  a = getValue("myconfig1","defaultValue");

_________________
XWidget Software Developer
[XWidget for Android] [Lastest version of XWidget] [Lastest patch of XWidget]
[XDesktop for Android/Windows]


Top
 Profile  
 
 Post subject: Re: Save VARs
PostPosted: September 3rd, 2012, 9:32 pm 
Offline

Joined: September 2nd, 2012, 2:37 am
Posts: 17
Thanks! :)


Top
 Profile  
 
 Post subject: Re: Save VARs
PostPosted: September 5th, 2012, 8:46 am 
Offline

Joined: September 2nd, 2012, 2:37 am
Posts: 17
what about set and get Array?
Can I save not string value?
Code:
setValue("images",imgArray);
getValue("images","defaultValue");

cause, I don't known why is not working for me.
Code:
runtime error 'imgArray[...].param' is null or not an object


or it should be like that? :(
Code:
for (var i=0;i<array.Length;i++)
{
      setValue('image'+i, array[i]);
}

for (var i=0;i<array.Length;i++)
{
     imgArray[i] = getValue('image'+i, "defaultValue");
}


Top
 Profile  
 
 Post subject: Re: Save VARs
PostPosted: September 6th, 2012, 12:11 am 
Offline
User avatar

Joined: June 10th, 2012, 5:57 am
Posts: 313
Shezoid wrote:
what about set and get Array?
Can I save not string value?



try it
Code:
function text1OnClick(Sender)
{
  var a=new Array(4,5);
  Setvalue("a",a)
}

function widgetOnLoad()
{
  var b = new Array(2,3);
  var c = new Array();
  c= GetValue("a",b)
}


Top
 Profile  
 
 Post subject: Re: Save VARs
PostPosted: September 6th, 2012, 3:12 am 
Offline

Joined: September 2nd, 2012, 2:37 am
Posts: 17
Quote:
GetValue("a",b)

Could you explain what does second param (b) on getValue and why?


Top
 Profile  
 
 Post subject: Re: Save VARs
PostPosted: September 6th, 2012, 4:52 am 
Offline
User avatar

Joined: June 10th, 2012, 5:57 am
Posts: 313
Shezoid wrote:
Quote:
GetValue("a",b)

Could you explain what does second param (b) on getValue and why?


if there is not a variable "a" in the file(for example, you have not SetValue() before), you will get b , b is a default value
you can understand it at this way
Code:
if(getvalue("a")==null) c=b;
else c=getvalue("a");


Top
 Profile  
 
 Post subject: Re: Save VARs
PostPosted: September 6th, 2012, 5:36 am 
Offline

Joined: September 2nd, 2012, 2:37 am
Posts: 17
Understood.

I found some bug...
Try this:
Code:
  var a=new Array(4,5);
  Setvalue("a",a);
  var b = new Array(2,3);
  var c = new Array();
  c= GetValue("a",b);
  print(c[0]);    //print:
  print(a[0]);    //print: 4
  print(c);        //print: 4,5
  print(a);        //print: 4,5


Top
 Profile  
 
 Post subject: Re: Save VARs
PostPosted: September 6th, 2012, 5:46 am 
Offline
User avatar

Joined: June 10th, 2012, 5:57 am
Posts: 313
i'm sorry , the getvalue() function can only get string variable
you setvalue() a Array variable , but the value is saved as string

we need a string variable to help
Code:
var a=new Array(4,5);
  Setvalue("a",a);
  var b = new Array(2,3);
  var c = new Array();
  var s;
  s= GetValue("a",b);
  c=s.split(",");


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

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 43 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