Shoutbox

[Tool/Developer] MessageBox (Version 1.0) - 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: [Tool/Developer] MessageBox (Version 1.0) (/showthread.php?tid=69675)

[Tool/Developer] MessageBox (Version 1.0) by Spunky on 12-19-2006 at 06:28 AM

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)
RE: [Release] MessageBox (Version 1.0) by RaceProUK on 12-19-2006 at 10:29 AM

* RaceProUK downloads


RE: [Release] MessageBox (Version 1.0) by BraydenP on 12-19-2006 at 10:43 AM

Hello,

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

Thanks,

BraydenP.


RE: [Release] MessageBox (Version 1.0) by Spunky on 12-20-2006 at 01:28 AM

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)


RE: [Tool/Developer] MessageBox (Version 1.0) by deAd on 12-20-2006 at 01:58 AM

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.
RE: [Tool/Developer] MessageBox (Version 1.0) by -dt- on 12-20-2006 at 03:53 AM

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
RE: [Tool/Developer] MessageBox (Version 1.0) by Spunky on 12-20-2006 at 11:00 AM

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 :$