What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Button_SetCheckState problem

Button_SetCheckState problem
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Button_SetCheckState problem
Your original function
code:
function OnEvent_MenuClicked(MenuItemId, Location, OriginWnd){
if(MenuItemId == "About"){
MsgPlus.CreateWnd("about.xml", "about");
}

if(MenuItemId == "Options"){
MsgPlus.CreateWnd("options.xml", "options");
ReadSettings("options");
}
You are passing a string as the window object.

code:
function OnEvent_MenuClicked(MenuItemId, Location, OriginWnd){
    if(MenuItemId == "About"){
        MsgPlus.CreateWnd("about.xml", "about");
    }
    else if(MenuItemId == "Options"){
        var optionsWnd = MsgPlus.CreateWnd("options.xml", "options");
        ReadSettings(optionsWnd);
    }
}

This code passes the window object.

Alternately you can do this

code:
function OnEvent_MenuClicked(MenuItemId, Location, OriginWnd){
    if(MenuItemId == "About"){
        MsgPlus.CreateWnd("about.xml", "about");
    }
    else if(MenuItemId == "Options"){
        ReadSettings(MsgPlus.CreateWnd("options.xml", "options"));
    }
}



Also your read settings function can be altered

code:
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);
   
    optionsWnd.Button_SetCheckState("Abreum", (newfile.Readline() == 1 ? true : false));
    optionsWnd.Button_SetCheckState("Abredois",(newfile.Readline() == 1 ? true : false));
    optionsWnd.Button_SetCheckState("Abretres",(newfile.Readline() == 1 ? true : false));
    optionsWnd.Button_SetCheckState("signIn",(newfile.Readline() == 1 ? true : false));
    optionsWnd.Button_SetCheckState("sound", (newfile.Readline() == 1 ? true : false));
    optionsWnd.Button_SetCheckState("signOut",(newfile.Readline() == 1 ? true : false));
   
    newfile.Close();
}

code:
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);

    newfile.WriteLine(PlusWnd.Button_IsChecked("Abreum"));
    newfile.WriteLine(PlusWnd.Button_IsChecked("Abredois"));
    newfile.WriteLine(PlusWnd.Button_IsChecked("Abretres");
    newfile.WriteLine(PlusWnd.Button_IsChecked("signIn"));
    newfile.WriteLine(PlusWnd.Button_IsChecked("sound"));teLine(PlusWnd.Button_IsChecked("signOut"));

    newfile.Close();
}

This post was edited on 03-12-2008 at 06:24 PM by matty.
03-12-2008 06:15 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Button_SetCheckState problem - by WarPenguin on 03-12-2008 at 05:41 PM
RE: Button_SetCheckState problem - by Spunky on 03-12-2008 at 05:47 PM
RE: Button_SetCheckState problem - by WarPenguin on 03-12-2008 at 05:57 PM
RE: Button_SetCheckState problem - by matty on 03-12-2008 at 05:58 PM
RE: Button_SetCheckState problem - by WarPenguin on 03-12-2008 at 06:00 PM
RE: Button_SetCheckState problem - by matty on 03-12-2008 at 06:01 PM
RE: Button_SetCheckState problem - by WarPenguin on 03-12-2008 at 06:05 PM
RE: Button_SetCheckState problem - by matty on 03-12-2008 at 06:06 PM
RE: Button_SetCheckState problem - by WarPenguin on 03-12-2008 at 06:10 PM
RE: Button_SetCheckState problem - by matty on 03-12-2008 at 06:15 PM
RE: Button_SetCheckState problem - by WarPenguin on 03-12-2008 at 06:20 PM
RE: Button_SetCheckState problem - by matty on 03-12-2008 at 06:25 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On