Shoutbox

Setting button image during runtime - 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: Setting button image during runtime (/showthread.php?tid=91721)

Setting button image during runtime by tribbium on 08-01-2009 at 12:51 AM

Note: This is in reference to buttons that are not using CustomLook where the image is set inside the default grey rectangular button.

An example button containing an image follows:

code:
<Control xsi:type = "ButtonControl" Id = "EditQuestion">
    <Position Left = "56" Top = "105" Width = "80" Height = "13"/>
    <Image>
        <Name>add</Name>
    </Image>
</Control>

I want to be able to change the Image used during runtime. Since the image is not encapsulated in an ImageElement, I cannot use the function ImageElmt_SetImageFile to set it. How would you go about doing this?
RE: Setting button image during runtime by Spunky on 08-01-2009 at 12:57 AM

I'm fairly certain it's not possible, even using the API. Sorry.


RE: Setting button image during runtime by mathieumg on 08-01-2009 at 01:05 AM

I'm pretty sure it can be done by using the PlusWnd.SendControlMessage function and this.


RE: Setting button image during runtime by Spunky on 08-01-2009 at 09:31 AM

How would you get the Elements Id? Or would it just use the ID of the button control?


RE: Setting button image during runtime by Matti on 08-01-2009 at 09:58 AM

quote:
Originally posted by mathieumg
I'm pretty sure it can be done by using the PlusWnd.SendControlMessage function and this.
Good thinking, but I couldn't get it to work here. I created a HBITMAP from an image file and then tried to send its handle to a button control, but the button image didn't change. I think the button control of Plus! draws its image only on creation based on the XML and doesn't respond on messages such as BM_SETIMAGE. Too bad...