O.P. RE: Button_SetCheckState problem
Here it is:
var AbreUm;
var AbreDois;
var AbreTres;
var SignIn;
var SignOut;
var Sound;
...(This functions have nothing to do with the options)
function OnEvent_MenuClicked(MenuItemId, Location, OriginWnd){
if(MenuItemId == "About"){
MsgPlus.CreateWnd("about.xml", "about");
}
if(MenuItemId == "Options"){
MsgPlus.CreateWnd("options.xml", "options");
ReadSettings("options");
}
}
function WriteSettings(PlusWnd){
Debug.Trace("Writing settings to file...");
var fso = new ActiveXObject("Scripting.FileSystemObject");
fso.CreateTextFile(MsgPlus.ScriptFilesPath + "\\Settings.txt",true);
var newfile = fso.OpenTextFile(MsgPlus.ScriptFilesPath + "\\Settings.txt",8,true);
if(PlusWnd.Button_IsChecked("Abreum") == true){
newfile.WriteLine("1");
}else{
newfile.WriteLine("0");
}
if(PlusWnd.Button_IsChecked("Abredois") == true){
newfile.WriteLine("1");
}else{
newfile.WriteLine("0");
}
if(PlusWnd.Button_IsChecked("Abretres") == true){
newfile.WriteLine("1");
}else{
newfile.WriteLine("0");
}
if(PlusWnd.Button_IsChecked("signIn") == true){
newfile.WriteLine("1");
}else{
newfile.WriteLine("0");
}
if(PlusWnd.Button_IsChecked("sound") == true){
newfile.WriteLine("1");
}else{
newfile.WriteLine("0");
}
if(PlusWnd.Button_IsChecked("signOut") == true){
newfile.WriteLine("1");
}else{
newfile.WriteLine("0");
}
newfile.Close();
}
function OnOptionsEvent_CtrlClicked(PlusWnd, ControlId){
if(ControlId == "BtnCancel"){
PlusWnd.Close(2);
}
if(ControlId == "OK"){
WriteSettings(PlusWnd);
PlusWnd.Close(1);
}
}
function ReadSettings(optionsWnd){
Debug.Trace("Reading settings from file...");
var fso = new ActiveXObject("Scripting.FileSystemObject");
var newfile = fso.OpenTextFile(MsgPlus.ScriptFilesPath + "\\Settings.txt",1,true);
Debug.Trace(typeof optionsWnd);
Debug.Trace(optionsWnd.Handle);
if(newfile.Readline() == 1){
AbreUm = true;
optionsWnd.Button_SetCheckState("Abreum",AbreUm);
}else{
AbreUm = false;
optionsWnd.Button_SetCheckState("Abreum",AbreUm);
}
if(newfile.Readline() == 1){
AbreDois = true;
optionsWnd.Button_SetCheckState("Abredois",AbreDois);
}else{
AbreDois = false;
optionsWnd.Button_SetCheckState("Abredois",AbreDois);
}
if(newfile.Readline() == 1){
AbreTres = true;
optionsWnd.Button_SetCheckState("Abretres",AbreTres);
}else{
AbreTres = false;
optionsWnd.Button_SetCheckState("Abretres",AbreTres);
}
if(newfile.Readline() == 1){
SignIn = true;
optionsWnd.Button_SetCheckState("signIn",SignIn);
}else{
SignIn = false;
optionsWnd.Button_SetCheckState("signIn",SignIn);
}
if(newfile.Readline() == 1){
Sound = true;
optionsWnd.Button_SetCheckState("sound", Sound);
}else{
Sound = false;
optionsWnd.Button_SetCheckState("sound", Sound);
}
if(newfile.Readline() == 1){
SignOut = true;
optionsWnd.Button_SetCheckState("signOut", SignOut);
}else{
SignOut = false;
optionsWnd.Button_SetCheckState("signOut", SignOut);
}
newfile.Close();
}
|