What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Tool/Developer] MessageBox (Version 1.0)

[Tool/Developer] MessageBox (Version 1.0)
Author: Message:
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
O.P. [Tool/Developer] MessageBox (Version 1.0)
This is another of those scripts made for developers (and another one based on Message Boxes ^o))... It allows you to create your own custom alerts and receive input from the user. All it requires is that you include one extra js file and one extra xml (and some SMALL images (3.29kb)) with your script. It saves the need for all those Interop.Call(s) to MessageBoxW and having to discover the right paramaters (such as which number you need for certain buttons). The syntax for the command is:
code:
function alert(
        sID        [String],                //Unique ID of the MessageBox (for user identification)
        nButtons [Number],                //Number of buttons
        sTitle    [String],                //MessageBox title (RichStaticControl)
        sMessage    [String],                //MessageBox message (RichStaticControl)
        nIcon    [Number],                //1-Information | 2-Question | 4-Exclamation | 8-Critical
        sButton1    [String],                //Button1 Text
        sButton2    [String, Optional],    //Button2 Text
        sButton3    [String, Optional],    //Button3 Text
        nTrans    [Number, Optional],    //Transparancy (Percentage)
);
Even though it says number for some of them, I delberately made it accept strings incase the developer was a n00b :refuck:

As it's just a PlusWnd, it has the same events. To detect a selection or a button press just use:

code:
function OnMessageBoxEvent_CtrlClicked(PlusWnd, ControlId){
...
...
}

This function is already in the js file

I have included the sID paramater so you can distinguish between message boxes (you might have two open at once, if you really need it, and one could be called "error_interop" and the other "savesettings").

Rather than checking for the ControlId in that function I have added a line that retrieves the caption of the button (which is set by you anyway). That way it doesn't get confusing about which buttons were shown and you can check for "Yes" or "No" rather than "btn_1" or "btn_2" etc.

You can also set the transparency of the window (using a function written by Matty) by setting the nTrans param to a number between 0 and 100.

Images can be edited and you can even, with a little bit of tweaking within the script, add more images.

The MessageBox uses RichStaticControls to support colours and other formatting styles.

The window uses the "Flair" style used in stickynotes, even if you can't really see it, I should credit deAd for it

Two Examples of the possibilities:
[Image: msgbox.bmp]

I hope people like it now (just spent 6 hours on it (kinda):p)

.plsc File Attachment: MessageBox.plsc (9.67 KB)
This file has been downloaded 158 time(s).

This post was edited on 12-20-2006 at 01:30 AM by Spunky.
<Eljay> "Problems encountered: shit blew up" :zippy:
12-19-2006 06:28 AM
Profile PM Find Quote Report
RaceProUK
Elite Member
*****

Avatar

Posts: 6073
Reputation: 57
39 / Male / Flag
Joined: Oct 2003
RE: [Release] MessageBox (Version 1.0)
* RaceProUK downloads
[Image: spartaafk.png]
12-19-2006 10:29 AM
Profile PM Web Find Quote Report
BraydenP
Disabled Account


Posts: 20
Reputation: 2
44 / – / –
Joined: Dec 2006
RE: [Release] MessageBox (Version 1.0)
Hello,

** BraydenP Downloads SpunkyLoveMuffs MessageBOX (Version 1.0) **

Thanks,

BraydenP.
12-19-2006 10:43 AM
Profile E-Mail PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
O.P. RE: [Release] MessageBox (Version 1.0)
You'll have to let me know how well it works lol

EDIT: Might also make it so that you can store params in an array and just pass the array when needed ^o)

This post was edited on 12-20-2006 at 01:31 AM by Spunky.
<Eljay> "Problems encountered: shit blew up" :zippy:
12-20-2006 01:28 AM
Profile PM Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
RE: [Tool/Developer] MessageBox (Version 1.0)
quote:
Originally posted by SpunkyLoveMuff
The window uses the "Flair" style used in stickynotes, even if you can't really see it, I should credit deAd for it
Woo :P If you want to make the flair more visible, lighten up the gradient. The flair image is the same one used for Plus! window titlebars, and you'll notice that the titlebars are all light -- even if the color is black. :)

quote:
Originally posted by SpunkyLoveMuff
It saves the need for all those Interop.Call(s) to MessageBoxW and having to discover the right paramaters (such as which number you need for certain buttons).
This is where constants make it easier. If want a messagebox with a question icon and an OK button, you could put 0x00000020 as the button flags, or you could use the easier approach of using MB_OK | MB_ICONQUESTION. Though you still have to define stuff, it saves a lot of work, makes code more organized, and makes it easier to change -- especially if you use a lot of messageboxes.

This post was edited on 12-20-2006 at 02:03 AM by deAd.
12-20-2006 01:58 AM
Profile PM Find Quote Report
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
36 / Male / Flag
Joined: Mar 2004
RE: [Tool/Developer] MessageBox (Version 1.0)
code:
<?xml version="1.0" encoding="UTF-16"?>
<Interfaces Name="feedreader windows" xmlns="urn:msgplus:interface" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:msgplus:interface
PlusInterface.xsd">
    <Window Id="MessageBox" Version="1">


strange =p
[Image: dt2.0v2.png]      Happy Birthday, WDZ
12-20-2006 03:53 AM
Profile PM Web Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
O.P. RE: [Tool/Developer] MessageBox (Version 1.0)
quote:
Originally posted by -dt-
code:
<?xml version="1.0" encoding="UTF-16"?>
<Interfaces Name="feedreader windows" xmlns="urn:msgplus:interface" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:msgplus:interface
PlusInterface.xsd">
    <Window Id="MessageBox" Version="1">


strange =p

Thats back from when I made my first script and I just reuse the same files but edit them :$
<Eljay> "Problems encountered: shit blew up" :zippy:
12-20-2006 11:00 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


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