Macro to mimic behavior of B and I buttons, but for other tags?

  • Thread starter Freelance Traveller
  • Start date

F

Freelance Traveller

I tend to prefer to use semantic markup rather than presentational
markup. As a result, I will use <strong></strong> and <em></em> rather
than <b></b> and <i></i>. The buttons on the toolbar marked "B" and
"I", however, use the latter rather than the former. I have
instructions for attaching a macro to a button on a toolbar; what I
don't have is the button itself - and I have NOT been able to grasp the
entire object-oriented programming paradigm; I learned programming in a
purely procedural environment, so I haven't been able to get even the
beginnings of a macro to use my preferred tags. Can someone either
provide or point me to a macro that I can use as-is or easily and
clearly modify to use the STRONG or EM tags the way that the B and I
buttons allow me to use the B and I tags? I would like such a macro to
behave as the B and I buttons do - that is:

If there is no selection
If the tag of interest is currently NOT being applied
TURN ON the tag so that further typing will have it applied
OTHERWISE
TURN OFF the tag so that further typing will NOT have it applied
OTHERWISE
If any part of the selection does NOT have the tag applied
APPLY the tag to the WHOLE selection
OTHERWISE
UNAPPLY the tag to the whole selection.

Application and un-application of the tag may be a bit more complicated
than simply inserting and removing the tags; for example, un-applying a
tag may actually insert additional HTML, e.g., inserting the CLOSING tag
at the BEGINNING of the selection, and the OPENING tag at the END,
rather than always removing an extant open-close tag pair.

I've tried searching the web for such macros; either they're not out
there, or my google-fu is simply too weak. I thus enter a plea for
assistance here.

--
Jeff Zeitlin, Editor
Freelance Traveller
The Electronic Fan-Supported
Traveller® Fanzine and Resource

(e-mail address removed)
http://www.freelancetraveller.com
http://come.to/freelancetraveller
http://freelancetraveller.downport.com/



®Traveller is a registered trademark of
Far Future Enterprises, 1977-2009. Use of
the trademark in this notice and in the
referenced materials is not intended to
infringe or devalue the trademark.

Freelance Traveller extends its thanks to the following
enterprises for hosting services:

CyberNET Web Hosting (http://www.cyberwebhosting.net)
The Traveller Downport (http://www.downport.com)
 
Ad

Advertisements

S

Stefan B Rusynko

You may want to look at
http://msdn.microsoft.com/en-us/library/aa218655(v=office.11).aspx
And
http://msdn.microsoft.com/library/aa218658(office.11).aspx
And
http://www.microsoft.com/downloads/details.aspx?FamilyID=846e3034-8545-49fc-b0a2-7d9581c9e178&displaylang=en

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________


I tend to prefer to use semantic markup rather than presentational
markup. As a result, I will use <strong></strong> and <em></em> rather
than <b></b> and <i></i>. The buttons on the toolbar marked "B" and
"I", however, use the latter rather than the former. I have
instructions for attaching a macro to a button on a toolbar; what I
don't have is the button itself - and I have NOT been able to grasp the
entire object-oriented programming paradigm; I learned programming in a
purely procedural environment, so I haven't been able to get even the
beginnings of a macro to use my preferred tags. Can someone either
provide or point me to a macro that I can use as-is or easily and
clearly modify to use the STRONG or EM tags the way that the B and I
buttons allow me to use the B and I tags? I would like such a macro to
behave as the B and I buttons do - that is:

If there is no selection
If the tag of interest is currently NOT being applied
TURN ON the tag so that further typing will have it applied
OTHERWISE
TURN OFF the tag so that further typing will NOT have it applied
OTHERWISE
If any part of the selection does NOT have the tag applied
APPLY the tag to the WHOLE selection
OTHERWISE
UNAPPLY the tag to the whole selection.

Application and un-application of the tag may be a bit more complicated
than simply inserting and removing the tags; for example, un-applying a
tag may actually insert additional HTML, e.g., inserting the CLOSING tag
at the BEGINNING of the selection, and the OPENING tag at the END,
rather than always removing an extant open-close tag pair.

I've tried searching the web for such macros; either they're not out
there, or my google-fu is simply too weak. I thus enter a plea for
assistance here.

--
Jeff Zeitlin, Editor
Freelance Traveller
The Electronic Fan-Supported
Traveller® Fanzine and Resource

(e-mail address removed)
http://www.freelancetraveller.com
http://come.to/freelancetraveller
http://freelancetraveller.downport.com/



®Traveller is a registered trademark of
Far Future Enterprises, 1977-2009. Use of
the trademark in this notice and in the
referenced materials is not intended to
infringe or devalue the trademark.

Freelance Traveller extends its thanks to the following
enterprises for hosting services:

CyberNET Web Hosting (http://www.cyberwebhosting.net)
The Traveller Downport (http://www.downport.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Control Windows Button Behavior 1
mimicing the "Backspace" key 5
jittery behavior with flashing hover buttons 1
Onclick behavior 1
Calendar Behavior 2
Layers/behaviors 4
Meta Tags 1
Meta Tags 3

Top