XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently 2017年 Oct 19日 22:49

All times are UTC - 8 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Save VARs
PostPosted: 2012年 Sep 3日 11:14 
Offline

Joined: 2012年 Sep 2日 02:37
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: 2012年 Sep 3日 16:37 
Offline
User avatar

Joined: 2012年 May 12日 20:32
Posts: 576
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: 2012年 Sep 3日 21:32 
Offline

Joined: 2012年 Sep 2日 02:37
Posts: 17
Thanks! :)


Top
 Profile  
 
 Post subject: Re: Save VARs
PostPosted: 2012年 Sep 5日 08:46 
Offline

Joined: 2012年 Sep 2日 02:37
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: 2012年 Sep 6日 00:11 
Offline
User avatar

Joined: 2012年 Jun 10日 05:57
Posts: 315
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: 2012年 Sep 6日 03:12 
Offline

Joined: 2012年 Sep 2日 02:37
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: 2012年 Sep 6日 04:52 
Offline
User avatar

Joined: 2012年 Jun 10日 05:57
Posts: 315
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: 2012年 Sep 6日 05:36 
Offline

Joined: 2012年 Sep 2日 02:37
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: 2012年 Sep 6日 05:46 
Offline
User avatar

Joined: 2012年 Jun 10日 05:57
Posts: 315
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: Bing [Bot], Yahoo [Bot] and 7 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