Shoutbox

Problem with Plus windows.. - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Problem with Plus windows.. (/showthread.php?tid=80691)

Problem with Plus windows.. by SmokingCookie on 01-04-2008 at 06:07 PM

Hi,

I can't get ANY Plus! window to show an image background.
Can anybody tell me what I've done wrong (this time)?

The .JS code:

code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message) {
    if(Message == "/OpenWnd") {
        var Wnd = MsgPlus.CreateWnd("Windows.xml", "WndAbt");
    }
}


The XML code:

code:
<?xml version="1.0" encoding="UTF-16"?>
<Interfaces xmlns="urn:msgplus:interface" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:msgplus:interface PlusInterface.xsd">
    <Window Id="WndAbt" Version="1">
    <Attributes>
        <Caption>TestWindow</Caption>
    </Attributes>
   
        <TitleBar>
            <AllowMinimize>false</AllowMinimize>
            <Title>
                <Text>TestWindow</Text>
            </Title>
        </TitleBar>
        <Position Width="860" Height="600"/>
        <DialogTmpl/>
    </Window>
    <Elements>
        <Element xsi:type="ImageElement" Id="ImgBackgrnd">
            <Position Top="100" Left="100"/>
            <Image>
                <Name>C:\Program Files\Messenger Plus! Live\Scripts\New Message Alert\IMG\Backgrnd</Name>
                <Format>PNG</Format>
            </Image>
        </Element>
    </Elements>
</Interfaces>


RE: Problem with Plus windows.. by matty on 01-04-2008 at 06:11 PM

You cannot specify the image like that.

You have 2 options

Option 1:
Put the image in an Images directory and just put the filename between <name></name>

Option 2:
Set the image by using code that way you can specify the full path.


RE: Problem with Plus windows.. by pollolibredegrasa on 01-04-2008 at 06:14 PM

quote:
Originally posted by SmokingCookie

code:
                <Name>C:\Program Files\Messenger Plus! Live\Scripts\New Message Alert\IMG\Backgrnd</Name>



If you supply a full path to the image then you need to prefix it with \.

However, if you create a folder in your script's folder called "images", and place your images in there then you don't need to supply a full path at all, you just need to put the image name ;)

bah beaten to it...
RE: RE: Problem with Plus windows.. by SmokingCookie on 01-04-2008 at 06:17 PM

quote:
Originally posted by matty
You cannot specify the image like that.

You have 2 options

Option 1:
Put the image in an Images directory and just put the filename between <name></name>

Option 2:
Set the image by using code that way you can specify the full path.

First option didn't work.. I never knew about your 2nd option.. Could you please explane it (if possible with a clear example)? Btw, I'm a bit new to scripting..
RE: Problem with Plus windows.. by matty on 01-04-2008 at 06:49 PM

code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message) {
    if(Message == "/OpenWnd") {
        var Wnd = MsgPlus.CreateWnd("Windows.xml", "WndAbt");
        Wnd.ImageElmt_SetImageFile('ImgBackgrnd', '\\'+Messenger.ScriptFilesPath+'\\Images\\Background.png'); //i am assuming it is a png file.
    }
}

RE: Problem with Plus windows.. by SmokingCookie on 01-04-2008 at 06:53 PM

THANKS!!!!! :D


RE: Problem with Plus windows.. by Matti on 01-04-2008 at 07:07 PM

Although it's recommended that you just place your images in the "Images" folder, so you don't even need to call ImageElmt_SetImageFile. It would be a pain in the @$$ if you have to call that function for every image in your window, and even then, you wouldn't be able to use images in buttons, combo-box controls,...


RE: Problem with Plus windows.. by SmokingCookie on 01-04-2008 at 07:13 PM

Well, it's working now, so I don't care about images in buttons.. I can also use text, like "close" or "sluiten" (Dutch for "close")..

EDIT:: I've got 3 days of "vakantie" :P

EDIT2:: Can I also use this as a remote command? Like:

code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Message) {
    if(Message == "!OpenWnd") {
        var Wnd = MsgPlus.CreateWnd("Windows.xml", "WndAbt");
    }
}


RE: Problem with Plus windows.. by Matti on 01-04-2008 at 07:58 PM

quote:
Originally posted by SmokingCookie
Can I also use this as a remote command? Like:

code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Message) {
    if(Message == "!OpenWnd") {
        var Wnd = MsgPlus.CreateWnd("Windows.xml", "WndAbt");
    }
}


Sure, why not. However, I don't see the point of a remote command which opens a window. :P
RE: Problem with Plus windows.. by SmokingCookie on 01-04-2008 at 08:03 PM

'Coz I'm thinkong of doing it in future scripts :P

Merci, et bonne fin des vacanses :P
(sorry, that's what little French I speak.. Have lessons at school :D )