HTML Executable Wiki : JumpToSample

HomePage :: Site News :: HTML Executable Homepage :: Glossary :: RecentChanges :: Login/Register

How to add a "Jump To" command?



With a single HEScript custom function, you can achieve this goal. Then it is possible to call this HEScript directly from your pages (with JavaScript or links), a custom menu command or a toolbar button. In this sample, we'll create a "Jump to" toolbar button.

First you need to write the HEScript function that asks the user for the page she/he wants to display:
function JumpToChapter: Boolean;
var
 S1: String;
 i: integer;
begin
 Result := True;
 // Asks the user for the page he wants to see.
 S1 := InputBox("Please enter the number of the page you want to see:", "Jump to", "1");
 // Checks if cancel.
 if S1 = "" then exit;
 // Checks if the page is correct by converting the string to an integer.
 i := strtointdef(S1 ,0);
 // Creates the page's name.
 if i < 10 then
  S1 := "page000" + inttostr(i)
 else if i < 100 then
  S1 := "page00" + inttostr(i)
 else if i < 1000 then
  S1 := "page0" + inttostr(i)
 else
  S1 := "page" + inttostr(i);
 // Adds the remaining part (extension)
 S1 := S1 + ".html";
 // Displays the page
 GoToPage(S1, "");
end;

Note that in this sample, the pages have the following filename format: pg_0001.html, pg_0002.html, pg_0003.html and so on. You can customize that by modifying the script above.

Click on Save and that's all.

Now we can create a custom toolbar button.folder

Add a new custom button using Add.folder

When the button is clicked, the JumpToChapter function will be executed.
It asks your user to enter the number of the page that should be displayed:folder
When the user clicks OK, the page is automatically displayed.

See this link about how to call your script function using different ways:
help.htmlexe.com/index.php?show=callscript.htm


There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki
Page was generated in 0.3211 seconds