Changing media for a button by method

Questions, tips and tricks and techniques for scripting in Servoy

Changing media for a button by method

Postby drookwood » Mon Feb 02, 2004 3:58 pm

I have looked at crm and it looks simple but I cannot get this to work in my solution: all I want to do is set the media for a label on a form so that I can change the look of a button using a method.

When I trigger this method all I get is the text displayed (i.e. media:///client.png) instead of seeing the media file:

globals.button1="media:///clients.png" (clients.png is a media file I have imported)

I have set the label to display tags, and the text of the label is %%globals.button1%%.

Where am I going wrong?
drookwood
 
Posts: 290
Joined: Tue Nov 11, 2003 7:08 pm
Location: Somerset, UK

Postby aklodner » Mon Feb 02, 2004 4:19 pm

Hi there,

This is what I've found works for me. In design mode, select the original image and give it a name, in the name property, which then turns it into an element. Once it's an element, you can use the following step to set it to any image you want:

elements.myElementName.setImageURL('media:///clients.png');

If you go to the How To section of the forum, I posted a tips and tricks solution that has a bunch of little tricks like this.

Hope this helps.
Adam
aklodner
 
Posts: 26
Joined: Thu Sep 04, 2003 9:48 pm
Location: Cooper City, FL

Postby drookwood » Mon Feb 02, 2004 9:45 pm

Thanks Adam - works a treat!
drookwood
 
Posts: 290
Joined: Tue Nov 11, 2003 7:08 pm
Location: Somerset, UK


Return to Methods

Who is online

Users browsing this forum: No registered users and 32 guests

cron