Team Developer - API Reference : Table Functions

SQLWindows Function Reference
 
Table Functions
This is an alphabetical list of the SQLWindows table functions accompanied by detailed information about each function’s purpose, its parameters and return value, and an example.
Function descriptions include:
Note: For the most up-to-date API reference, see the in-build help. To check if a function is supported for WPF applications, review the list of Unsupported SAL Functions.
SalTblAnyRows
Syntax
bAny = SalTblAnyRows ( hWndTbl, nFlagsOn, nFlagsOff )
Description
Determines whether any rows in the specified table window or grid match certain flags.
If you set nFlagsOn to zero (0) and nFlagsOff to zero (0), SalTblAnyRows returns TRUE if the table window or grid contains any rows at all, regardless of their flags.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
nFlagsOn Number. The flags that the row should have. You can combine ROW_* flags using the OR (|) operator.
nFlagsOff Number. The flags that the row should not have. You can combine ROW_* flags using the OR (|) operator.
Return Value
bAny is TRUE if any of the table window or grid's rows have any of the nFlagsOn flags and none of the nFlagsOff flags.
See Also
SalTblFindNextRow
SalTblFindPrevRow
Example
Menu Settings
Enabled When: SalTblAnyRows ( tblTable,
ROW_Selected, 0 )
SalTblClearSelection
Syntax
bOk = SalTblClearSelection ( hWndTbl )
Description
Deselects all rows of a table window or grid.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
See Also
SalTblSetRowFlags
Example
Call SalTblClearSelection ( hWndForm )
SalTblColumnAverage
Syntax
nAverage = SalTblColumnAverage ( hWndTbl, nColumnID, nFlagsOn, nFlagsOff )
Description
Computes the average of all column values or only specified column values in a table window or grid.
Use SQLWindows row flag constants to specify the rows to use in the computation. For example, you can choose to average only the values of modified rows.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
nColumnID Number. The Column Identifier.
nFlagsOn Number. The flags that the row should have. You can combine ROW_* flags using the OR (|) operator.
nFlagsOff Number. The flags that the row should not have. You can combine ROW_* flags using the OR (|) operator:
Return Value
nAverage is the average of all column values or only specified column values in a table window or grid. nAverage is equal to zero (0) if an error occurs.
See Also
SalTblColumnSum
Example
Set nAverage = SalTblColumnAverage ( hWndTbl, nColumnID,
nFlagsOn, nFlagsOff )
SalTblColumnSum
Syntax
nSum = SalTblColumnSum ( hWndTbl, nColumnID, nFlagsOn, nFlagsOff )
Description
Computes the sum of all column values or only specified column values in a table window or grid.
Use SQLWindows row flag constants to specify the rows to use to compute the sum. For example, you can choose to sum only the values of modified rows.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
nColumnID Number. The Column Identifier
nFlagsOn Number. The flags that the row should have. You can combine ROW_* flags using the OR (|) operator.
nFlagsOff Number. The flags that the row should not have. You can combine ROW_* flags using the OR (|) operator.
Return Value
nSum is the sum of all column values or only specified column values in a table window or grid. nSum is equal to zero (0) if an error occurs.
See Also
SalTblColumnAverage
Example
Set nSum = SalTblColumnSum ( hWndTbl, nColumnID, nFlagsOn,
nFlagsOff )
SalTblCopyRows
Syntax
bOk = SalTblCopyRows ( hWndTbl, nFlagsOn, nFlagsOff )
Description
Copies the contents of the specified table window or grid’s rows to the Clipboard in text format. In the Clipboard, columns are delimited by TAB characters and rows are delimited by end-of-line characters.
Set nFlagsOn to zero (0) and nFlagsOff to zero (0) to copy the entire table. The copy stops, without indicating a failure, after copying 64 Kbytes of text. Each individual column value is limited to 512 bytes of text.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
nFlagsOn Number. The flags that the row should have. You can combine ROW_* flags using the OR (|) operator.
nFlagsOff Number. The flags that the row should not have. You can combine ROW_* flags using the OR (|) operator.
Return Value
bOk is TRUE if any of the table window or grid's rows are copied to the Clipboard and FALSE if no rows matched the indicated flags, or if none of the matched rows could be copied to the Clipboard.
See Also
SalTblPasteRows
Example
Call SalTblCopyRows ( tblTable, ROW_Selected, 0 )
SalTblCreateColumn
Syntax
nColId = SalTblCreateColumn ( hWndTbl, nColumnPos, nDispWidth, nMaxChars, strTitle )
Description
Creates a table window or grid column of string data type at runtime.
When you return to design mode, SQLWindows destroys the column.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
nColumnPos Number. The Column Position
nDispWidth Number. The display width of the column in inches.
nMaxChars Number. The maximum number of characters that the column can contain.
strTitle String. The column title.
Return Value
nColId is the Column Identifier of the new column. nColld is negative one (-1) if an error occurs.
Example
Set nColId = SalTblCreateColumn ( hWndTbl, nColumnPos,
nDispWidth, nMaxChars, strTitle )
 
SalTblCreateColumnEx
Syntax
nColId = SalTblCreateColumnEx ( hWndTbl, nColumnPos, nDispWidth, strTitle, nMaxChars, nDatatype )
Description
Creates a table window or grid column of speicified data type at runtime.
When you return to design mode, SQLWindows destroys the column.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
nColumnPos Number. The Column Position
nDispWidth Number. The display width of the column in inches.
strTitle String. The column title.
nMaxChars Number. The maximum number of characters that the column can contain.
nDatatype Number. Must be equal to constant DT_String, DT_DateTime, or DT_Number. Any other value will cause the function to fail.
Return Value
nColId is the Column Identifier of the new column. nColld is negative one (-1) if an error occurs.
Example
Set nColId = SalTblCreateColumnEx ( hWndTbl, nColumnPos,
nDispWidth, strTitle, nMaxChars, DT_Number )
 
SalTblDefineCheckBoxColumn
Syntax
bOk = SalTblDefineCheckBoxColumn( hWnd, hWndCol, nFlags, sCheckedValue, sUncheckedValue )
Description
Define a column as a check box.
Parameters
hWnd Window Handle. The handle (or name) of a table window or grid.
HWndCol Window Handle. The handle (or name) of a table window or grid column.
nFlags Number. nFlags is a combination of the following flags using the '|' operator:
COL_CheckBox_IgnoreCase = 0x0001
sCheckedValue String. sCheckedValue is the value that a cell will get when the check box is checked.
sUncheckedValue String. The value when a check box is unchecked.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
Example
Set bOk = SalTblDefineCheckBoxColumn( hWnd, hWndCol, nFlags,
sCheckedValue, sUncheckedValue )
SalTblDefineDropDownListColumn
Syntax
bOk = SalTblDefineDropDownListColumn( hWnd, hWndCol, nFlags, nLines )
Description
Define a column as a drop down list.
Parameters
hWnd Window Handle. The handle (or name) of a table window or grid.
HWndCol Window Handle. The handle (or name) of a table window or grid column.
nFlags Number. nFlags is a combination of the following flags using the '|' operator:
COL_DropDownList_Sorted = 0x0001
COL_DropDownList_VScroll = 0x0002
COL_DropDownList_Auto = 0x0004
COL_DropDownList_Editabel = 0x0008
nLines Number. nLines indicates the maximum number of lines to display in the list.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
Example
Set bOk = SalTblDefineDropDownListColumn( hWnd, hWndCol,
nFlags, nLines )
SalTblDefinePopupEditColumn
Syntax
bOk = SalTblDefinePopupEditColumn( hWnd, hWndCol, nFlags, nLines )
Description
Define a column as a popup edit window. nLines indicates the maximum number of lines to display in the control.
Parameters
hWnd Window Handle. The handle (or name) of a table window or grid.
HWndCol Window Handle. The handle (or name) of a table window or grid column.
nFlags Number. nFlags is always 0 (zero).
nLines Number. nLines indicates the maximum number of lines to display in the list.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
Example
Set bOk = SalTblDefinePopupEditColumn ( hWnd, hWndCol, nFlags,
nLines )
SalTblDefineRowHeader
Syntax
bOk = SalTblDefineRowHeader ( hWndTable, strTitle, nWidth, nFlags, hWndCol )
Description
Defines the appearance and behavior of a table window or grid's row header. The row header is a non-editable area on the left edge of a table window or grid that displays information that stays displayed even when a user scrolls horizontally. A typical use of a row header is the display of row numbers.
Parameters
hWndTable Window Handle. The handle (or name) of a table window or grid.
strTitle String. The title of the row header column.
nWidth Number. The width of the row header in pixels.
nFlags Number. The row header attributes. You can combine these flags using the OR (|) operator. Possible values include:
TBL_RowHdr_MarkEdits
TBL_RowHdr_ShareColor
TBL_RowHdr_Sizable (i.e. Not supported by grid.)
TBL_RowHdr_Visible
hWndCol Window Handle. The column that the row header mirrors. Whatever displays in hWndCol displays in the row header. If hWndCol equals hWndNULL, the row header is blank.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
Example
Call SalTblDefineRowHeader ( tbl1, strTitle,
nWidth,TBL_RowHdr_Visible | TBL_RowHdr_ShareColor,
colRowHeader )
SalTblDefineSplitWindow
Syntax
bOk = SalTblDefineSplitWindow ( hWndTable, nRowsLowerHalf, bDragAdjust )
Description
Splits a table window horizontally.
You can insert rows into the lower half of a split table window. This is convenient when the scroll range is dynamic because you can insert rows without knowing the number of rows in the table window. You can also use the lower half of a split table window to display summary data.
Parameters
hWndTable Window Handle. The handle (or name) of a table window to split.
nRowsLowerHalf Number. The number of rows to make visible in the lower half of the split window. If you specify zero (0), the table window is not split.
bDragAdjust Boolean. Specify whether (TRUE) or not (FALSE) to let the user drag-adjust the visible rows in both halves of a split window.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
Example
Set bAnyFlag = SalTblDefineSplitWindow ( hWndTbl, 3,
TBL_Split_Adjustable )
SalTblDeleteRow
Syntax
bOk = SalTblDeleteRow ( hWndTbl, nRow, nFlag )
Description
Deletes a row from a table window or grid but not from the database.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
nRoNumber. The number of the row to delete.
nFlag Number. A constant used to coordinate a delete from the table window or grid with a delete from a SQLBase result set. This parameter can be one of these values:
TBL_Adjust
TBL_NoAdjust
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
Example
Call SalTblDeleteRow ( hWndForm, nCurrentRow, TBL_NoAdjust)
SalTblDeleteSelected
Syntax
bOk = SalTblDeleteSelected ( hWndTbl, hSql )
Description
Applies a SQL DELETE statement to all table window or grid rows with the ROW_Selected flag set. You must prepare or retrieve the SQL DELETE statement before calling this function.
As each row is deleted from the database, SQLWindows deletes it from the table window or grid display.
This function does not perform a COMMIT. You must perform a COMMIT to ensure that the deletions are not lost in the case of a rollback.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
hSql Sql Handle. The handle of a DELETE statement.
Return Value
bOk is TRUE if the function succeeds and FALSE if hWndTbl or hSql is invalid.
See Also
SalTblDoDeletes
SalTblDoInserts
SalTblDoUpdates
SalTblPopulate
Example
Call SalTblDeleteSelected ( tblExample, hSql )
SalTblDestroyColumns
Syntax
bOk = SalTblDestroyColumns ( hWndTbl )
Description
Destroys all automatic columns created by SalTblCreateColumn or SalTblPopulate at runtime.
This function only works on table window or grids that contain only automatic columns.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
Return Value
bOk is TRUE if the function succeeds and FALSE if hWndTbl is invalid or the table window or grid contains non-automatic columns (columns created at design time).
See Also
SalTblCreateColumn
SalTblPopulate
Example
Set bOk = SalTblDestroyColumns ( hWndTbl )
SalTblDoDeletes
Syntax
bOk = SalTblDoDeletes ( hWndTbl, hSql, nFlagsOn )
Description
Applies a SQL DELETE statement to all table window or grid rows that have nFlagsOn flags set. You must prepare the SQL DELETE statement before calling this function.
As each row is deleted from the database, SQLWindows deletes it from the table window or grid display.
This function does not perform a COMMIT. You must perform a COMMIT to ensure that the deletions are not lost in the case of a rollback.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
hSql Sql Handle. The handle of a DELETE statement.
nFlagsOn Number. SQLWindows uses row flags to determine which rows to delete. You can specify either of these flags:
ROW_MarkDeleted
ROW_Selected
Return Value
bOk is TRUE if any rows are deleted and FALSE otherwise. bOk is FALSE if hWndTbl or hSql is invalid.
See Also
SalTblDeleteSelected
SalTblDoInserts
SalTblDoUpdates
Example
Call SalTblDoDeletes ( tblExample, hSql, ROW_MarkDeleted )
SalTblDoInserts
Syntax
bOk = SalTblDoInserts ( hWndTbl, hSql, bClearFlags )
Description
Applies a SQL INSERT statement to all the rows in a table window or grid that have the ROW_New flag set. You must prepare the SQL INSERT statement before calling this function.
This function does not perform a COMMIT. You must perform a COMMIT to ensure that insertions are not lost in the case of a rollback.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
hSql Sql Handle. The handle of an INSERT statement.
bClearFlags Boolean. Whether to reset the ROW_New flag.
If TRUE, SQLWindows clears the ROW_New flag of each inserted row; if FALSE, SQLWindows does not clear the ROW_New flag of each inserted row. This is useful for error handling; if an error occurs, you can rollback the transaction and try again.
Return Value
bOk is TRUE if the function succeeds and FALSE if hWndTbl or hSql is invalid.
See Also
SalTblDeleteSelected
SalTblDoDeletes
SalTblDoUpdates
SalTblPopulate
Example
Call SalTblDoInserts ( tblExample, hSql, FALSE )
SalTblDoUpdates
Syntax
bOk = SalTblDoUpdates ( hWndTbl, hSql, bClearFlags )
Description
Applies a SQL UPDATE statement to all table window or grid rows with the ROW_Edited flag set. You must prepare the SQL UPDATE statement before calling this function.
This function does not perform a COMMIT. You must perform a COMMIT to ensure that the updates are not lost in the case of a rollback.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
hSql Sql Handle. The handle of an UPDATE statement.
bClearFlags Boolean. Whether to reset the ROW_Edited flag.
If TRUE, SQLWindows clears the ROW_Edited flag of each changed row; if FALSE, SQLWindows does not clear the ROW_Edited flag of each changed row. This is useful for error handling; if an error occurs, you can roll back the transaction and try again.
Return Value
bOk is TRUE if the function succeeds and FALSE if hWndTbl or hSql is invalid.
See Also
SalTblDeleteSelected
SalTblDoDeletes
SalTblDoInserts
SalTblPopulate
Example
Call SalTblDoUpdates ( tblExample, hSql, FALSE )
SalTblFetchRow
Syntax
nResult = SalTblFetchRow ( hWndTbl, nRow )
Description
Sends a SAM_FetchRow message to a table window or grid if the row you specify is not currently in the table window or grid cache. To process the SAM_FetchRow message, fetch the row from the database or another data source.
The SAM_FetchRow message sets the context row to the row you specify before the table window or grid receives the message.
Parameters
hWndTbl Window Handle. The handle (or name) of the table window or grid that owns the row being retrieved.
nRoNumber. The row number.
Return Value
nResult is one of these values: TBL_RowDeleted, TBL_RowFetched, TBL_NoMoreRows.
See Also
SalTblQueryContext
SalTblSetContext
Example
Call SalTblFetchRow ( hWndtblTelephone, nMaxRange )
SalTblFindNextRow
Syntax
bOk = SalTblFindNextRow ( hWndTbl, nRow, nFlagsOn, nFlagsOff )
Description
Scans forward in a table looking for a row whose flags match those specified. The search stops at the first row that has any of the nFlagsOn flags set, and none of the nFlagsOff flags set.
Use this function in a loop to find all the table window or grid rows that match specified conditions. You do not need to increment the row number; SQLWindows continues the search starting at the next row. To begin the search at the first row, set nRow to TBL_MinRow.
Note: You cannot use TBL_MinRow without first assigning its value to a variable. This is because TBL_MinRow is a SQLWindows constant, and nRow is a receive parameter whose value the function can change.
Parameters
hWndTbl Window Handle. The handle of the table window or grid to search.
nRow Receive Number. The row at which to begin the search; the search starts on nRow + 1. If SQLWindows finds a row, it returns its row number in this parameter.
nFlagsOn Number. The flags the row should have.
nFlagsOff Number. The flags the row should not have. Specify zero (0) for no flags.
You can specify any of the ROW_* flags for nFlagsOn and nFlagsOff. If you want to specify more than one, combine them using the OR (|) operator.
Return Value
bOk is TRUE if SQLWindows finds a row and FALSE if there are no matches.
See Also
SalTblFindPrevRow
SalTblSetFlagsAnyRows
Example
If SalTblFindNextRow ( hWndForm, nCurrentRow,
ROW_Selected, 0 )
SalTblFindPrevRow
Syntax
bOk = SalTblFindPrevRow ( hWndTbl, nRow, nFlagsOn, nFlagsOff )
Description
Scans backward in a table looking for a row whose flags match those specified. The search stops at the first row that has any of the nFlagsOn flags set, and none of the nFlagsOff flags set.
Use this function in a loop to find all the table window or grid rows that match specified conditions. You do not need to decrement the row number; SQLWindows continues the search starting at the next row. To begin the search at the last row, set nRow to TBL_MaxRow.
Note: You cannot use TBL_MaxRow without first assigning its value to a variable. This is because TBL_MaxRow is a SQLWindows constant, and nRow is a receive parameter whose value the function can change.
Parameters
hWndTbl Window Handle. The handle of the table window or grid to search.
nRoReceive Number The row at which to begin the search; the search starts on nRow - 1. If SQLWindows finds a row, it returns its row number in this parameter.
nFlagsOn Number. The flags the row should have.
nFlagsOff Number. The flags the row should not have. Specify zero (0) for no flags.
You can specify any of the ROW_* flags for nFlagsOn and nFlagsOff. If you want to specify more than one, combine them using the OR (|) operator.
Return Value
bOk is TRUE if SQLWindows finds a row and FALSE if there are no matches.
See Also
SalTblFindNextRow
SalTblSetFlagsAnyRows
Example
If SalTblFindPrevRow ( hWndForm, nCurrentRow,
ROW_Selected, 0 )
SalTblGetColumnText
Syntax
bOk = SalTblGetColumnText ( hWndTbl, nColumnID, strText )
Description
Gets data from a column of a table window or grid's context row.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
nColumnID Number. The Column Identifier
strText Receive string. The column data.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
See Also
SalTblSetColumnText
Example
Set bOk = SalTblGetColumnText ( hWndTbl, nColumnID, strText )
SalTblGetColumnTitle
Syntax
nLength = SalTblGetColumnTitle ( hWndCol, strText, nMaxLen )
Description
Gets the title of a table window or grid column.
Parameters
hWndCol Window Handle. The handle (or name) of a table window or grid column.
strText Receive String. The title.
nMaxLen Number. The maximum length of the title.
Return Value
nLength is the length of the column title returned in strText.
See Also
SalTblSetColumnTitle
Example
Call SalTblGetColumnTitle ( colRowHeader, strTitle, 100 )
SalTblGetColumnWindow
Syntax
hWndCol = SalTblGetColumnWindow ( hWndTbl, nCol, nFlags )
Description
Gets the handle of a table window or grid column.
Parameters
hWndTbl Window Handle. The handle (or name) of the table window or grid that contains the column whose window handle you want.
nCol Number. A column position or a column identifier.
nFlags Number. A constant that identifies whether nCol's value is a column identifier or a column position. Specify either:
COL_GetID
COL_GetPos
Return Value
hWndCol is the handle of a table window or grid column. hWndCol is equal to hWndNULL if SQLWindows cannot find the table window or grid column.
Example
Set hWndCol = SalTblGetColumnWindow ( tbl1, nColID,
COL_GetID )
SalTblInsertRow
Syntax
nNewRow = SalTblInsertRow ( hWndTbl, nRow )
Description
Inserts a new blank row into a table window or grid.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
nRowNumber The row number of the new row.
If this value is a valid row number within the table window or grid range, then SQLWindows inserts a blank row at that location.
If you specify TBL_MaxRow, SQLWindows appends the row to the end of the table window or grid.
If the table window or grid is split and you specify TBL_MinSplitRow, SQLWindows appends the row to the top of the lower half of the table window or grid.
Return Value
nNewRow is the number of the new row if the function succeeds. It is equal to TBL_Error if an error occurs.
Example
Set nNewRow = SalTblInsertRow ( hWndTbl,
TBL_MinSplitRow )
SalTblKillEdit
Syntax
bOk = SalTblKillEdit ( hWndTbl )
Description
Takes a row out of edit mode and selects the row. This causes the row to receive both SAM_Validate and SAM_KillFocus messages.
Parameters
hWndTbl Window Handle. The handle (or name) of the table window or grid that contains the row just inserted or modified.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
Example
Set bOk = SalTblKillEdit ( hWndTbl )
SalTblKillFocus
Syntax
bOk = SalTblKillFocus ( hWndTbl )
Description
Turns off the table window or grid's focus frame. This is useful when the user chooses a menu item from a table window or grid menu; in this case, the focus cannot leave the table window or grid.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
Example
Call SalTblKillFocus ( hWndForm )
SalTblObjectsFromPoint
Syntax
bOk = SalTblObjectsFromPoint( hWndTable, nX, nY, nRow, hWndCol, nFlags )
Description
Returns the part of the table window or grid located at a given coordinate.
These flags indicate the part where the X coordinate is located:
TBL_XOverLockedColumns
TBL_XOverLockedColumnsBorder
TBL_XOverRowHeader
TBL_XOverUnlockedColumns
These flags indicate the part where the Y coordinate is located:
TBL_YOverColumnHeader
TBL_YOverNormalRows
TBL_YOverSplitBar
TBL_YOverSplitRows
Parameters
hWndTable Window Handle. The handle of the table window or grid.
nX, nY Number. Screen pixel coordinates relative to upper left corner of the table window or grid. You get these values from SAM_ContextMenu.
nRow Receive Number. If nY is over a row then the row number is returned in nRow; otherwise nRow is TBL_Error.
hWndCol Receive Window Handle. If nX is over a column then its window handle is returned in hWndCol; otherwise hWndCol is hWndNULL.
nFlags Receive Number. The part of the table. These flags indicate the part where the X coordinate is located.
Return Value
bOk is TRUE if this function succeeds and FALSE otherwise.
No Example
 
See Also
SAM_ContextMenu
SalTblPasteRows
Syntax
bOk = SalTblPasteRows ( hWndTbl )
Description
Pastes the contents of the Clipboard to the specified table window or grid.
SQLWindows assumes the Clipboard data is in text format with cells delimited by tab characters and rows delimited by end-of-line characters. SQLWindows inserts the new rows into the table window or grid without overwriting existing rows, and converts the data to the data types of the corresponding table window or grid columns.
Parameters
hWndTbl Window Handle. The handle (or name) of the table window or grid receiving the data from the Clipboard.
Return Value
bOk is TRUE if the Clipboard contains text that is successfully inserted into the table window or grid, and FALSE otherwise, and if none of the columns are editable.
See Also
SalTblCopyRows
Example
Call SalTblPasteRows ( tblPhoneList )
SalTblPopulate
Syntax
bOk = SalTblPopulate( hWndTbl, hSql, strSelect, nMethod )
Description
Compiles, binds, and executes a SQL SELECT statement, then fetches the rows of the result set and populates a table window or grid with them. SalTblPopulate also manages table window or grid browsing.
This function also works with table window or grids that do not have columns. SQLWindows creates columns at runtime based on the SQL statement's SELECT list, and uses the database column names as table window or grid column titles. If you call SalTblPopulate again during the same runtime session, SQLWindows destroys the automatic table window or grid columns created by the last SELECT statement and creates new columns.
SalTblPopulate also works with SELECT statements that do not include INTO clauses. The table window or grid must have the same number of columns as the SQL statement's SELECT list, and their data types must match the data types of the columns in the SELECT list.
If you process and Return from the SAM_FetchRow message, SalTblPopulate does not fetch that row into the table window or grid. If you process but do not Return from the SAM_FetchRow message, SalTblPopulate fetches the row into the table window or grid.
The SAM_FetchRow message is sent before the row is actually fetched from the result set so in processing this message, you cannot refer to the row being fetched. However, the SAM_FetchRowDone message is sent after the row is fetched, enabling you to refer to the row just fetched.
Parameters
hWndTbl Window Handle. The handle (or name) of the table window or grid to populate.
hSql Sql Handle. The handle of the SELECT statement. Do not use the Sql Handle passed to SalTblPopulate by other functions while the table window or grid is in use.
strSelect String. The SELECT statement. If the string is null (“), SQLWindows uses the previously prepared SELECT statement associated with hSql. This avoids re-preparing the statement each time SalTblPopulate executes.
nMethod Number. How to populate the table window or grid. Specify one of these values:
TBL_FillAll
TBL_FillAllBackground
TBL_FillNormal
Return Value
bOk is TRUE if the function succeeds and FALSE if either hWndTbl or hSql is invalid.
See Also
SalTblDeleteSelected
SalTblDoDeletes
SalTblDoInserts
SalTblDoUpdates
Example
Call SalTblPopulate ( tblExample, hSql, strSql,
TBL_FillAllBackground )
SalTblPopulateFromXML
Syntax
bOk = SalTblPopulateFromXML (hWndTbl, sFile, sRootNode, bTableNode, bUseSchema)
Description
Clears a table window or grid and then fills new rows with data from an XML document. Optionally uses an XML schema to set attributes in the table.
After each row of data is populated, this function sends message SAM_XMLRowDone to the table window or grid.
New to version 3.1, this function requires that XML documents and schemas conform to Gupta’s naming conventions and structures. It is not possible to populate a table from just any well-formed generalized XML document and schema. XML documents and schemas generated from the SalTblWriteXMLAndSchema function do conform to the necessary conventions and structures. To learn more about these conventions and structures, use SalTblWriteXMLAndSchema against one of your table window or grids in a test application, and examine the output files.
When bUseSchema is set to TRUE, if the table window or grid’s columns were created at design time, the length of each column’s value will be the length assigned at design time. If the table window or grid has no design-time columns and they are being automatically created during the call to this function, then the length of each column’s value will be the length that is specified in the XML schema. This raises the possibility of data truncation, if the value of an element contains more characters than are specified by the design-time length or the XML schema length.
Parameters
hWndTbl Window Handle. The handle (or name) of the table window or grid to populate.
sFile String. The name of the XML document file containing data to be used to populate the table.
sRootNode String. The name of the XML root node of the table, or the name of the XML node pertaining to a table row. See bTableNode.
bTableNode Boolean. If TRUE, it means that the name specified in sRootNode is the actual root node of the table, and this function should use the default name “row” as the name of the node for each table row. If FALSE, it means that the name in sRootNode is actually the name of a row node, and each node found with that name should be processed as a table window or grid row.
bUseSchema Boolean. Indicates whether to retrieve and use an XML schema for determining data types and attributes. If TRUE, the schema is retrieved. If FALSE, data is written into table window or grid cells with the presumption that the table structure is already correct. Currently, bUseSchema cannot be specified TRUE when bTableNode is FALSE.It is possible to call SalTblSetFromXMLSchema against a table window or grid just once, then call this function repeatedly while keeping bUseSchema as FALSE. This technique is somewhat faster than making multiple calls while bUseSchema is TRUE. If bUseSchema is TRUE, the schema file is searched for in the directory that the document is located in, then the current directory, then the Windows TEMP directory. If the schema file is not found, or if the schema is invalid, this function tries to do the XML import without the schema.
 
Return Value
bOk is TRUE if the function succeeds and FALSE if fails. Some failure conditions, such as an invalid file name or invalid root node name, will cause error message dialogs to be displayed.
SalTblQueryCheckBoxColumn
Syntax
bOk = SalTblQueryCheckBoxColumn( hWnd, hWndCol, nFlags, sCheckedValue, sUncheckedValue )
Description
If the column is defined as a check box, this function retrieves information about the check box and returns TRUE. If it is not a check box, this function returns FALSE.
Parameters
hWnd Window Handle. The handle (or name) of a table window or grid.
HWndCol Window Handle. The handle (or name) of a table window or grid column.
nFlags Receive Number. nFlags is a combination of the following flags using the '|' operator:
COL_CheckBox_IgnoreCase = 0x0001
sCheckedValue Receive String. sCheckedValue is the value that a cell will get when the check box is checked.
sUncheckedValue Receive String. The value when a check box is unchecked.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
Example
bOk = SalTblQueryCheckBoxColumn( hWnd, hWndCol, nFlags,
sCheckedValue, sUncheckedValue )
SalTblQueryColumnCellType
Syntax
bOk = SalTblQueryColumnCellType( hWnd, hWndCol, nType )
Description
Indicates whether a column is a checkbox, drop down list, popup edit, or standard column.
Parameters
hWnd Window Handle. The handle (or name) of a table window or grid.
hWindCol Window Handle. The handle (or name) of a table window or grid column.
nType Receive Number. Receives one of the following values.
COL_CellType_Standard = 1
COL_CellType_CheckBox = 2
COL_CellType_DropDownList = 3
COL_CellType_PopupEdit = 4
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
Example
Set bOk = SalTblQueryColumnCellType( hWnd, hWndCol, nType )
SalTblQueryColumnFlags
Syntax
bSet = SalTblQueryColumnFlags ( hWndCol, nFlags )
Description
Tests the state of a table window or grid column's flags.
Parameters
hWndCol Window Handle. The handle (or name) of a table window or grid column.
nFlags Number. The column flags to test. You can combine COL_* flags using the OR (|) operator.
Return Value
bSet is TRUE if any of the flags indicated by nFlags are set and FALSE otherwise.
See Also
SalTblSetColumnFlags
Example
If SalTblQueryColumnFlags ( col1, COL_CenterJustify )
Set rbCenter = TRUE
Else
Set rbLeft = TRUE
SalTblQueryColumnID
Syntax
nColID = SalTblQueryColumnID ( hWndCol )
Description
Gets a table window or grid column's identifier.
Parameters
hWndCol Window Handle. The handle of a table window or grid column.
Return Value
nColID is the Column Identifier. nColID is -1 if hWndCol is not a valid column.
Example
Set nColID = SalTblQueryColumnID ( hWndCol )
Call SalTblSetColumnWidth ( hWndCol, nWidths[ nColID ] )
SalTblQueryColumnPos
Syntax
nPos = SalTblQueryColumnPos ( hWndCol )
Description
Gets a table window or grid column's relative position.
Parameters
hWndCol Window Handle. The handle of a table window or grid column.
Return Value
nPos is the Column Position. nPos is -1 if hWndCol is not a valid handle for a table window or grid column.
See Also
SalTblSetColumnPos
Example
Set nPos = SalTblQueryColumnPos ( hWndCol )
SalTblQueryColumnWidth
Syntax
bOk = SalTblQueryColumnWidth ( hWndTbl, nFormUnits )
Description
Returns the width (in form units) of a table window or grid column.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid column.
nInches Receive Number. The width of the table window or grid column.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
See Also
SalTblSetColumnWidth
Example
Call SalTblQueryColumnWidth ( colRowHeader, nWidth )
SalTblQueryContext
Syntax
nContext = SalTblQueryContext ( hWndTbl )
Description
Returns a table window or grid's current context row.
Before sending a SAM_FetchRow message, SQLWindows automatically sets the context row so that assignments made while processing the message reference the correct row.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
Return Value
nContext is the current context row number.
See Also
SalTblFetchRow
SalTblSetContext
Example
Set nContext = SalTblQueryContext ( hWndTbl )
SalTblQueryDropDownListColumn
Syntax
bOk = SalTblQueryDropDownListColumn( hWnd, hWndCol, nFlags, nLines )
Description
If the column is defined as a drop down list, this function retrieves information about the list and returns TRUE. If it is not a drop down list, this function returns FALSE.
Parameters
hWnd Window Handle. The handle (or name) of a table window or grid.
HWndCol Window Handle. The handle (or name) of a table window or grid column.
nFlags Receive Number. nFlags is a combination of the following flags using the '|' operator:
COL_DropDownList_Sorted = 0x0001
COL_DropDownList_VScroll = 0x0002
COL_DropDownList_Auto = 0x0004
COL_DropDownList_Editable = 0x0008
nLines Receive Number. nLines indicates the maximum number of lines to display in the list.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
Example
Set bOk = SalTblQueryDropDownListColumn ( hWnd, hWndCol,
nFlags, nLines )
SalTblQueryFocus
Syntax
bOk = SalTblQueryFocus ( hWndTbl, nRow, hWndCol )
Description
Identifies the cell in a table window or grid with the focus.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
nRoReceive Number. The row number of the focus row.
hWndCol Receive Window Handle. The handle of the column with the focus.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
See Also
SalTblSetFocusCell
SalTblSetFocusRow
Example
On SAM_Click
Call SalTblQueryFocus ( hWndtblTelephone,
nRow,hWndColumn )
SalTblQueryLinesPerRow
Syntax
bOk = SalTblQueryLinesPerRow( hWndTbl, nLines )
Description
Retrieves the height of a row in lines.
Parameters
HWndTbl Window Handle. The handle (or name) of a table window or grid.
nLines Receive Number. The number of lines.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
Example
Set bOk = SalTblQueryLinesPerRow( hWndTbl, nLines )
SalTblQueryLockedColumns
Syntax
nLockedColumns = SalTblQueryLockedColumns ( hWndTbl )
Description
Retrieves the number of locked table window or grid columns.
Locked table window or grid columns do not scroll horizontally; they are fixed to the left side of the table window or grid. All other columns appear to scroll under the locked columns.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
Return Value
nLockedColumns is the number of locked columns. If there are no locked columns, nLockedColumns is zero (0).
See Also
SalTblSetLockedColumns
Example
Set nLockedColumns = SalTblQueryLockedColumns ( hWndTbl )
SalTblQueryPopupEditColumn
Syntax
bOk = SalTblQueryPopupEditColumn( hWnd, hWndCol, nFlags, Lines )
Description
If the column is defined as a popup edit, this function retrieves information about the popup edit and returns TRUE. If it is not a popup edit, this function returns FALSE.
Parameters
hWnd Window Handle. The handle (or name) of a table window or grid.
HWndCol Window Handle. The handle (or name) of a table window or grid column.
nFlags Receive Number. nFlags is a combination of the following flags using the '|' operator:
COL_DropDownList_Sorted = 0x0001
COL_DropDownList_VScroll = 0x0002
COL_DropDownList_Auto = 0x0004
COL_DropDownList_Editable = 0x0008
nLines Receive Number. nLines indicates the maximum number of lines to display in the list.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
Example
Set bOk = SalTblQueryPopupEditColumn ( hWnd, hWndCol, nFlags,
Lines )
SalTblQueryRowFlags
Syntax
bOk = SalTblQueryRowFlags ( hWndTbl, nRow, nFlags )
Description
Queries a row's flags.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
nRoNumber. The row number of the row whose flags you want to test.
nFlags Number. The row flags to test for. You can combine ROW_* flags using the OR (|) operator.
Return Value
bOk is TRUE if any of the specified flags are set and FALSE if none of the specified flags are set.
See Also
SalTblSetFlagsAnyRows
SalTblSetRowFlags
Example
On SAM_SetFocus
If SalTblQueryRowFlags ( hWndForm, lParam, ROW_New )
SalTblQueryRowHeader
Syntax
bOk = SalTblQueryRowHeader ( hWndTbl, strTitle, nMaxTitle, nWidth,
nFlags, hWndCol )
Description
Gets a table window or grid's row header definition. The row header is a non-editable area on the left edge of a table window or grid that displays information that you do not want to scroll off the screen as the user scrolls horizontally. A typical use is the display of row numbers.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
strTitle Receive String. The title of the row header.
nMaxTitle Number. The maximum length of the title.
nWidth Receive Number. The width of the row header in pixels.
nFlags Receive Number. Row header attributes. Specify one of these:
TBL_RowHdr_MarkEdits
TBL_RowHdr_ShareColor
TBL_RowHdr_Sizable
TBL_RowHdr_Visible
hWndCol Receive Window Handle. The column that the row header mirrors. Whatever displays in hWndCol displays in the row header. If hWndCol is equal to hWndNULL, the row header is blank.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
Example
Call SalTblQueryRowHeader ( tbl1, strTitle, 100, nWidth,
nFlags, colRowHeader )
SalTblQueryScroll
Syntax
bOk = SalTblQueryScroll ( hWndTbl, nPosition, nMinRange, nMaxRange )
Description
Returns a table window or grid's current scroll position and range.
The scroll position is the row number of the row that is currently at the top of the window. You set the table window or grid range with SalTblSetRange and SQLWindows changes it when you insert or delete rows from the table window or grid.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
nPosition Receive Number. The scroll position.
nMinRange Receive Number. The minimum table range.
nMaxRange Receive Number. The maximum table range.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
Example
Call SalTblQueryScroll ( hWndTbl, nPosRow, nMinRow, nMaxRow )
SalTblQuerySplitWindow
Syntax
bOk = SalTblQuerySplitWindow ( hWndTbl, nRowsLowerHalf,Syntax
bDragAdjust )
Description
Specifies how a table window or grid is split horizontally.
Parameters
hWndTbl Window Handle. The handle (or name) of a split table window or grid.
nRowLowerHalf Receive Number. The number of visible rows in the lower half of the split window. If zero (0), the table is not split.
bDragAdjust Receive Number Boolean. Specify whether (TRUE) or not (FALSE) the user can drag-adjust the visible rows in both halves of a split window.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
Example
Set bOk = SalTblQuerySplitWindow ( hWndTbl,
nRowsLowerHalf,Syntax,bDragAdjust )
SalTblQueryTableFlags
Syntax
bSet = SalTblQueryTableFlags ( hWndTbl, nFlags )
Description
Tests the state of a table window or grid's flags.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
nFlags Number. The table flags to test. You can combine
TBL_* flags using the OR (|) operator.
Return Value
bSet is TRUE if any of the flags indicated by nFlags are set and FALSE otherwise.
See Also
SalTblSetTableFlags
Example
If SalTblQueryTableFlags ( tbl1, TBL_Flag_MoveableCols )
Set rbColsMovable = TRUE
SalTblQueryVisibleRange
Syntax
bOk = SalTblQueryVisibleRange ( hWndTbl, nRangeMin, nRangeMax )
Description
Returns the current range of visible rows in a table window or grid.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
nRangeMin Receive Number. The first visible row.
nRangeMax Receive Number. The last visible row.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
Example
Set bOk = SalTblQueryVisibleRange ( hWndTbl, nRangeMin,
nRangeMax )
SalTblReset
Syntax
bOk = SalTblReset ( hWndTbl )
Description
Clears a table window or grid by discarding all rows from the table window or grid cache and setting the table range to 0, -1.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
See Also
SalTblSetRange
Example
If nRowCount > 0
Call SalTblReset ( hWndForm )
SalTblScroll
Syntax
bOk = SalTblScroll ( hWndTbl, nRow, hWndColumn, nTBLScroll )
Description
Scrolls a table window to the specified row and column.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window.
nRoWNumber The number of the row to scroll to. If you specify -1, only the column scrolls into view.
hWndColumn Window Handle. The table window column to scroll into view. If you specify hWndNULL, only the row scrolls into view.
nTBLScroll Number. The position of the scroll row. Specify one of these:
TBL_AutoScroll
TBL_ScrollBottom
TBL_ScrollTop
Return Value
bOk is TRUE if the function succeeds and FALSE if SQLWindows cannot scroll the row. This function fails if either nRow or nTBLScroll are invalid values.
See Also
SalTblQueryScroll
SalTblQueryVisibleRange
Example
Set bOk = SalTblScroll ( hWndTbl, nRow, hWndColumn,
nTBLScroll )
SalTblSetCellTextColor
Syntax
bOk = SalTblSetCellTextColor ( hWndCol, nColor, bDiscardable )
Description
Changes a table window or grid cell's text color.
Parameters
hWndCol Window Handle. The handle (or name) of a table window or grid column.
nColor Number. The cell text color. Specify one of the predefined windows colors.
bDiscardable Boolean. Determines whether SQLWindows discards the cell text color if and when the user re-fetches the row.
If TRUE, SQLWindows discards the cell text color when the user re-fetches the row. If FALSE, SQLWindows keeps the cell text color. This requires additional resources to keep the row in memory.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
Example
On SAM_FetchRow
Call SalTblSetCellTextColor ( Col1, COLOR_Red, TRUE )
Return TBL_RowFetched
SalTblSetColumnFlags
Syntax
bOk = SalTblSetColumnFlags ( hWndCol, nFlags, bSet )
Description
Sets or clears a table window or grid column's flags.
Parameters
hWndCol Window Handle. The handle (or name) of a table window or grid column.
nFlags Number. The column flags to change. You can combine COL_* flags using the OR (|) operator.
Note: Grid does not support the following column flags:
COL_IndicateOverflow
COL_Selected
bSet Boolean. If TRUE, SQLWindows sets the flags; if FALSE, SQLWindows clears the flags.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails. To define a column a column as multiline use the flag:
COL_MultilineCell = 0x00800000
See Also
SalTblQueryColumnFlags
Example
Call SalTblSetColumnFlags ( col1, COL_CenterJustify, TRUE )
SalTblSetColumnPos
Syntax
bOk = SalTblSetColumnPos ( hWndCol, nPos )
Description
Moves a table window or grid column to a new position.
Parameters
hWndCol Window Handle. The handle (or name) of a table window or grid column to move.
nPos Number. The new position of the table window or grid column. 1 is the first (left-most) position, 2 is the second position, and so on.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
See Also
SalTblQueryColumnPos
Example
Call SalTblSetColumnPos ( col3, nPos + 1 )
SalTblSetColumnText
Syntax
bOk = SalTblSetColumnText ( hWndTbl, nColumnID, strText )
Description
Assigns data to a column of a table window or grid's context row.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
nColumnID Number. The Column Identifiers
strText String. The data to assign.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
See Also
SalTblGetColumnText
Example
Set bOk = SalTblSetColumnText ( hWndTbl, nColumnID, strText )
SalTblSetColumnTitle
Syntax
bOk = SalTblSetColumnTitle ( hWndCol, strTitle )
Description
Sets the title of a table window or grid column.
Parameters
hWndCol Window Handle. The handle (or name) of a table window or grid column.
strTitle String. The title of the table window or grid column.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
See Also
SalTblGetColumnTitle
Example
Set bOk = SalTblSetColumnTitle ( hWndCol, strTitle )
SalTblSetColumnWidth
Syntax
bOk = SalTblSetColumnWidth ( hWndTbl, nFormUnits )
Description
Sets a table window or grid column's display width.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid column.
nFormUnits Number. The table window or grid column's display width in form units.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
See Also
SalTblQueryColumnWidth
Example
Set nColID = SalTblQueryColumnID ( hWndCol )
Call SalTblSetColumnWidth ( hWndCol, nWidths[ nColID ] )
SalTblSetContext
Syntax
bOk = SalTblSetContext ( hWndTbl, nRow )
Description
Sets a table window or grid's context row.
Setting the context row does not send a SAM_FetchRow message. If the row is not currently in memory, SQLWindows creates a new row in memory and sets its cell values to null.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid whose context row you want to set.
nRoNumber. The row number of the new context row.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
See Also
SalTblQueryContext
Example
Set bOk = SalTblSetContext ( hWndTbl, nRow
SalTblSetFlagsAnyRows
Syntax
bAny = SalTblSetFlagsAnyRows ( hWndTbl, nFlags, bSet,
nFlagsOn, nFlagsOff )
Description
Sets or clears row flags.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid whose row flags you want to set or clear.
nFlags Number. The flags to change. You can combine flag values using the OR (|) operator.
bSet Boolean. Whether to set (TRUE) or clear (FALSE) the specified flags.
nFlagsOn Number. The flags that the rows should have. You can combine flag values using the OR (|) operator.
Set nFlagsOn to zero (0) and nFlagsOff to zero (0) to specify all rows.
nFlagsOff Number. The flags that the rows should not have. You can combine flag values using the OR (|) operator.
Set nFlagsOn to zero (0) and nFlagsOff to zero (0) to specify all rows.
Return Value
bAny is TRUE if any of the table window or grid's rows have any of the nFlagsOn flags and none of the nFlagsOff flags.
See Also
SalTblFindNextRow
SalTblFindPrevRow
Example
Call SalTblSetFlagsAnyRows ( tblExample, ROW_MarkDeleted, TRUE,
ROW_Selected, 0 )
SalTblSetFocusCell
Syntax
bOk = SalTblSetFocusCell ( hWndTbl, nRow, hWndCol, nEditMin, nEditMax )
Description
Sets the focus to the specified table window or grid cell (row and column). SQLWindows puts the table window or grid into edit mode and lets the user select a portion of the data in the cell.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
nRowNumbe The row that receives the edit focus.
hWndCol Window Handle. The handle (or name) of the column that receives the edit focus.
nEditMin Number. The position of the left-most character. When used with nEditMax, this parameter lets the user select a portion of the cell text.
nEditMin must be less than or equal to nEditMax.
To select all the characters in a cell, specify zero (0) for this parameter and -1 for nEditMax.
nEditMax Number. The position of the right-most character. When used with nEditMin, this parameter lets the user select a portion of the cell text.
nEditMax must be greater than or equal to nEditMin.
To select all the characters in a cell, specify -1 for this parameter and zero (0) for nEditMin.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
See Also
SalTblQueryFocus
Example
Call SalTblSetFocusCell ( hWndForm, lParam,
hWndItem, 0, 1 )
SalTblSetFocusRow
Syntax
bOk = SalTblSetFocusRow ( hWndTbl, nRow )
Description
Sets a table window or grid's focus frame row.
With the grid the entire row is selected and with the table window the borders of the row are highlighted.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
nRoNumber. The row number of the row to which to apply the focus frame.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
See Also
SalTblQueryFocus
Example
Set bOk = SalTblSetFocusRow ( hWndTbl, nRow)
SalTblSetFromXMLSchema
Syntax
bOk = SalTblSetFromXMLSchema ( hWndTbl, sSchemaFile, sSchemaName )
Description
For an automatic-column table window or grid, this function resets the columns in the table to comply with the schema. For a static-column table window or grid, this function returns a Boolean value indicating whether the attributes in the schema are a match for the attributes of the table window or grid columns.
Parameters
hWndTbl Window Handle. The handle (or name) of the table window or grid to validate.
sSchemaFile String. The name of the XML schema file containing attributes to be used for validation.
sSchemaName String. The name of the schema within the schema file.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
 
See Also
SalTblPopulateFromXML
SalTblSetLinesPerRow
Syntax
bOk = SalTblSetLinesPerRow( hWndTbl, nLines )
Description
Sets the height of a row in lines. Multirow lines are useful when a column is defined as multiline. The text in each cell will wrap. To define a column a column as multiline use the function SalTblSetColumnFlags with the flag:
COL_MultilineCell = 0x00800000
Parameters
HWndTbl Window Handle. The handle (or name) of a table window or grid.
nLines Number. The number of lines.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
Example
Set bOk = SalTblSetLinesPerRow( hWndTbl, nLines )
SalTblSetLockedColumns
Syntax
bOk = SalTblSetLockedColumns ( hWndTbl, nLockedColumns )
Description
Sets the number of locked table window columns. table window columns that you lock do not scroll horizontally; they are fixed to the left side of the table window. All other columns appear to scroll under the locked columns. This function locks zero (0) or more of the left-most visible columns of a table window.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window.
nLockedColumns Number. The number of table window columns to lock.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
See Also
SalTblQueryLockedColumns
Example
Call SalTblSetLockedColumns ( tbl1, 2 )
SalTblSetRange
Syntax
bOk = SalTblSetRange ( hWndTbl, nMin, nMax )
Description
Defines the minimum and maximum rows (range) of a table.
Parameters
hWndTbl The handle (or name) of a table window or grid.
nMin Number. The lower boundary of the table window or grid.
nMax Number. The upper boundary of the table window or grid.
Setting nMin and nMax:
nMin must be less than or equal to nMax.
You can specify an empty table with the range 0, -1.
You can specify a dynamic range with the values zero (0), TBL_MaxRow. SQLWindows determines the higher boundary when the application returns TBL_NoMoreRows from a SAM_FetchRow message, or from the return of the SAM_FetchDone message.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
See Also
SalTblReset
Example
Call SalTblSetRange ( hWndForm, 0, nRowCount - 1 )
SalTblSetRow
Syntax
nRowNum = SalTblSetRow ( hWnd, nRowPos )
Description
Sets the focus to the first, last, next, or previous row in a table window or grid.
Parameters
tName Window Handle. The handle (or name) of the window whose current focus row you want to change.
nRowPos Number. The position of the focus row. Specify one of these values:
TBL_SetFirstRow
TBL_SetLastRow
TBL_SetNextRow
TBL_SetPrevRow
Return Value
nRowNum is the row number of the new focus row.
Example
Set = nRowNum = SalTblSetRow ( hWnd, nRowPos )
SalTblSetRowFlags
Syntax
bOk = SalTblSetRowFlags ( hWndTbl, nRow, nFlags, bSet )
Description
Sets or clears a table window or grid row's flags.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
nRoNumber. The row number of the row whose flags you want to set or clear.
nFlags Number. The row flags. You can combine any of the ROW_* flags using the OR (|) operator.
Grid supports all flags except ROW_Hidden
bSet Boolean. Whether to set (TRUE) or clear (FALSE) the specified flags.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
See Also
SalTblQueryRowFlags
SalTblSetFlagsAnyRows
Example
Call SalTblSetRowFlags ( hWndTbl, nRow, ROW_Selected, TRUE )
SalTblSetTableFlags
Syntax
bOk = SalTblSetTableFlags ( hWndTbl, nFlags, bSet )
Description
Sets or clears a table window or grid's flags.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
nFlags Number. The table flags. You can combine any of the TBL_* flags using the OR (|) operator.
The grid control only support the following flags:
TBL_Flag_GrayedHeaders
TBL_Flag_HScrollByCols
TBL_Flag_SizableCols
TBL_Flag_SuppressRowLines
bSet Boolean. Whether to set (TRUE) or clear (FALSE) the specified flags.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
See Also
SalTblQueryTableFlags
Example
Call SalTblSetTableFlags ( tbl1, TBL_Flag_MoveableCols, FALSE)
SalTblSortRows
Syntax
bRet = SalTblSortRows ( hWndTbl, nColumnID, nOrder )
Description
Sorts the rows of a non-discardable table window or grid based on the values in one of the table window or grid's columns. You must create this column at design time; it cannot be an automatic column such as a column created by SalTblPopulate. or SalTblCreateColumn.
Important: The table window or grid cache must not be discardable and the setting of maximum rows in memory must be large enough to hold the rows that you are sorting.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
nColumnID Number. The Column Identifier of the column by which to sort.
nOrder Number. The direction of the sort. Specify either:
TBL_SortDecreasing
TBL_SortIncreasing
Return Value
bRet is TRUE if the function succeeds and FALSE if nColumnID is not a valid identifier.
Example
Set bRet = SalTblSortRows ( hWndTbl, nColumnID, nOrder )
SalTblWriteXMLAndSchema
Syntax
bOk = SalTblWriteXMLandSchema ( hWndTbl, sPath, bFrontEnd, nWriteTypes )
Description
Writes the contents and properties of a table window or grid to an XML file and/or a schema file.
Note that if the table window or grid contains a column with datatype Date/Time, and a cell in that column is empty, then no content will be written for that particular XML document node. Validating XML parsers will flag this situation as an invalid value.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
sPath String. The path and name of the output file. Note that the schema file will have the same name, plus the suffix _SCHEMA.
bFrontEnd Boolean. If TRUE, the schema will be based on the table window or grid properties. If FALSE, the schema will be based on the column information returned by a database cursor (as in a call to SalTblPopulate.) In the latter case, all datatypes will be strings.
nWriteTypes Number. One of the XML constants, determining whether to write XML, schema, or both.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
Example
SalTblWriteXMLandSchema (tblOrders, “c:\\My Documents\ORDERS”, TRUE, XML_DocAndSchema)
See Also
SalTblWriteXMLandSchemaEx
SalTblWriteXMLAndSchemaEx
Syntax
bOk = SalTblWriteXMLandSchemaEx ( hWndTbl, sPath, bFrontEnd, nWriteTypes, nFlagsOn, nFlagsOff )
Description
Writes the contents and properties of a table window or grid to an XML file and/or a schema file. Only rows that match the selection criteria in nFlagsOn and nFlagsOff will be written.
Note that if the table window or grid contains a column with datatype Date/Time, and a cell in that column is empty, then no content will be written for that particular XML document node. Validating XML parsers will flag this situation as an invalid value.
Parameters
hWndTbl Window Handle. The handle (or name) of a table window or grid.
sPath String. The path and name of the output file. Note that the schema file will have the same name, plus the suffix _SCHEMA.
bFrontEnd Boolean. If TRUE, the schema will be based on the table window or grid properties. If FALSE, the schema will be based on the column information returned by a database cursor (as in a call to SalTblPopulate.)
nWriteTypes Number. One of the XML constants, determining whether to write XML, schema, or both.
nFlagsOn Number. A combination of one or more of the row flags. Rows must have these flags on in order to be part of the output to XML.
nFlagsOff Number. A combinaion of one or more of the row flags. Rows must have these flags off in order to be part of the output to XML. Specify 0 to use no flags in this parameter.
Return Value
bOk is TRUE if the function succeeds and FALSE if it fails.
Example
In this example, only rows that have been edited, but not marked for deletion, are output to files.
SalTblWriteXMLandSchema (tblOrders, “c:\\My Documents\ORDERS”, TRUE, XML_DocAndSchema, ROW_Edited, ROW_MarkDeleted)

GUPTA Technologies