HTML Scripter

HTML Scripter

HTML Scripter © 2016 http://delphihtmlcomponents.com Contents 3 Table of Contents Foreword 0 Part I Introduction 5 Part II Getting started 6 Part III Script Language 7 1 Overview ............................................................................................................................. 7 2 Script structure .................................................................................................................... 7 3 Expressions ......................................................................................................................... 7 4 Comments ........................................................................................................................... 7 5 Statements .......................................................................................................................... 8 6 Variables ............................................................................................................................. 8 7 Arrays .................................................................................................................................. 9 8 Function declaration ........................................................................................................... 9 9 Anonymous functions ........................................................................................................ 10 10 Ordinal types helpers ........................................................................................................ 10 11 Asynchronous functions ..................................................................................................... 11 Part IV Using Delphi classes and functions 13 1 Registeging Delphi classes and methods .......................................................................... 13 2 Generic method handler ................................................................................................... 14 3 Registering for-in enumerators .......................................................................................... 14 4 Registering Delphi functions ............................................................................................. 15 5 "Set of" parameters ........................................................................................................... 16 6 Registering DLL functions ................................................................................................. 16 7 Magic functions ................................................................................................................. 17 8 Registering constants ........................................................................................................ 18 9 Registering enumerations ................................................................................................. 18 10 Creating and destroying objects ........................................................................................ 18 11 Using script functions as Delphi event handler .................................................................. 19 12 Using script functions for callback ..................................................................................... 19 13 Changing or disabling standard functions and classes set ................................................ 20 Part V Expressions 22 1 Expression evaluation ....................................................................................................... 22 2 Passing parameters ........................................................................................................... 22 3 Using custom variables getter/setter ................................................................................. 22 © 2016 http://delphihtmlcomponents.com 3 4 HTML Scripter 4 Evaluating expression inside script ................................................................................... 23 Part VI Executing script 24 1 Executing script ................................................................................................................. 24 2 Accesing global variables ................................................................................................. 24 3 Calling script function ....................................................................................................... 24 4 Executing code block ........................................................................................................ 25 5 Predefined variables ......................................................................................................... 25 Part VII Debugging 26 1 ScriptDebugger class ........................................................................................................ 26 2 Conrolling script execution ............................................................................................... 26 3 Getting variables ............................................................................................................... 27 4 Console and logging ......................................................................................................... 27 5 Profiling ............................................................................................................................ 27 6 Breakpoints ....................................................................................................................... 27 7 Expression evaluation ....................................................................................................... 28 Part VIII Using script in HTML document 29 1 Introduction ....................................................................................................................... 29 2 JQuery support .................................................................................................................. 29 3 Events ................................................................................................................................ 31 4 AJAX ................................................................................................................................. 31 5 Usage examples ................................................................................................................ 32 Make table sortable ............................................................................................................................................. 32 Highlight list items starting w ith 'A' ................................................................................................................. 32 Convert nested list into expandable tree ....................................................................................................... 32 Directory tree w ith background loading ......................................................................................................... 33 Incremental search ............................................................................................................................................. 35 Infinite page .......................................................................................................................................................... 35 Part IX Standard functions 37 Part X Standard constants 41 Part XI Standard classes 42 Index 0 © 2016 http://delphihtmlcomponents.com Introduction 5 1 Introduction HTML Scripter is a cross-platform and 100% native scripting library for Delphi. It supports most of Object Pascal language features including modern anonymous functions and for-in statement. Scripter engine is GUI-independent and threadsafe, so can be used in both desktop and server applications. Library is optimized for both execution and parsing/compiling performance and can be used in high-loaded applications. It also support special features, like JQuery $() function for using inside HTML Component Library THtDocument class. Supported platforms: · Win32/VCL · Win64/VCL · Win32/FMX · Win64/FMX · OSX · Android · iOS Supported Delphi versions Delphi 5 - Delphi 10.1 Berlin. Main features · Extremely fast parsing and compilation. · Using Delphi methods and properties via RTTI (2010+). · Easy registration of Delphi functions (no need for special intermediate functions, just pass function address and description). · Anonymous functions. · for .. in .. statement. · DLL functions. · Ordinal types helpers · Using script functions as Delphi event handlers. · Debugging and logging support. · Profiling · Set of and array parameters. · Asynchronous and delayed execution · HTML documents integration (JQuery $ operator) © 2016 http://delphihtmlcomponents.com 6 HTML Scripter 2 Getting started Simplest example of how to use THtScriptParser: uses htscriptparse, htscriptgui; ... procedure TForm1.ButtonClick(Sender: TObject); var SP: THtScriptParser; begin SP := THtScriptParser.Create('ShowMessage(''test'');'); try SP.Run; finally SP.Free end; end; © 2016 http://delphihtmlcomponents.com Script Language 7 3 Script Language 3.1 Overview Scripter language syntax is almost identical to Object pascal syntax except the following: · Variables declaration is not required. · Classes declaration is not supported · uses/unit are not supported · Records are not supported 3.2 Script structure Script should have the following structure: (all sections are optional) [const and functions declarations] [main code block] Example: const MyText = 'Sample text'; procedure Sample(s: string); begin ShowMessage(s); end; Sample(MyText); 3.3 Expressions Following

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    42 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us