Skip to main content
Participant
November 26, 2008
Answered

Print Button on Drop-Down window

  • November 26, 2008
  • 2 replies
  • 716 views
Hello,

our internal customer wants to be able to print topics from a drop-down window.

This worked well with "RoboHelp for Word" and WinHelp output, but I fail to add the same functionality in a "Robohelp for HTML" (R 7) project with HTML Help (CHM) output. In fact the functionality seems to work (Topic is printed correctly), but in the window I immediately get a browser message that the content cannot be diplayed (topic disappears). The same is true for the "Copy" function (content is copied to windows clipboard but error message appears in the window). For the "Close" function the HTML help is minimized to the bottom tray. I added the following snippet

...
<table x-use-null-cells style="background-color: #808080; width: 100%; height: 50px; border-style: 0;"
height=50 width=100% bgcolor=#808080>
<tr><td><implicit_p>
<input type=submit name=button1 value=Print onClick="window.print();">
<input type=submit name=button3 value=Copy onClick="javascript:CopiedTxt = ocument.body.createTextRange();CopiedTxt.execCommand('Copy')">
<input type=submit name=button2 value=Close onClick="window.blur()">
</td></tr>
</table>
.....

What's wrong? Unfortunately I'm not fluent in Javascript :-(

Regards, Pinkepunk
This topic has been closed for replies.
Correct answer Pinkepunk
Hi, again,

Can you zip up and send me your test project so that I can take a closer look at it?

Click my user name at the left to contact me.

Pete

Hi Pete,

we finally found the error: the input type should be "button" instead of "submit". The correct code for our snippet with three buttons ("Print", "Copy", "Close") is now (see attached code below):

Cheers, Pinkepunk
-------------------------------------------------------------------------------------------------------------------

2 replies

Participating Frequently
November 26, 2008
Hi, Pinkepunk,

I can't reproduce the print issue in my test .chm file (no browser message), so I assume that there is something else in the help topic that causes the problem to arise. Perhaps you can post the complete contents of a topic?

The error message that I see when using the Copy function is caused by the "ocument.body.createTextRange();" method, which should be changed to " d ocument.body.createTextRange();".

If you want to quit the help window when the Close button is clicked, you need to use an HTML Help Close Window control. See the example below.

Pete
PinkepunkAuthor
Participant
November 26, 2008
Hi, Pete,

Thanks for answering.

> document.body.createTextRange();"
The 'd' got lost when I formatted the post the forum.

>onClick="hhctrl.Click()"
HHCTRL does not seem to be know object in my project.

The problem is not connected with the topic content. I created a test project from scratch with just two topics and the snippet in it: Same problem. The error page has the following address (right click):

res://C:\WINNT\system32\shdoclc.dll/dnserror.htm#mk:@MSITStore:C:\Apps\Test\Test%20Buttons\TestSnippets\!SSL!\Microsoft_HTML_Help\TestSnippets.chm::/DropDown.htm?button2=Schlie%DFen

It seems that the page name is confusing RoboHelp: Schlie%DFen refers to the German "Schließen" which includes a special character.

Regards, Pinkepunk
Participating Frequently
November 26, 2008
Hi, again,

Can you zip up and send me your test project so that I can take a closer look at it?

Click my user name at the left to contact me.

Pete
Peter Grainge
Community Expert
Community Expert
November 26, 2008
Maybe a simpler solution would be a single button on the toolbar that will print whichever topic is displayed without requiring any code in that topic.

See Snippet 24 on my site.

Use the menu (bottom right) to mark the Best Answer or Highlight particularly useful replies. Found the answer elsewhere? Share it here.