The script below will fetch an image (File - Image) from a path, given in a string parameter. This is useful when you want to use an image where you know it's path, e.g. you want to use the image (icon) of a Button from the Data Editor in a Dialog.
There are no fail-safes in the script, so use it with caution.
Implementing the script
Simply right-click the left-most side of the Trigger window and go to "New -> New Custom Script" (Ctrl+Alt+T). Copy the code from below, select the script you just created, and insert this into the right-most part of the Trigger window. The text will receive markup for you did this correctly.
brilliant.
a function that takes a string and returns exactly that string! :D
you can make it a little bit more useful by writing the function in gui and at least return an "image" (whats for sure a string, too). but even then its pretty pointless, since an image IS a string, whats the reason why you can also enter the path directly in custom script.
The script below will fetch an image (File - Image) from a path, given in a string parameter. This is useful when you want to use an image where you know it's path, e.g. you want to use the image (icon) of a Button from the Data Editor in a Dialog.
There are no fail-safes in the script, so use it with caution.
Implementing the script
Simply right-click the left-most side of the Trigger window and go to "New -> New Custom Script" (Ctrl+Alt+T). Copy the code from below, select the script you just created, and insert this into the right-most part of the Trigger window. The text will receive markup for you did this correctly.
That is one amazing line of code! ;)
Using the script
When you want to call the script, e.g. for setting the image of a Dialog Item, you must select the "Custom Script", like illustrated below:
IMPORTANT
You MUST use the double backslashes!
\\
Or we're all doomed! (Or maybe just your map).
Cheerio - Kafoso
Can't you just write the path immediately into the Custom Script field? Don't see why you need a function for it.
would do the trick as well, no?
@Klishu: Go
I suppose that would be possible, indeed. :)
brilliant.
a function that takes a string and returns exactly that string! :D
you can make it a little bit more useful by writing the function in gui and at least return an "image" (whats for sure a string, too). but even then its pretty pointless, since an image IS a string, whats the reason why you can also enter the path directly in custom script.