EDIT: Download link updated to hmgscript.r31b.
- new: setOrder( cOrder ) method for Browse class.
- new: setFilter( cFilter ) method for Browse class.
- changed: Optimized Browse.
- changed: Paged Browse demo.
Enjoy!HMGSCRIPT REFERENCE (R31) - Roberto Lopez (http://www.hmgforum.com)
FORM
Element: DIV
You can use all the properties, events and methods availables for it via DOM.
Syntax:
Form( cCaption , nWidth , nHeight )
Methods:
- release( cValue )
- getId()
Example:
oWin = new Form ( "Window Demo", 600 , 300 );
oWin.release()
------------------------------------------------------------------------------------------------
BUTTON
Element: INPUT (Type: BUTTON)
You can use all the properties, events and methods availables for it via DOM.
Syntax:
Button( oParent , nRow , nCol , cCaption , cOnClick [,nWidth] )
Methods:
- setValue( cValue )
- getValue()
- enable()
- disable()
- getId()
Example:
oBtn = new Button( oForm ,
50 , 240 ,
"Set Btn Value" ,
"oBtn.setValue('New Value')" );
------------------------------------------------------------------------------------------------
LABEL
Element: SPAN
You can use all the properties, events and methods availables for it via DOM.
Syntax:
Label( oParent , nRow , nCol , cValue )
Methods:
- getId()
------------------------------------------------------------------------------------------------
TEXTBOX
Element: INPUT (Type: TEXT/PASSWORD)
You can use all the properties, events and methods availables for it via DOM.
Syntax:
TextBox( oParent , nRow , nCol , cValue , bPassword )
Methods:
- setValue( cValue )
- setFocus()
- enable()
- disable()
- getValue()
- setJustify( cAlign )
- getId()
- setAsNumber(nValue)
- getAsNumber()
- setNumericMask ( nIintDigits , nDecimals , cDecimalSeparator ,
cGgroupSeparator , bAllowNegative, bLeftToRight,
cCurrencySymbol )
- setStringMask ( cMask )
# digit
A alphabetic
U uppercase
L lowercase
C capitalize
? any character
\ escape
Notes:
Possible values for cAlign: 'right', 'left', 'center' and 'justify'.
Example:
oText = new TextBox( oForm , 130, 230, "TextBox!" );
alert( oText.getValue() );
------------------------------------------------------------------------------------------------
EDITBOX
Element: INPUT (Type: TEXTAREA)
You can use all the properties, events and methods availables for it via DOM.
Syntax:
EditBox( oParent , nRow , nCol , cValue )
Methods:
- setValue( cValue )
- getValue()
- getId()
Example:
oEdit = new EditBox( oForm , 130, 230, "TextBox!" );
alert( oEdit.getValue() );
------------------------------------------------------------------------------------------------
CHECKBOX
Element: INPUT (Type: CHECKBOX)
You can use all the properties, events and methods availables for it via DOM.
Syntax:
CheckBox( oParent , nRow , nCol , xChecked )
Notes:
xChecked parameter can be boolean (true or false) or string ('Yes' or 'No')
Methods:
- check()
- unCheck()
- isChecked()
- getValue()
- setValue( cValue )
- getId()
Example:
oCheck = new CheckBox( oForm , 140 , 280 , true );
alert(oCheck.isChecked())
oCheck.check()
oCheck.unCheck()
------------------------------------------------------------------------------------------------
COMBOBOX
Element: SELECT
You can use all the properties, events and methods availables for them via DOM.
Syntax:
ComboBox( oParent , nRow , nCol , aOptions , aValues [, nSelectedIndex] )
Methods:
- getValue( nIndex )
- setValue( nIndex , cValue )
- setSelectedIndex ( nIndex )
- getSelectedIndex()
- getId()
Example:
oCombo = new ComboBox( oForm , 140 , 270 ,
[ 'one' , 'two' , 'three' ] ,
[ 'value one' , 'value two' , 'value three' ] , 0 );
alert ( oCombo.getSelectedIndex() );
------------------------------------------------------------------------------------------------
IMAGE
Element: IMAGE
You can use all the properties, events and methods availables for it via DOM.
Syntax:
Image( oParent , nRow , nCol , cSrc )
Methods:
- getId()
------------------------------------------------------------------------------------------------
PANEL
Element: DIV
You can use all the properties, events and methods availables for it via DOM.
Syntax:
Panel( oParent , nRow , nCol , nWidth , nHeight , cValue )
Methods:
- getId()
------------------------------------------------------------------------------------------------
APPEND
Appends a record.
Syntax:
Append( cTable , aColumns , aValues )
Notes:
aValues array. The dates must be specified as ANSI strings.
Logical fields can be specified as boolean or strings ('Yes' or 'No').
The numeric fields can be specified as numbers or strings.
------------------------------------------------------------------------------------------------
DELETE
Delete records matching the cForExpr.
Syntax:
Delete( cTable , cForExpr )
------------------------------------------------------------------------------------------------
MODIFY
Modifies records matching the cForExpr.
Syntax:
Modify( cTable , aColumns , aValues , cForExpr )
Notes:
aValues array. The dates must be specified as ANSI strings.
Logical fields can be specified as boolean or strings ('Yes' or 'No').
The numeric fields can be specified as numbers or strings.
------------------------------------------------------------------------------------------------
LOGIN
Syntax:
Login( cUser , cPassword )
------------------------------------------------------------------------------------------------
LOGOUT
Syntax:
Logout()
------------------------------------------------------------------------------------------------
BROWSE
Elements: DIV/TABLE
Creates an HTML table inside a scrollable DIV, loaded with the specified dbf query.
Syntax:
Browse( oParent , nRow, nCol, nWidth, nHeight, cDbfFile, aColumns,
aHeaders , cForExpr , cOrder , nInnerWidth [,nPageSize] )
Methods:
- refresh()
- getSelectedRows()
- getRowCount()
- select()
- unSelect()
- getCell(nRow,nCount)
- getSelectedRowCount()
- getPageSize()
- loadPage( nPage )
- recordCount()
- setOrder( cOrder )
- setFilter( cFilter )
- getId()
Example:
oBrowse = new Browse( oParent , 050 , 050 , 550 , 300 ,
'test' , [ 'code' , 'first' , 'last' , 'birth' , 'married' ] ,
[ 'Code' , 'First' , 'last' , 'Birth' , 'Married' ] ,
'code < 100' ,
'code' , 700 );
oBrowse.refresh()
------------------------------------------------------------------------------------------------
QUERY
Returns a recordset from a server table as an array.
Syntax:
Query ( cDbf, aColumns, cForExpr, cOrder )
Example:
aRecordSet = Query ( 'test' ,
[ 'code' , 'first' , 'last' , 'birth' , 'married' ] ,
'code<=10' , '' );
------------------------------------------------------------------------------------------------
GRID
Elements: DIV/TABLE
Creates an HTML table inside a scrollable DIV.
Syntax:
Grid( oParent, nRow, nCol, nWidth, nHeight, aHeaders, nInnerWidth )
Methods:
- addRow(aRow)
- getSelectedRows()
- getRowCount()
- select()
- unSelect()
- getCell(nRow,nCount)
- setCell(nRow,nCount,cValue)
- getSelectedRowCount()
- deleteRow(nRow)
- setJustify(aAlign)
- getId()
Notes:
Possible values for aAlign array: 'right', 'left', 'center' and 'justify'.
Example:
oGrid = new Grid( oWin, 40, 020, 480, 190,
[ 'One' , 'Two' , 'Three' ], 550 );
oGrid.addRow ( [ 'cell 1.1' , 'cell 1.2' , 'Cell 1.3' ] );
------------------------------------------------------------------------------------------------
RADIOGROUP
Element: INPUT (Type: RADIO)
You can use all the properties, events and methods availables for them via DOM.
Syntax:
RadioGroup( oParent , nRow , nCol , aOptions , nSelectedIndex )
Methods:
- setSelectedIndex ( nIndex )
- getSelectedIndex()
- getId( nIndex )
Example:
oRadio = new RadioGroup( oForm , 140 , 270 ,
[ 'one' , 'two' , 'three' ] ,
1 );
alert ( oRadio.getSelectedIndex() );
------------------------------------------------------------------------------------------------
LISTBOX
Element: SELECT
You can use all the properties, events and methods availables for them via DOM.
Syntax:
ListBox( oParent , nRow , nCol , aOptions , aValues , nSize [, nSelectedIndex] )
Methods:
- getValue( nIndex )
- setValue( nIndex , cValue )
- setSelectedIndex ( nIndex )
- getSelectedIndex()
- getId()
Example:
oList = new ListBox( oForm , 140 , 270 ,
[ 'one' , 'two' , 'three' ] ,
[ 'value one' , 'value two' , 'value three' ] , 3 , 1 );
alert ( oList.getSelectedIndex() );
------------------------------------------------------------------------------------------------
SPINNER
Element: INPUT (Type: number)
You can use all the properties, events and methods availables for them via DOM.
Syntax:
Spinner( oParent , nRow , nCol , nValue )
Methods:
- getValue( nIndex )
- setValue( nIndex , cValue )
- setMin( nValue )
- setMax( nValue )
- setStep( nValue )
- getId()
Example:
oSpinner = new Spinner( oWin , 130, 230, 5 );
oSpinner.setMin(1);
oSpinner.setMax(10);
oSpinner.setStep(0.5);
alert( oSpinner.getValue() );
------------------------------------------------------------------------------------------------
SLIDER
Element: INPUT (Type: range)
You can use all the properties, events and methods availables for them via DOM.
Syntax:
Slider( oParent , nRow , nCol , nValue )
Methods:
- getValue( nIndex )
- setValue( nIndex , cValue )
- setMin( nValue )
- setMax( nValue )
- setStep( nValue )
- getId()
Example:
oSlider = new Slider( oWin , 130, 230, 5 );
oSlider.setMin(1);
oSlider.setMax(100);
oSlider.setStep(50);
alert( oSlider.getValue() );
------------------------------------------------------------------------------------------------
DATEPICKER
Element: INPUT (Type: DATE)
You can use all the properties, events and methods availables for it via DOM.
Syntax:
DatePicker( oParent , nRow , nCol , dValue )
Methods:
- setValue( cValue )
- getValue()
- getId()
Example:
oDate = new DatePicker( oForm , 130, 230, "2012-12-31" );
alert( oDate.getValue() );
------------------------------------------------------------------------------------------------
EDIT: Download link updated to hmgscript.r31b.