Command overview
Areas
Plugin Main Commands
Managing Offscreen Areas
Managing Areas
- hmRep_Get Areas → Areas New in v19
- hmRep_GET AREA LIST (areas ; thread_IDs) Deprecated in v19
- hmRep_GET REPORT LIST (areas ; Report List)
- hmRep_Is Area Valid (Area) → Valid Deprecated in v19
- hmRep_Get Last Error (Area) → Error code
- hmRep_SET NEW AREA FOCUSABLE (onOff)
- hmRep_SET AUTOMATIC RELATIONS (ManyToOne ; OneToMany)
- hmRep_GET AUTOMATIC RELATIONS (ManyToOne ; OneToMany)
Callback and Events
- hmRep_INSTALL CALLBACK (Area ; Method name)
- hmRep_Get Callback (Area) → Method name
- hmRep_SET EVENT STATE (Area ; Event ; State)
- hmRep_Get Event State (Area ; Event) → state
- hmRep_Get Last Event (Area) → Last Event
- hmRep_GET MOUSE (Area ; x ; y)
- hmRep_SET CURSOR (Area ; CursorID ; ForceCursor)
- hmRep_SET MOUSE LIMITS ( Area ; limit_h ; limit_left ; limit_right ; limit_v ; limit_top ; limit_bottom)
- hmRep_DRAG AND DROP PROP (Area ; Variable ; Arrayindex ; Process ; x ; y)
Properties
- hmRep_SET AREA PROPERTY (Area ; Selector ; ValueLong ; ValueText)
- hmRep_GET AREA PROPERTY (Area ; Selector ; ValueLong ; ValueText)
- hmRep_SET FONTS (Area ; Fontlist)
- hmRep_GET FONTS (Area ; Fontlist)
- hmRep_SET FORMAT LIST (Area ; Format list)
- hmRep_GET FORMAT LIST (Area ; Format list)
Tools
- hmRep_SET TOOL (Area ; Tool)
- hmRep_Get Tool (Area) → Tool
- hmRep_SET TOOL VISIBLE (Area ; Tool ; Visible)
- hmRep_Get Tool Visible (Area ; Tool) → Visible
- hmRep_SET TOOL TIP TEXT (Area ; Tool ; Tiptext)
- hmRep_Get Tool Tip Text (Area ; Tool) → Tiptext
- hmRep_Get Barcode List → Barcodes
Reports
Managing Reports
- hmRep_Create Report (Area ; Width ; Height ; Name) → Report UUID
- hmRep_DELETE REPORT (Area ; report UUID)
- hmRep_CLEAR REPORT (Area)
- hmRep_SET CURRENT REPORT (Area ; Report UUID)
- hmRep_Get Current Report (Area) → report UUID
- hmRep_REPORT TO BLOB ( Area ; Blob)
- hmRep_BLOB TO REPORT ( Area ; Type ; Blob)
- hmRep_SET COLOR WITH ALPHA ( Area ; Selector ; id ; Red ; Green ; Blue ; Alpha)
- hmRep_GET COLOR WITH ALPHA ( Area ; Selector ; id ; Red ; Green ; Blue ; Alpha)
- hmRep_Pixel To Rulerunit ( Area ; Pixel) → Ruler unit
- hmRep_Rulerunit To Pixel ( Area ; Ruler unit) → Pixel
- hmRep_GET REPORT DEPENDENCIES ( Area ; scopeArray ; scopeIDArray ; UUIDArray)
- hmRep_SET DIALOG RECT (Area ; Type ; Left ; Top ; Right ; Bottom)
- hmRep_GET DIALOG RECT (Area ; Type ; Left ; Top ; Right ; Bottom)
Properties
- hmRep_SET REPORT PROPERTY (Area ; Selector ; ValueLong ; ValueText)
- hmRep_GET REPORT PROPERTY (Area ; Selector ; ValueLong ; ValueText)
- hmRep_SET SCALE (Area ; Scale)
- hmRep_Get Scale (Area) -> Scale
- hmRep_ZOOM TO RECT (Area ; Left ; Top ; Right ; Bottom)
- hmRep_Enumerate Pages (Area) → Result
Input/Output
- hmRep_Report To Picture ( Area ; Format ; dpiX ; dpiY) → Picture
- hmRep_REPORT TO SVG ( Area ; Blob)
- hmRep_RENDER TO PICTURE ( Area ; picArray ; Format ; Limit ; dpiX ; dpiY)
- hmRep_Render To Text ( Area ; Options ; FieldDelim ; RecordDelim) → Text
- hmRep_Render To HTML ( Area ; Options) → Text
- hmRep_Render To Blob ( Area ; Charset ; Options ; FieldDelim ; RecordDelim) → Result Deprecated in v19
- hmRep_GET IMPORT PROTOCOLL ( Area ; Protocoll)
Pages
Overview
A report can have multiple pages. Each page can printed as it is or each page can printed as a report. So every page can be an independent report with its own iterations and sections. So it is possible to have a static page as a first page, followed by a report.
Page numeration
Each page have a continuous number from the first page to the last page. Also, hmReports give each page an ID which is unique. This is helpful, because you can always refer to a page after the user deletes/adds pages. If the user deletes/inserts pages, the page number of a page may differ. The ID of a page does never change.
Creating pages
Copy and paste entire pages
Getting/setting information about pages
- hmRep_SET PAGE PROPERTY ( Area ; pageNo ; Selector ; valueLong ; valueText)
- hmRep_GET PAGE PROPERTY ( Area ; pageNo ; Selector ; valueLong ; valueText)
Getting/setting the current page of the current report
Enumerating pages
Conversion between page number and reference
- hmRep_Get Page Number From ID ( Area ; pageID) → number
- hmRep_Get Page ID From Number ( Area ; number) → pageID
Deleting pages
Layers
Creating layers
List all layers
Getting/setting information about layers
- hmRep_SET LAYER PROPERTY ( Area ; ID ; Selector ; valueLong ; valueText)
- hmRep_GET LAYER PROPERTY ( Area ; ID ; Selector ; valueLong ; valueText)
- hmRep_SET LAYER CLIP ( Area; ID ; Left ; Top ; Right ; Bottom )
- hmRep_GET LAYER CLIP ( Area; ID ; Left ; Top ; Right ; Bottom )
Getting/setting the current layer of the current report
Sort layers
Deleting layers
Guides
- hmRep_Create Guide ( Area ; horizontal ; position ; page) → number
- hmRep_Count Guides ( Area ) → guides
- hmRep_DELETE GUIDE ( Area ; Number)
- hmRep_SET GUIDES ( Area ; ArrayH ; ArrayV)
- hmRep_GET GUIDES ( Area ; ArrayH ; ArrayV)
- hmRep_SET GUIDE PROPERTY ( Area ; Number ; Selector ; valueLong ; valueText)
- hmRep_GET GUIDE PROPERTY ( Area ; Number ; Selector ; valueLong ; valueText)
Printing
- hmRep_Print ( Area ; Options) → result
- hmRep_Page Setup ( Area ; Dialogs) → result
- hmRep_Print settings to BLOB ( Area ) → print header
- hmRep_BLOB TO PRINT SETTINGS ( Area ; print header)
- hmRep_SET PRINT OPTION ( Area ; Option ; Value1 ; Value2 ; Value3)
- hmRep_GET PRINT OPTION ( Area ; option ; value1 ; value2 ; value3)
- hmRep_GET PAPER SIZE ( Paper type ; Orientation ; Width ; Height)
- hmRep_GET RENDER LOG ( Area ; arrayType ; arrayRef1 ; arrayRef2 ; arrayRef3 ; arrayInOut)
- hmRep_Get Native Print Header ( Area ; Type ) → print header
- hmRep_SET NATIVE PRINT HEADER ( Area ; Type ; Print Header)
- hmRep_OPEN PRINTING JOB ( Area ; Options)
- hmRep_CLOSE PRINTING JOB ( Area )
- hmRep_Print To Blob ( Area ; Blob) → result New in v20
Sections
Getting information about sections
- hmRep_GET SECTIONS ( Area ; SectionTypes ; SectionHeights ; SectionCount)
- hmRep_GET SECTION ITERATION ( Area ; Section ; Type ; valueLong ; valueText)
- hmRep_GET SECTION PROPERTY ( Area ; Type ; Count ; Selector ; valueLong ; valueText)
- hmRep_Get Section Count ( Area ; Type) → Count
Set section properties
- hmRep_SET SECTION ITERATION ( Area ; Section ; Type ; valueLong ; valueText)
- hmRep_SET SECTION HEIGHT ( Area ; Type ; Count ; Height)
- hmRep_SET SECTION COUNT ( Area ; Type ; Count)
- hmRep_SET SECTION PROPERTY ( Area ; Type ; Count ; Selector ; valueLong ; valueText)
Find a section by a coordinate
Order sections
Objects
Creating Objects
- hmRep_Create Rectangle ( Area ; left ; top ; right ; bottom) → object ID
- hmRep_Create Round Rectangle ( Area ; left ; top ; right ; bottom ; rounding) → object ID
- hmRep_Create Text ( Area ; left ; top ; right ; bottom ; text) → object ID
- hmRep_Create Oval ( Area ; left ; top ; right ; bottom) → object ID
- hmRep_Create Line ( Area ; left ; top ; right ; bottom) → object ID
- hmRep_Create Picture ( Area ; left ; top ; right ; bottom) → object ID
- hmRep_Create Group ( Area ; objects) → object ID
- hmRep_Create Arc ( Area ; x ; y ; radiusx ; radiusy ; startAngle ; endAngle ; clockwise) → object ID
- hmRep_Create Freehand ( Area ; array_x ; array_y) → object ID
- hmRep_Create Subreport ( Area ; left ; top ; right ; bottom ; subreportUUID) → object ID
- hmRep_SET OBJECTS ( Area ; objectblob)
- hmRep_GET OBJECTS ( Area ; objectblob)
Paths
- hmRep_SET PATH ( Area ; object ID ; path)
- hmRep_PATH POINT ( Area ; x ; y)
- hmRep_PATH MOVE TO ( Area ; x ;y)
- hmRep_PATH CURVE ( Area ; cp1x ; cp1y ; cp2x ; cp2y ; x ; y)
- hmRep_CLOSE PATH ( Area )
- hmRep_End Path ( Area ) → object ID
- hmRep_GET PATH INFORMATION ( Area ; object ID ; array_type ; array_x ; array_y ; array_cp1x ; array_cp1y ; array_cp2x ; array_cp2y)
- hmRep_SET PATH ( Area ; object ID ; path)
- hmRep_Get Path ( Area ; object ID) → Path text
Deleting Objects
- hmRep_DELETE OBJECT ( Area ; objectID ; deleteGroupObjects)
- hmRep_DELETE OBJECTS ( Area ; scope ; scopeID)
Object Properties
- hmRep_SET OBJECT PROPERTY ( Area ; id ; selector ; valueReal ; valueText)
- hmRep_GET OBJECT PROPERTY ( Area ; id ; selector ; valueReal ; valueText)
- hmRep_GET OBJECT LIST( Area ; scope ; scopeID ; arrayIDs)
- hmRep_GET OBJECTS BY POINT ( Area ; x ; y ; arrayIDs)
- hmRep_GET OBJECTS BY RECT ( Area ; layerID ; left ; top ; right ; bottom ; searchInGroups ; arrayIDs)
- hmRep_SET PICTURE( Area ; ID ; picture)
- hmRep_GET PICTURE( Area ; ID ; picture)
- hmRep_GET OBJECT RECT ( Area ; objectID ; left ; top ; right ; bottom)
- hmRep_SET OBJECT RECT ( Area ; objectID ; left ; top ; right ; bottom)
- hmRep_SELECT OBJECTS ( Area ; objectArray ; operation)
- hmRep_SET OBJECT DATA ( Area ; objectID ; dataType ; database ; table ; field ; variablename ; arrayindex)
- hmRep_GET OBJECT DATA ( Area ; objectID ; dataType ; database ; table ; field ; variablename ; arrayindex)
- hmRep_UPDATE SUBREPORTS ( Area )
- hmRep_SET OBJECT LINEDASH ( Area ; objectID ; phase ; arrayDashes)
- hmRep_GET OBJECT LINEDASH ( Area ; objectID ; phase ; arrayDashes)
- hmRep_SET RECT COLUMNS ( Area ; objectID ; columnsArray)
- hmRep_GET RECT COLUMNS ( Area ; objectID ; columnsArray)
- hmRep_SET RECT ROWS ( Area ; objectID ; rowsArray)
- hmRep_GET RECT ROWS ( Area ; objectID ; rowsArray)
Scripting
Overview
A hmReports Area has it’s own variable stack. It’s a sandbox concept where you can put any variable you want into the Area . It does not intersects the variable name space of 4D. More information can be found in the chapter [[Script Execution]].
hmX
Plugin functions which starting with the prefix “hmX” are going directly on the executer/interpreter. They are indepently from the hmReports area.
Managing variable stack
- hmRep_SET VARIABLE ( Area ; varname ; vartype ; valuetext ; valuenum ; valuedate)
- hmRep_GET VARIABLE ( Area ; varname ; vartype ; valuetext ; valuenum ; valuedate)
- hmRep_SET ARRAY ( Area ; varname ; array)
- hmRep_GET ARRAY ( Area ; varname ; array)
- hmRep_SET ARRAY ELEMENT ( Area ; varname ; arrayindex ; valuetext ; valuenum ; valuedate)
- hmRep_GET ARRAY ELEMENT ( Area ; varname ; arrayindex ; valuetext ; valuenum ; valuedate)
- hmRep_SET VARIABLE OBJECT ( Area ; varname ; object) New in v19
- hmRep_GET VARIABLE LIST ( Area ; arrayNames)
- hmRep_DELETE VARIABLE ( Area ; varname)
Managing Methods
- hmRep_CREATE METHOD ( Area ; methodname ; script)
- hmRep_DELETE METHOD ( Area ; methodname)
- hmRep_GET METHOD LIST ( Area ; list)
- hmRep_SET METHOD( Area ; methodname ; script)
- hmRep_Get Method ( Area ; methodname) → script
Getting information about script variables
Managing Scripts
- hmRep_SET TOKENIZED SCRIPT ( Area ; selector ; id ; script)
- hmRep_GET TOKENIZED SCRIPT ( Area ; selector ; id ; script)
- hmRep_Is Old Script ( Area ) → isOld
Tokenize/detokenize scripts
Styled text
Overview
hmReports does support styled text for text objects. You can edit rich text in the object properties, if you enable the Multi Style property:
Runs
Runs are definitions from which position to which position of the text runs a style. If text positions have no run, the default text style is used (defined by hmRep_SET OBJECT PROPERTY).
Runs should not overlap other runs; this may have unwanted results.
You can create runs with the command hmRep_CREATE STYLED TEXT RUN. With the commands hmRep_Count Runs and hmRep_GET STYLED TEXT RUN you can loop through existing commands of an object.
With hmRep_DELETE ALL RUNS you can delete all existing runs of an object.
4D Styled Text Tags
4D internally uses styled tags to save styled text into text fields and variables. A styled text looks in 4D like:
<SPAN STYLE="font-family:'Arial';font-size:10pt;text-align:left;font-weight:normal;font-style:normal;text-decoration:none;color:#000000">This is
Every SPAN STYLE is a run in hmReports. You can use the command hmRep_SET STYLED TEXT to set this 4D styled text into hmReports. hmReports automatically convert the string into runs and extract the raw text.
Multistyle in Variables, Fields and Arrays
If you use a text field, text variable or text array as a reference, you can turn on the Multi Style flag, if you want hmReports interpret the content as rich text:
Commands
- hmRep_CREATE STYLED TEXT RUN ( Area ; objectID ; from ; to ; fontname ; fontsize ; fontstyle ; red ; green ; blue ; alpha ; back-red ; back-green ; back-blue ; back-alpha)
- hmRep_GET STYLED TEXT RUN ( Area ; objectID ; number ; from ; to ; fontname ; fontsize ; fontstyle ; red ; green ; blue ; alpha ; back-red ; back-green ; back-blue ; back-alpha)
- hmRep_SET STYLED TEXT ( Area ; objectID ; styledtext)
- hmRep_Get Styled Text ( Area ; objectID) → styledtext
- hmRep_Count Runs ( Area ; objectID) → count
- hmRep_DELETE ALL RUNS ( Area ; objectID)
Custom Properties
Overview
Custom properties are a powerful tool for adding custom data to an object, layer, report or area. You may need custom properties for adding your own reference-scheme. Use the command hmRep_Get Property Object to get the language-object of a report object, page, layer, report or area. With this object you can store any data (blobs, entities, entitySelections, collections…). However, keep in mind, that the object-property is saved with the report, except the properties of the hmReports-area! Database objects (entities, entitySelections) in the property will not be saved in the report!
Creating custom properties
- hmRep_SET PROPERTY BY NAME ( Area ; scopeID ; id ; name ; value) Deprecated in v19
Getting information custom properties
- hmRep_Get Property By Name ( Area ; scopeID ; id ; name) → value Deprecated in v19
- hmRep_GET PROPERTY BY INDEX ( Area ; scopeID ; id ; index ; name ; value) Deprecated in v19
- hmRep_Has Property ( Area ; scopeID ; id ; name) → exist Deprecated in v19
- hmRep_Get Property Object ( Area ; scopeID ; id) → propertyObject New in v19
Search for custom properties
Enumerating custom properties
- hmRep_Count Properties ( Area ; scopeID ; id) → value Deprecated in v19
Deleting custom properties
- hmRep_DELETE PROPERTY ( Area ; scopeID ; id ; name) Deprecated in v19
- hmRep_DELETE PROPERTIES ( Area ; scopeID ; id) Deprecated in v19
Virtual Structure
Overview
Virtual Structure is a powerful feature of hmReports to change database and variable names into a better readable name for the user. A Virtual Structure can be defined for the entire area (default) with all it’s reports or can be defined globally. The Virtual Structure is not saved in the Report XML Definition.
The Virtual Structure is important, if you want the change table, field and variable names for the user in the object property window.
To create a Virtual Structure Item, you can use one of the hmRep_Create VStructure… commands to create a custom name. If the caption of a Virtual Structure Item, with the type of a 4D Table or 4D Field, is empty, the Table/Field is not selectable/visible in the Object Properties.
Since hmReports 2.3 it is possible to group elements like this:
For more information, see chapter hmRep_Create VStructure Group.
Virtual Structure scope
Since hmReports 4.0 it is possible to define a global virtual structure. Just pass in all virtual structure commands a value of 0 as area parameter (e. g. hmRep_Create VStructure Table(0;…)). By default, each hmReports area uses it’s own virtual structure. So there will no intersections of virtual structures between hmReports areas. But if you want to create and use a global structure for all areas, you have to activate this with the area property hmRep_prop_UseVStructure.
Creating Virtual Structure Items
- hmRep_Create VStructure Table ( Area ; tableNo ; caption) → ID
- hmRep_Create VStructure Field ( Area ; tableNo ; fieldNo ; caption) → ID
- hmRep_Create VStructure Var ( Area ; variable ; caption) → ID
- hmRep_Create VStructure Meth ( Area ; methodname ; caption) → ID
- hmRep_Create VStructure Group ( Area ; Name) → ID
Enumerating Virtual Structure Items
- hmRep_GET VSTRUCTURE LIST ( Area ; ArrayID)
- hmRep_GET VSTRUCTURE ARRAYS ( Area ; type ; inList ; arrayID ; arrayType ; arrayVariable ; arrayCaption ; arrayDescription ; arrayGroupID ; arrayTableNo ; arrayFieldNo)
Deleting Virtual Structure Items
Getting/setting properties of Virtual Structure Items
- hmRep_SET VSTRUCTURE PROPERTY ( Area ; id ; selector ; valueLong ; valueText)
- hmRep_GET VSTRUCTURE PROPERTY ( Area ; id ;selector ; valueLong ; valueText)
Searching Virtual Structure Items
Save/restore Virtual Structure
Menus
Overview
hmReports offers the developer to customize all menus with the command set. You are able to create, edit and delete items in the menu bar or in the contextual menu. Internally all menu components, including the menu bar, are menu items. Each item has an unique reference. The reference is a blackbox and is created by hmReports. With a new area the menu items references starts with 1. A reference of -1 is the contextual menu. It is no menu item itself. You can only refer to it.
Shortcuts
If the menubar is invisible in the hmReports area, all shortcuts still work. If you do not want, that shortcuts are still active, you have to catch the key events with the Callback event hmRep_OnKey.
The menubar in hmReports
The menubar contains several standard items. To get a list of all menu bar items you have to call hmRep_GET MENU ITEM LIST:
ARRAY LONGINT($tl_items;0)
hmRep_GET MENU ITEM LIST(hmRep;0;$tl_items)
In this case you will get an array with 6 elements: {1,2,3,4,5,6} Now you can delete an item out of the menubar with:
hmRep_DELETE MENU ITEM(hmRep;6)
To get all menu items under the File menu, you have to call hmRep_GET MENU ITEM LIST with the item ID:
ARRAY LONGINT($tl_items;0)
hmRep_GET MENU ITEM LIST(hmRep;1;$tl_items)
In this case you will get an array with 12 elements: (7,8,9,10,11,12,13,14,15,16,17,18) because you have 12 menu items under this menu item:
For explanation: 7 = New report (Position 1) 8 = Open… (Position 2) 9 = Save (Position 3) 10 = Save as (Position 4) 11 = Save as SVG (Position 5) 12 = Close (Position 6) 13 = Separator (Position 7) 14 = General settings (Position 8) 15 = Report settings (Position 9) 16 = Separator (Position 10) 17 = Page settings… (Position 11) 18 = Print… (Position 12)
Important: You should handle the ID’s as a blackbox. The order and the count of the menus items may differ in future versions. You should always use hmRep_GET MENU ITEM BY ACTION to change a standard menu or you should create a completely new menu.
The menu item in hmReports
Standard menu items contains several information about an item: Item text, enable or disable, action, shortcut, reference, superior reference. You can customize all information except the references. To customize a menu item you have to use the command hmRep_SET MENU ITEM.
If you set an action to a command, some properties are set automatically. For example, if you create a menu item with the standard action #5 (delete), the item will be only active, if more than one object is selected. If you disable the item with hmRep_SET MENU ITEM, the menu item will be always disabled. Or if you set the action #57 (layer menu), the menu item will always have a submenu with all layers.
Own actions
Do identify own menu items, you can use actions between 15000 and 32000. All other actions are reserved for hmReports!
Creating menu items
Deleting menu items
Getting menu item lists
- hmRep_GET MENU LIST ( Area ; array)
- hmRep_GET MENU ITEM LIST ( Area ; menu ; array)
- hmRep_GET MENU ITEM BY ACTION ( Area ; action ; array)
Getting and setting information about menu items
- hmRep_SET MENU ITEM ( Area ; reference ; text ; action ; enable ; supitem)
- hmRep_GET MENU ITEM ( Area ; reference ; text ; action ; enable ; supitem)
- hmRep_SET MENU ITEM SHORTCUT ( Area ; reference ; shortcut)
- hmRep_GET MENU ITEM SHORTCUT ( Area ; reference ; shortcut)
- hmRep_SET MENU ITEM CHECKMARK ( Area ; reference ; onOff)
- hmRep_Get Menu Item Checkmark ( Area ; reference) → onOff
Executing menu actions
Undo
hmReports supports unlimited Undo and Redo. By default hmReports only saves the last 10 user actions to the stack. If the stack is full, the first record will be deleted, so there is space for the last action. You can change the maximum number of Undos with hmRep_SET AREA PROPERTY and the selector hmRep_prop_MaxUndos. If you pass 0 as maximum, hmReports will record unlimited undos.
Undo workflow
If a new report is opened, hmReports automatically starts an undo session. But if you want to clear the undo stack, you can start a new session by calling the command hmRep_START UNDO.
Undo actions
You can activate and deactivate several undo actions with the command hmRep_SET UNDO TYPE STATE. Some actions are deactivated by default because of performance reasons. By default, only interface actions are activated.
The following undo actions are available:
hmRep_Undo_Move (1)
Default: For interface: activated, for programming: deactivated Moving one or more objects
hmRep_Undo_Resize (2)
Default: For interface: activated, for programming: deactivated Resizing one or more objects
hmRep_Undo_Delete (3)
Default: For interface: activated, for programming: deactivated Delete one or more objects
hmRep_Undo_New (4)
Default: For interface: activated, for programming: deactivated Create one or more objects
hmRep_Undo_Change_Picture (5)
Default: For interface: deactivated, for programming: deactivated Change the picture of a picture object with the command hmRep_SET PICTURE
hmRep_Undo_Edit (6)
Default: For interface: activated, for programming: activated Can be created with hmRep_START UNDO RECORDING and hmRep_Validate Undo Recording
Commands
- hmRep_START UNDO ( Area )
- hmRep_SET UNDO TYPE STATE ( Area ; type ; State)
- hmRep_Get Undo Type State ( Area ; type) → State
- hmRep_START UNDO RECORDING ( Area )
- hmRep_Validate Undo Recording( Area ) → Count Objects
- hmRep_CANCEL UNDO RECORDING ( Area )
Ruler Units
Ruler units are measure definitions of a ruler of a report. Internally all sizes are stored in pixels. Custom units are good for displaying better readable measurements for the user. E. g. , it is better for some users to display all sizes in inch as in pixels. A ruler unit is only an overlay for the user. If you define a ruler unit, all sizes will be still stored in pixel units internally.
hmReports ruler units are defined in the area. That means, that all units and custom units (created with hmRep_Create Rulerunit) are available for all open reports in the hmReports area. hmReports initalize three standard ruler units: pixel, inch and millimeter.
A ruler unit does not have an id, it’s an index of a table starting from 1 to hmRep_Count Rulerunits. Think about it, if you create and delete units! The last ruler unit cannot be deleted.
A ruler unit record is defined as follows:
- Name: The name of the ruler unit. This name is shown as the ruler unit name for the user.
- Pixel mapping: This value defines, how many pixels are one ruler unit. E. g. 1 inch is predefined as 72 pixels (on Mac and Windows).
- Short steps: This value defines, in which steps the ruler shows a small separator.
- Long steps: This value defines, in which steps the ruler shows a long separator.
Standard definitions
If a hmReports area is opened, three ruler units are created automatically with the following properties:
- 1: Pixel, mapping = 1, short step = 10, long step = 100
- 2: Inch, mapping = 72, short step = 0.5, long step = 1
- 3: mm, mapping = 72/25.4 (=2.8346), short step = 10, long step = 100
Example of a ruler unit definition
The following example shows, how you can create a new custom ruler unit (my Inch).
*Pixel mapping is 72: 72 pixels are 1 inch *Short steps is 0.2: draw a small separator each 0.2 inch *Long steps is 1: draw a big separator each full inch
var $vl_ruler : Integer
$vl_ruler:=hmRep_Create Rulerunit(reparea; "my Inch"; 72; 0.2; 1)
Result:
Creating ruler units
Deleting ruler units
Getting ruler unit information
Setting ruler unit information
Enumeration of ruler units
- hmRep_Count Rulerunits ( Area ) → Count](RulerUnits/hmRep_CountRulerunits.md)
Executer
hmReports has an integrated executer. This executer can be used independently from a reports Area. It’s a sandbox concept where you can put any variable you want into an execution context. It does not intersects the variable name space of 4D. More information can be found in the chapter Script Execution.
Managing execution contexts
- hmX_Create Execution Context → Context
- hmX_DELETE EXECUTION CONTEXT ( Context )
- hmX_GET CONTEXT LIST ( Contexts ; Thread_IDs)
Managing variable stack
- hmX_SET VARIABLE ( Context ; varname ; vartype ; valuetext ; valuenum ; valuedate)
- hmX_SET VARIABLE OBJECT ( Context ; Name ; Object) New in v19
- hmX_SET VARIABLE COLLECTION (Context ; Name ; Collection) New in v19
- hmX_SET ARRAY ( Context ; varname ; array)
- hmX_GET ARRAY ( Context ; varname ; array)
- hmX_GET ARRAY BY INDEX ( Context ; stack_id ; typelocalglobal ; index ; array)
- hmX_GET ARRAY ELEMENT ( Context ; varname ; index ; textvalue ; realvalue ; datevalue)
- hmX_Count Variables ( Context ; stack_id ; typelocalglobal) → Count
- hmX_GET VARIABLE BY INDEX ( Context ; stack_id ; typelocalglobal ; index ; varkind ; varname ; realvalue ; datevalue ; textvalue)
- hmX_GET POINTER BY INDEX ( Context ; stack_id ; typelocalglobal ; index ; varname ; typeLocGlobRes ; pointToStack ; table ; field)
- hmX_GET BLOB BY INDEX ( Context ; stack_id ; typelocalglobal ; index ; blob)
- hmX_GET PICTURE BY INDEX ( Context ; stack_id ; typelocalglobal ; index ; picture)
- hmX_Get Variables ( Context ; Stack_id ; Typelocalglobal ; Copy) → List New in v19
- hmX_Delete Variable ( Context ; Stack_id ; Typelocalglobal ; Name) -> Error New in v19
Tokenize/detokenize methods
- hmX_TOKENIZE ( Method text ; Script)
- hmX_TOKENIZE IN CONTEXT ( Context ; Method text ; Script)
- hmX_Detokenize ( Script ) → Method Text
- hmX_Detokenize In Context ( Context ; Script ) → Method Text
- hmX_DETOKENIZE TO ARRAYS ( Script ; arrayType ; arrayNum ; arrayText ; arrayDate)
- hmX_DETOKENIZE CTX TO ARRAYS ( Context ; Method ; arrayType ; arrayNum ; arrayText ; arrayDate)
Executing scripts
- hmX_Execute ( Method ; Error ; Line) → Error
- hmX_Execute Method In Context ( Context ; Methodname ; Line) → Next line
Execute Code in Text
Managing methods in context
- hmX_ADD METHOD TO CONTEXT ( Context ; Method name ; Content)
- hmX_DELETE METHOD IN CONTEXT ( Context ; Method name)
- hmX_GET METHOD ( Context ; Method name ; Content)
Managing virtual structure
- hmX_ACTIVATE VSTRUCTURE ( Context ; onOff)
- hmX_Create VStructure Table ( Context ; tableNo ; Caption) → Error
- hmX_Create VStructure Field ( Context ; tableNo ; fieldNo ; Caption) → Error
- hmX_Create VStructure Meth ( Context ; Method name ; Caption) → Error
Scripts syntax coloring
- hmX_SET 4D CODE STYLE ( Type ; Color ; Style)
- hmX_GET 4D CODE STYLE ( Type ; Color ; Style)
- hmX_Count 4D Code Styles → Count
Error handling
Utilities
- hmX_Token Blob To Object (Script) → Object New in v19
- hmX_Token Object To Blob (Object) → Script New in v19
4D commands
- hmX_GET AVAILABLE COMMANDS ( CommandNumbers)
- hmX_SET ALLOWED COMMANDS ( Context ; CommandNumbers ; Option)
- hmX_GET ALLOWED COMMANDS ( Context ; CommandNumbers)
PDF Tools
- hmRep_Create Report With PDF ( Area ; path) → report UUID
- hmRep_Print Over PDF ( Area ; path) → error code
- hmRep_PDF Split (path) → Pages
- hmRep_Combine PDF (source1 ; source2 ; target) → Result
- hmRep_ENCRYPT PDF ( Input ; Output ; Password) New in v20
Utilities
- hmRep_TEXT2ARRAY ( Text ; Array ; Width ; Font ; Fontsize ; Fontstyle)
- hmRep_GET TEXT MEASURES ( Text ; Fontname ; Fontsize ; Fontstyle ; Width ; Height ; Ascent ; Descent)
- hmRep_Get String Width ( Text ; Font ; Fontsize ; Fontstyle) → Width
- hmRep_GET MEMORY INFO ( Handles ; Bytes)
- hmRep_GET PICTURE TYPES ( Picture ; Types)
- hmRep_INDEX2RGB ( Indexcolor ; Red ; Green ; Blue)
- hmRep_RGB2Index ( Red ; Green ; Blue) → indexcolor
- hmRep_Get Resources Folder → Path
- hmRep_Get Font Family Name ( Font name ) → Font family
- hmRep_Get Current Thread ID → Thread ID
Appendix
- Area Properties
- Report Properties
- Object Properties
- Events
- Path types
- Object types
- Picture types
- Gradient types
- Page Properties
- Layer Properties
- Guide Properties
- Tools
- Iteration Types
- Section Properties
- Section Types
- Section Break Types
- Section Visible Types
- Virtual Structure Properties
- Virtual Structure Item Types
- Colors
- Import Types
- Dialog types
- Menu Actions
- List of Supported 4D Commands
- Error Codes