Shoutbox

Can an image be used as a control button? - 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: Can an image be used as a control button? (/showthread.php?tid=82819)

Can an image be used as a control button? by Hen on 03-30-2008 at 06:02 PM

Hi,
I want an image I put inside a window to act like a regular control button.
Is this possible, and how?
Thanks.


RE: Can an image be used as a control button? by markee on 03-30-2008 at 10:58 PM

Make a button control and use a custom look to achieve this.  This way you don't have to try to do anything crazy to get the image to act like a button.


RE: Can an image be used as a control button? by Hen on 04-01-2008 at 12:04 PM

Hi,
I turned into a dead end.
I am trying to resolve this in two ways, both did't work for me:
1)
I read:
http://shoutbox.menthix.net/showthread.php?tid=65974&page=1

And then I saw the simplest thing is to do a custom look with no content => the button is invisible.

Then I put an image element at the same spot.
The problem is, the image is bigger than the button.
Then I read:
http://shoutbox.menthix.net/showthread.php?tid=82412&pid=895524

Which talks about the same problem.
However, <MOSAIC> doesnt work, and the problem remains.
Can you help?
Here is the code:

XML :
<Elements>
....
    <Element xsi:type="ImageElement" Id="ImgPlay">
                                <Position Top="10" Left="90" width="10" height="10"/>
        <MOSAIC>ResizeToFit</MOSAIC>
                                <Image><Name>play</Name>
        </Image>
        <Format>JPG</Format>
     </Element>
</Elements>

Js:
Wnd.ImageElmt_SetImageFile('ImgPlay', 'play.jpg');

2)
I tried to do a custom look and insert the picture inside the button:
XML:
<Control xsi:type="ButtonControl" Id="BtnPlay">
                <Position Top="10" Width="20" Left="90" Height="20"/>
                <Caption>Play</Caption>
<CustomLook>
                    <Normal>
                            <Element xsi:type="ImageElement" Id="ImgPlay">
                                <Position Top="10" Left="90" width="10"

height="10"/>
                                <MOSAIC>ResizeToFit</MOSAIC>
                                <Image><Name>play</Name></Image>
                <Format>JPG</Format>
                            </Element>
                    </Normal>
                </CustomLook>
            </Control>

JS code:
Wnd.ImageElmt_SetImageFile('ImgPlay', 'play.jpg');
But here I guess there is a problem to set an image, which is inside custom look. This also was discussed earlier, but with no solution.
If the picture size is bigger than the button, I thought I need here also the MOSAIC command. Anyway, its not working.
It doesnt even show the picture (unlke in (1) where it shows the picture, but its size is huge, and doesnt effect by MOSAIC command).

Thanks a lot!


RE: Can an image be used as a control button? by Spunky on 04-01-2008 at 05:35 PM

If the picture is bigger than the button, is best to resize the picture manually and use that version. If a pic is in a CustomLook element it can't be set the same as a normal picture IIRC


RE: RE: Can an image be used as a control button? by Hen on 04-01-2008 at 07:04 PM

quote:
Originally posted by SpunkyLoveMuff
If the picture is bigger than the button, is best to resize the picture manually and use that version. If a pic is in a CustomLook element it can't be set the same as a normal picture IIRC

O.K, so after resizing manually, how do I use the custom look?
As I said - it doesnt show the picture.
and also, if I need to resize it, what's the MOSAIC command for?
Thanks.