Setting text popup width

This forum is for all Flare related Tips and Tricks.
Have a tip or trick you use while working in Flare? Share it here.
Post Reply
jmenning
Propeller Head
Posts: 50
Joined: Thu Jul 20, 2006 2:52 pm

Setting text popup width

Post by jmenning »

So, I really wanted to use text pop-ups, but I was getting frustrated with not being able to set the width. The width set on the pop-ups was so narrow that I ended up with only one or two words on each line, rendering the pop-up virtually useless. I remember having this problem years ago, and never solved in then, and a call to Madcap Support today confirmed they have not put in a way to control the width yet, so I decided to "fix" (ish) it myself. Behold, another cheesy hack into the MadCapEffects.js!

If anyone has a more elegant way to fix this, I'm all ears. I have some tweaks in mind, but I decided to give up and go get some work done instead of fooling with it any more :P
  • This hack sets a fixed width for all text pop-ups (but does not affect topic pop-ups). I set mine to 300px, but this is an easy way to set it to any arbitrary width you like. I let it auto calculate the height, so it's no taller than it needs to be.
  • I highly recommend backing up your MadCapEffects.js before mucking around in it ;) You can find it here: \Program Files\MadCap Software\MadCap Flare V7\Flare.app\Resources\WebHelp\Content\SkinSupport\MadCapEffects.js
  • Since this modifies a core Flare file, not a project file, it will affect all projects compiled on that computer.
Near the bottom of the .js, I altered the FMCSetTextPopupSize function by commenting out a couple of lines of code and adding one of my own. The changed lines are underlined below:

function FMCSetTextPopupSize( popupNode )
{
[...]

while ( true )
{
//popupNode.style.width = maxX - (i * stepSize) + "px";
popupNode.style.height = (maxX - (i * stepSize)) * hwRatio + "px";

// Jill's hack for popup width

popupNode.style.width = 300 + "px";



// "- 2" is to account for borderLeft + borderRight.

if ( popupNode.scrollHeight > popupNode.offsetHeight - 2 || popupNode.scrollWidth > popupNode.offsetWidth - 2 )
{
popupNode.style.overflow = "hidden"; // Since scrollbars are now present, remove them before enlarging the node or else they'll still be present in Firefox and Safari

//popupNode.style.width = maxX - ((i - 1) * stepSize) + "px";
popupNode.style.height = (maxX - ((i - 1) * stepSize)) * hwRatio + "px";

break;
}
[...]
}
Post Reply