Helpful Coding Tips

Accessing Your Help Folder in a Mac OS X App Bundle

The beauty of Mac OS X bundles is that it allows you to store related files and resources inside the bundle. This way, the user only sees the single application file for easy portability and installation in the Mac's Applications folder, but inside of its bundle, all of your required files are stored.

If you know one of your application's compile targets is a Mac OS X bundle, then you can easily change the following code in the UniHelpEngine constructor method to acess your help folder from within your Mac OS X bundle:

me.HelpFolder = GetFolderItem("Help")

should be changed to:

#If TargetMachO then
   me.HelpFolder = ExecutableFile.Parent.Parent.Child("Resources").Child("Help")
#Else
   me.HelpFolder = GetFolderItem("Help")
#EndIf

Then compile your application as a Mac OS X bundle and place your help folder inside the bundle. To do this, Control-click the compiled application to display a contextual menu. In the menu, select "Show Package Contents" and then navigate into the "Contents" folder and then open the sub-folder called "Resources". Place your help folder inside the "Resources" folder, then close the bundle.

Forgot What Version of UniHelp You're Using?

As of UniHelp 3, you can now quickly determine the version number of the UniHelp viewer in your REALbasic application by searching for the special query "UniHelp Credits" in UniHelp's Search field. That secret search phrase will display a dialog message with the UniHelp version number.

Email Links in your HTML Pages

When a user clicks an e-mail link, the user's default e-mail application will launch and a new blank message to that e-mail address will be opened. SUBJECT and BODY attributes can be added to e-mail links following standard HTML syntax. When clicked in HTML, the example below will launch the user's default e-mail application and a new message to ebmail@ebutterfly.com will be opened with a subject line of "Feedback" and body text that reads "Awesome Product".

<a href="mailto:ebmail@ebutterfly.com?Subject=Feedback&Body=Awesome%20Product"> Feedback</a>

Hyperlinks in your HTML Pages

External URL links work just like using "ShowURL" in REALbasic code. When clicked, an external URL link (such as "http://www.ebutterfly.com/") will launch the user's default web browser and load that URL address. Be sure NOT to use the Target attribute, which seems to break the link in the HTMLViewer control. For example, remove target="blank" from all external URL links in your help pages.

With Relative Links (such as <a href="../introduction.html">Introduction</a>), you can create links between your different help pages. Just like standard HTML practices, you should avoid using spaces or ampersands in your HTML filenames. But if you do need to use those characters in your filenames for some reason, then you need to URL-encode them:

" " Space = %20
"&" Ampersand = %26

An example using both of these URL encoding characters would be:

<a href="../Features%20%26%20Benefits.html">Features & Benefits</a>

File extensions are required in order for UniHelp to properly display your files. So if you are linking to an HTML file, be sure to include the .htm or .html file extension in the filename.