Page 1 of 1

selectedText textFont not working?

Posted: Mon Sep 08, 2008 12:37 pm
by hamlynart
Hi Folks,

I can't work out what I'm doing wrong here.

set the textFont of the selectedChunk of fld "myField" to "Arial"

I have a font menu and when the user selects some text in field "myField" I want them to be able to change the font.

What am I doing wrong?

Thanks

Jim

Posted: Mon Sep 08, 2008 12:51 pm
by Janschenkel
Try this:

Code: Select all

on menuPick pFontName
  if the focusedObject is the long ID of field "MyField" then
    set the textFont of the selection to pFontName
  end if
end menuPick
The 'selectedChunk' property can be a little annoying to work with, as the engine may attempt to 'interpret' it before using it - and then it thinks it has ended up with the following instruction:

Code: Select all

set the textFont of "whatever the selected text is" to "Arial"
Hope this helped,

Jan Schenkel.

Posted: Mon Sep 08, 2008 12:57 pm
by hamlynart
Blimey, it works perfectly!

Thanks so much.

Jim