----- Original Message ----- From: "Doug" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, January 17, 2006 2:57 PM
Subject: Re: POLL: Which method do you use to apply bold and italics?


I've redefined over 60 shortcuts so they open a catalog instead
of creating an override.

Of course, IMO the ultimate redefinition solution is to redefine the
shortcuts so they apply character and/or paragraph formats.  What
could be simpler than redefining CTRL+B to apply a bold character
format?  This could benefit both novice and experienced writers alike.
I'm surprised this functionality isn't built into Frame, or at least
into Framescript (I haven't delved into the latter deeply enough to
discover it, if FS does indeed  possess this functionality).

--Doug

Hello All,

Funny that you should mention this. I wrote up this short FrameScript script today. It traps the Ctl-B or the Bold formatting button (also the Ctl-I or Italic button) and applies the named format instead. It will also create the character format if it is not already present. You can choose any name you wish (or better yet, choose an appropriate name from your template).

This script must be installed because it is an event script that waits quietly in the background for an appropriate event to occur.

This script can serve as a template for overriding just about any Frame Function that translates into an FCode.

Frank Elmore
Project leader for FrameScript


//--------------------------------------------------------------------------------------------------------------------------

// This is an Event Script. It must be 'Installed' to function. Use the FrameScript->Install command or
// the Install Script FrameScript command.

// You can replace the Character Format names below with ones of your own choosing.

Event Initialize

     // Names of the character formats to create/apply
  Set gvTxtBoldCharFmtName = 'MyBold';
  Set gvTxtItalicCharFmtName = 'MyItalic';

EndEvent

Event NotePreFunction

  If FrameDoc
If IParm = eUtl.FCode{'TxtBold'} // FCode for the Ctl-B or Bold Formatting Button
        Run ApplyBoldCharFmtToSelection pvDoc(FrameDoc);
Return Cancel; // Cancel the original BOLD (Ctl-B or B Button) command ElseIf IParm = eUtl.FCode{'TxtItalic'} // FCode for the Ctl-I or Italic Formatting Button
        Run ApplyItalicCharFmtToSelection pvDoc(FrameDoc);
Return Cancel; // Cancel the original ITALIC (Ctl-I or I Button) command
     EndIf
  EndIf

EndEvent

// The following subroutine gets the Character Format (specified by gvTxtBoldCharFmtName) and applies // it to the current selection. A new character format is created if it does not exist.
Sub ApplyBoldCharFmtToSelection using pvDoc

  Local lvCharFmt;

Get Object DocObject(pvDoc) Type(CharFmt) Name(gvTxtBoldCharFmtName) NewVar(lvCharFmt);
  If lvCharFmt = 0
     // If not present, make a new one
     Local lvStat lvPos;
Find Member('Bold') InList(FontWeightNames) ReturnStatus(lvStat) ReturnPos(lvPos);
     If lvStat
// Create character format with everything As Is except the Font weight which is Bold. New CharFmt NewVar(lvCharFmt) DocObject(pvDoc) Name(gvTxtBoldCharFmtName) FontWeight(lvPos - 1);
     EndIf
  EndIf

  If lvCharFmt
Apply TextProperties TextRange(pvDoc.TextSelection) Properties(lvCharFmt.Properties);
  EndIf

EndSub

// The following subroutine gets the Character Format (specified by gvTxtItalicCharFmtName) and applies // it to the current selection. A new character format is created if it does not exist.
Sub ApplyItalicCharFmtToSelection using pvDoc

  Local lvCharFmt;

Get Object DocObject(pvDoc) Type(CharFmt) Name(gvTxtItalicCharFmtName) NewVar(lvCharFmt);
  If lvCharFmt = 0
     // If not present, make a new one
     Local lvStat lvPos;
Find Member('Italic') InList(FontAngleNames) ReturnStatus(lvStat) ReturnPos(lvPos);
     If lvStat
// Create character format with everything As Is except the Font Angle which is Italic. New CharFmt NewVar(lvCharFmt) DocObject(pvDoc) Name(gvTxtItalicCharFmtName) FontAngle(lvPos - 1);
     EndIf
  EndIf

  If lvCharFmt
Apply TextProperties TextRange(pvDoc.TextSelection) Properties(lvCharFmt.Properties);
  EndIf

EndSub



_______________________________________________


You are currently subscribed to Framers as [EMAIL PROTECTED]

To unsubscribe send a blank email to
[EMAIL PROTECTED]
or visit http://lists.frameusers.com/mailman/options/framers/elmsoft%40comcast.net

Send administrative questions to [EMAIL PROTECTED] Visit
http://www.frameusers.com/ for more resources and info.
_______________________________________________


You are currently subscribed to Framers as [EMAIL PROTECTED]

To unsubscribe send a blank email to [EMAIL PROTECTED]
or visit 
http://lists.frameusers.com/mailman/options/framers/archive%40mail-archive.com

Send administrative questions to [EMAIL PROTECTED] Visit
http://www.frameusers.com/ for more resources and info.

Reply via email to