Page 1 of 1

Adding images to Fields ?

Posted: Wed Sep 15, 2010 2:56 am
by MCla
I am preparing a help/info stack for an ecosystem analysis program.
There are quite a few equations and other small graphics I would like to add to scrolling fields that contains various font sizes, colors etc..(formatted text).

How do you add graphics in a scrolling field. Is this possible, easy. Or should I go a different way ?

Cheers,

Michel

Re: Adding images to Fields ?

Posted: Wed Sep 15, 2010 6:52 am
by Regulae
Hi there,

“imageSource” may suit your needs. This lets you assign an image to a character in a field (including scrolling fields). The Rev dictionary gives some examples:
set the imageSource of char 1 of line 2 of field "This" to 2533
set the imageSource of char thisChar of field 1 to "Arrow"
set the imageSource of last char of me to "binfile:My Image"
To automatically allow line space to display an image (which could be considerably bigger than the surrounding text) set the fixedLineHeight of the field to false. You mention your fields contain text of various sizes, so it sounds like the fixedLineHeight of the fields you are using is already set to false, but I thought it a useful thing to mention. I hope this helps.

Edit: another text property worth mentioning is "textShift", which may help adjust the alignment of images with surrounding text. Again, from the Rev dictionary:
set the textShift of last char of word 2 of field 1 to 3 -- subscript
set the textShift of char 12 of the selectedField to -1 -- superscript
Regards,
Michael

Re: Adding images to Fields ?

Posted: Thu Sep 16, 2010 4:59 pm
by shadowslash
or you can also use:

Image

Re: Adding images to Fields ?

Posted: Mon Feb 21, 2011 6:54 am
by Nonsanity
If I have a variable that was filled with a line like this:

Code: Select all

put url aTempImageURL into myImg
I can do this:

Code: Select all

set the text of img 1 to myImg
But these do not work:

Code: Select all

set the imageSource of char 1 of fld 1 to myImg
set the imageSource of char 1 of fld 1 to the imagedata of img 1
set the imageSource of char 1 of fld 1 to img 1
Is there a way to set a character's imageSource with data like this?

Re: Adding images to Fields ?

Posted: Mon Feb 21, 2011 3:25 pm
by jmburnod
Hi Nonsanity,

Code: Select all

set the imageSource of char 1 of fld 1 to the imagedata of img 1
dont work
but

Code: Select all

set the imageSource of char 1 of fld 1 to the short id of img 1
work
Best

Jean-Marc

Re: Adding images to Fields ?

Posted: Mon Feb 21, 2011 3:38 pm
by Nonsanity
Thanks, Jean-Marc.

I thought about that possibility once, but then thought that it would be silly. Makes sense now though. I should have at least tried it.