Printing topics w/toggles: Toggles don't expand before print

Please post all questions and comments regarding Help & Manual 7 here.

Moderators: Alexander Halser, Tim Green

Printing topics w/toggles: Toggles don't expand before print

Unread postby Elissa Miller » Tue Nov 06, 2018 11:59 pm

Hello again. I can't seem to get the "Print this topic" link to expand all toggles before it prints.

In the skin's HTML Page Templates/Default do have a functioning "expand/collapse content" link that came straight out of the help for H&M7:

Code: Select all
<a href="javascript:HMToggleExpandAll(!HMTogglesAllExpanded)" title="Tooltip text">Expand/Collapse</a>


It works fine. And, also from the H&M7 Help, I'm using this exact text for the print function which the documentation indicates should expand all toggles before printing the page:

Code: Select all
<a href="javascript:HMToggleExpandAll(true); print();">Print this Topic</a>


However, when I generate the webhelp, the print link doesn't expand before opening the printer dialog. When you click the print link, the first thing that happens is that the printer dialog box is displayed, and the preview shows that it's going to print with all the toggles closed. When I dismiss the printer dialog and return to the page, all the toggles expand.

How can I make the toggles expand before the job is sent to the printer? (Possibly also "How am I misunderstanding the instructions?")

Regards,
Elissa M.
Elissa Miller
 
Posts: 10
Joined: Wed Jul 31, 2013 7:23 pm

Re: Printing topics w/toggles: Toggles don't expand before p

Unread postby Tim Green » Wed Nov 07, 2018 7:11 am

Hi Elissa,

You are running into a classic timing trap, caused by the animation of the toggles. Unless you force it to, JavaScript execution doesn't wait for animations. It starts an animation and continues with execution of the next line of code while the animation is running. In pages with lots of animations this can cause all kinds of gnarly problems. In your case the solution is quite simple:

Code: Select all
<a href="javascript:HMToggleExpandAll(true); setTimeout(print,400);">Print this Topic</a>

That forces it to wait 400 milliseconds, which is a tad longer than the animation is defined, before executing the print function. If you run into any problems on some servers you can increase the number of milliseconds a little, but you shouldn't need to. 8)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
User avatar
Tim Green
Site Admin
 
Posts: 20259
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany

Re: Printing topics w/toggles: Toggles don't expand before p

Unread postby Elissa Miller » Wed Nov 07, 2018 5:29 pm

Thank you -- that makes perfect sense.

As a representative of the class of users who don't code but can follow instructions, I hope you will consider adding that information to Basic Working Procedures > Toggles: Expanding Text and Images > Printing topics containing toggles in the H&M7 User Help. Otherwise, I'm going to continue thinking of you as a discontiguous part of the online help. :)

Best,
Elissa M.
Elissa Miller
 
Posts: 10
Joined: Wed Jul 31, 2013 7:23 pm

Re: Printing topics w/toggles: Toggles don't expand before p

Unread postby Tim Green » Thu Nov 08, 2018 8:41 am

Hi Elissa,

Actually, what is needed is a modification of the expand all function that allows you to disable the animation. That's something I'm looking into... 8)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
User avatar
Tim Green
Site Admin
 
Posts: 20259
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany


Return to Help & Manual 7 Forum

Who is online

Users browsing this forum: No registered users and 5 guests

cron