Shoutbox

Labels on Preferences Tabs - 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: Labels on Preferences Tabs (/showthread.php?tid=90822)

Labels on Preferences Tabs by wincy on 05-28-2009 at 04:58 PM

Hello, i have this code:

<Control xsi:type="RadioControl" Id="RadSettings">
    <Position Top="8" Width="82" Left="10" Height="18"/>
    <Attributes><IsNewGroup>true</IsNewGroup></Attributes>
    <CustomLook>
        <FocusRect>
            <Left>2</Left><Top>0</Top><Right>2</Right><Bottom>0</Bottom>
        </FocusRect>
        <Base/>

        <Normal>
            <Unchecked>
                <Element xsi:type="ImageElement" Id="ImgGnral">
                    <Position Top="0" Left="0"/>
                    <Image><Name>preferences_top_tabs_off_color</Name></Image>
                    <Colorization Enable="true"><Color><BaseColor/></Color></Colorization>
                </Element>
                <Element xsi:type="TextElement" Id="TxtSettings1">
                    <Position Top="4" Left="9"/><Font><Size>9</Size></Font>
                </Element>
            </Unchecked>
            <Checked>
                <Element xsi:type="ImageElement" Id="ImgGnral2">
                    <Position Top="0" Left="0"/>
                    <Image><Name>preferences_top_tabs_on_bw</Name></Image>
                </Element>
                <Element xsi:type="ImageElement" Id="ImgGnral">
                    <Position Top="0" Left="0"/>
                    <Image><Name>preferences_top_tabs_on_color</Name></Image>
                    <Colorization Enable="true"><Color><BaseColor/></Color></Colorization>
                </Element>
                <Element xsi:type="TextElement" Id="TxtSettings2">
                    <Position Top="4" Left="8"/><Font><Size>9</Size><Bold>true</Bold></Font>
                </Element>
            </Checked>

        </Normal>
        <Hot>
            <Unchecked>
                <Element xsi:type="ImageElement" Id="ImgGnral">
                    <Position Top="0" Left="0"/>
                    <Image><Name>preferences_top_tabs_hover_color</Name></Image>
                    <Colorization Enable="true"><Color><BaseColor/></Color></Colorization>
                </Element>
                <Element xsi:type="TextElement" Id="TxtSettings3">
                    <Position Top="4" Left="9"/><Font><Size>9</Size></Font><Text>Settings</Text>
                </Element>
            </Unchecked>
            <Checked>
                <Element xsi:type="ImageElement" Id="ImgGnral2">
                    <Position Top="0" Left="0"/>
                    <Image><Name>preferences_top_tabs_on_bw</Name></Image>
                </Element>
                <Element xsi:type="ImageElement" Id="ImgGnral">
                    <Position Top="0" Left="0"/>
                    <Image><Name>preferences_top_tabs_on_color</Name></Image>
                    <Colorization Enable="true">
                    <Color><BaseColor><Transparency>180</Transparency></BaseColor></Color>
                    </Colorization>
                </Element>
                <Element xsi:type="TextElement" Id="TxtSettings4">
                    <Position Top="4" Left="8"/><Font><Size>9</Size><Bold>true</Bold></Font>
                </Element>
            </Checked>
        </Hot>

        <Pushed>
            <Unchecked>
                <Element xsi:type="ImageElement" Id="ImgGnral2">
                    <Position Top="0" Left="0"/>
                    <Image><Name>preferences_top_tabs_on_bw</Name></Image>
                    <Transparency>100</Transparency>
                </Element>
                <Element xsi:type="ImageElement" Id="ImgGnral">
                    <Position Top="0" Left="0"/>
                    <Image><Name>preferences_top_tabs_on_color</Name></Image>
                    <Colorization Enable="true"><Color><BaseColor/></Color></Colorization>
                </Element>
                <Element xsi:type="TextElement" Id="TxtSettings5">
                    <Position Top="4" Left="9"/><Font><Size>9</Size></Font>
                </Element>
            </Unchecked>
            <Checked>
                <Element xsi:type="ImageElement" Id="ImgGnral2">
                    <Position Top="0" Left="0"/>
                    <Image><Name>preferences_top_tabs_on_bw</Name></Image>
                    <Transparency>100</Transparency>
                </Element>
                <Element xsi:type="ImageElement" Id="ImgGnral">
                    <Position Top="0" Left="0"/>
                    <Image><Name>preferences_top_tabs_on_color</Name></Image>
                    <Colorization Enable="true"><Color><BaseColor/></Color></Colorization>
                </Element>
                <Element xsi:type="TextElement" Id="TxtSettings6">
                    <Position Top="4" Left="8"/><Font><Size>9</Size><Bold>true</Bold></Font>
                </Element>
            </Checked>
        </Pushed>
    </CustomLook>
</Control>


like in MP!L's Preferences Panel (Top Tabs).
Is there a way to give the same text to all TextElements instead of using
Wnd.Button_SetElementText("RadSettings", "TxtSettings1", "label")
Wnd.Button_SetElementText("RadSettings", "TxtSettings2", "label");
Wnd.Button_SetElementText("RadSettings", "TxtSettings3", "label");
Wnd.Button_SetElementText("RadSettings", "TxtSettings4", "label");...ecc

I'm not looking for a loop or "for(x in RadSettings...exx", i would like to make only one label for each tab. Is it possible?

Thanks in advance :)


RE: Labels on Preferences Tabs by SmokingCookie on 05-28-2009 at 07:35 PM

This?

JScript code:
var Tabs = {
    "RadSettings":  "Settings",
    "RdiOtherTab":  "Other tab"
    // Etc.
}
 
function LoadTabs(PlusWnd) {
    for(var i in Tabs) {
        for(var e = 1; e <= 4; e++) PlusWnd.Button_SetElementText(i,"TxtSettings" + e,Tabs[i]);
    }
}


It loops through the Tabs object. For each i in the Tabs object, it'll do four loops, setting text to the control with ID i, TxtSettings followed by the number e and the text as specified in the Tabs object. You need to pass a PlusWnd object to the LoadTabs function.
RE: Labels on Preferences Tabs by foaly on 05-28-2009 at 08:04 PM

quote:
Originally posted by SmokingCookie
I'm not looking for a loop or "for(x in RadSettings...exx"
quote:
Originally posted by SmokingCookie
It loops through the Tabs object
quote:
Originally posted by SmokingCookie
This?

So I guess this is not the solution he is looking for...
RE: RE: Labels on Preferences Tabs by SmokingCookie on 05-28-2009 at 08:07 PM

quote:
Originally posted by foaly
So I guess this is not the solution he is looking for...

I guess ReadSettings is something different than Tabs...
RE: Labels on Preferences Tabs by wincy on 05-29-2009 at 12:21 PM

Here is what RadSettings is:
[Image: tabavw.jpg]

However i think i'm gonna use your code, SmokingCookie.
Thanks!