Shoutbox

[?] How do I do this contact thingy? - 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: [?] How do I do this contact thingy? (/showthread.php?tid=71191)

[?] How do I do this contact thingy? by roflmao456 on 01-30-2007 at 02:47 AM

I'm wondering how i can make an interface window with a list of my contacts and an OK button that does some action with the selected contacts and Cancel button?

i really do not know how to do this.. lool

so if someone can help me, thanks :)


RE: [?] How do I do this contact thingy? by Felu on 01-30-2007 at 05:12 AM

Create a List View Control and add the contacts to it. You can use Messenger.MyContacts for getting the contacts.
Here is an example of how i do it in @ScriptDev.

code:
<Window Id="WndSend" Version="1">
        <Attributes>
            <ShowInTaskbar>false</ShowInTaskbar>
            <TopMost>true</TopMost>
        </Attributes>
        <TitleBar>
            <AllowMinimize>false</AllowMinimize>
        </TitleBar>
        <Position Width="180" Height="200">
            <Resizeable Allowed="BothSides">
                <MinWidth>300</MinWidth>
                <MinHeight>200</MinHeight>
            </Resizeable>
        </Position>
        <DialogTmpl>
            <BottomBar Style="None">
                <RightControls>
                    <Control xsi:type="ButtonControl" Id="BtnSend">
                        <Position Top="0" Width="60" Left="0"></Position>
                        <Attributes><IsDefault>true</IsDefault></Attributes>
                        <Image Margin="5"><Name>buddy-script</Name></Image>
                        <Caption>Send</Caption>
                        <Help>Send to Selected Contacts</Help>
                    </Control>
                    <Control xsi:type="ButtonControl" Id="BtnCancel">
                        <Position Top="0" Width="60" Left="0"></Position>
                        <Image Margin="5"><Name>sounds-delete2</Name></Image>
                        <Caption>Close</Caption>
                        <Help>Close this window</Help>
                    </Control>
                </RightControls>
            </BottomBar>
        </DialogTmpl>
        <Elements/>
        <Controls>
            <Control xsi:type="ListViewControl" Id="Contacts">
                <Position Top="18" Left="10" Width="150" Height="150">
                    <Anchor Vertical="TopBottomFixed"/>
                </Position>
                <Attributes>
                    <AutoTip>true</AutoTip>
                    <AlwaysShowSelection>true</AlwaysShowSelection>
                </Attributes>
                <ReportView>
                    <ColumnHeader>false</ColumnHeader>
                    <FullRowSelect>true</FullRowSelect>
                    <HasCheckboxes>true</HasCheckboxes>
                </ReportView>
                <Images>
                    <SmallIcons>
                        <Image Id="Online">
                            <Name>buddy-online</Name>
                        </Image>
                        <Image Id="Busy">
                            <Name>buddy-busy</Name>
                        </Image>
                        <Image Id="Away">
                            <Name>buddy-away</Name>
                        </Image>
                    </SmallIcons>
                </Images>
                <Columns WidthFormat="Absolute">
                    <Column>
                        <ColumnId>contacts</ColumnId>
                    </Column>
                </Columns>
            </Control>
        </Controls>
    </Window>
code:
var StatusImg = new Array('', '', '', 'Online', 'Busy', 'Away', 'Away', 'Away', 'Busy', 'Away');
function Send2ContactWnd(){
    SendWnd = MsgPlus.CreateWnd("Interface.xml", "WndSend");
    LoadWndLang(SendWnd, "WndSend");
    Contacts = new Array();
    for(var e = new Enumerator(Messenger.MyContacts); !e.atEnd(); e.moveNext()){
        var Contact = e.item();
        if (Contact.Status > 2 && Contact.Network == 1){
            Contacts[Contacts.length] = Contact.Email;
            SendWnd.LstView_AddItem('Contacts', Contact.Email, 0);
            SendWnd.LstView_SetItemIcon('Contacts', SendWnd.LstView_GetCount('Contacts')-1, StatusImg[Contact.Status], true);        }
    }
}

RE: [?] How do I do this contact thingy? by roflmao456 on 01-30-2007 at 10:57 PM

omg thats soo cool :grin:

gonna use it now :P