====== COLSTYLE message ======
==== Description ====
Set or retrieve styles of one or more columns in an edit table control.
==== Applies To ====
Edit table.
==== Syntax ====
//styles// = **Send_Message**(//controlID//, "**COLSTYLE**", //columnno//, //newstyle//)
==== Parameters ====
Parameters are as follows.
^Parameter^Description^
|//Columnno//|Column position, beginning from 1. Use 0 to specify all columns.|
|//Newstyle//|If //columnno// > 0, //newstyle// indicates the style for the column. If //columnno// is 0, passes an @FM-delimited array of styles to replace existing styles for each column in the edit table. Pass null to leave style intact.|
^Column Style^Value^
|Resizeable|1|
|Fixed|2|
|Editable|4|
|Protected|8|
|Uppercase|20|
|Hidden|32|
|Left Just|0 (default)|
|Center Just|64|
|Right Just|128|
|Heading Left|0 (default)|
|Heading Center|256|
|Heading Right|512|
|Skipped|4100|
|Locked|8192|
|Sort Asc|16384|
|Sort Desc|32768|
|Checkbox|65536|
|Dropdown|131072|
|Multi-line header (See Example 5)|262144|
|Right-aligned checkboxes|524288|
|Enable drag (See Example 4)|0x10000000|
|Enable drop (See Example 4)|0x20000000|
==== Return value ====
Style for the specified column(s) (if multiple columns, in an @FM-delimited array).
==== See Also ====
[[style_style_ex|STYLE property]], [[bit_wise_operators_bitand_bitor_bitxor_bitnot|Bit-wise operators]], [[edit_table_column_styles|Edit Table Column Styles]], [[autosizecol|AUTOSIZECOL property]], [[coldata|COLDATA property]], [[collabel_message|COLLABEL message]], [[colwidth_message|COLWIDTH message]], [[psstyle|PSStyle property]], [[colstyle_message|COLSTYLE message]], [[iconv_mx_hex_mo_mb|IConv( expression, "MX")]], [[oconv_mx_hex_mo_mb|OConv( expression, "MX")]], [[rti_style_equates_$insert_record|RTI_Style_Equates]]
==== Example ====
declare subroutine LockColumns(Table, Lock)
/* This function horizontally locks the specified
* number of edit-table columns
Parameters:
Table - [in] id of edit table control
Lock - [in] number of columns to lock */
declare function Send_Message
declare subroutine Send_Message
equ LOCK_STYLE$ to 8192
ColCount = Get_Property(Table, "LIMIT") <1>
Styles = Send_Message(Table, "COLSTYLE", 0, "")
for i = 1 to ColCount
if i <= Lock then
Styles = bitor(Styles, LOCK_STYLE$)
end else
Styles = bitand(Styles, bitnot(LOCK_STYLE$))
end
next i
Send_Message(Table, "COLSTYLE", 0, Styles)
return
Example 2
* Create a dropdown in column 1
Declare function Send_Message
EditTable = @Window:".TABLE_1"
// Column 1 is the column being set up as a drop down.
// Flag the column as a drop down column.
ColStyle = Send_Message(EditTable, "COLSTYLE", 1)
ColStyle = bitor(ColStyle, 0x20000)
ColStyle = Send_Message(EditTable, "COLSTYLE", 1, ColStyle)
// Establish the list of values in the drop down.
ColFormat = Send_Message(EditTable, "COLFORMAT", 1, "Item One":@VM:"Item Two":@VM:"Item Three")
Example 3
* Create a checkbox in column 2
Declare function Send_Message
EditTable = @Window:".TABLE_1"
// This establishes the check box style for column two.
ColStyle = Send_Message(EditTable, "COLSTYLE", 2)
Colstyle = 65536
ColStyle = Send_Message(EditTable, "COLSTYLE", 2, ColStyle)
// This establishes the check box text for column two.
ColFormat = Send_Message(EditTable, "COLFORMAT", 2, "Check this box")
Example 4
* Add Drag and Drop to Columns within an Edittable
EditTable = @Window:".TABLE_1"
* Enable drag and drop to Column 1
ColStyle = Send_Message(EditTable, "COLSTYLE", 1)
ColStyle = bitor(ColStyle, 0x10000000) ; * enabledrag
ColStyle = bitor(ColStyle, 0x20000000) ; * enabledrop
ColStyle = Send_Message(EditTable, "COLSTYLE", 1, ColStyle)
* Enable drag and drop to Column 2
ColStyle = Send_Message(EditTable, "COLSTYLE", 2)
ColStyle = bitor(ColStyle, 0x10000000) ; * enabledrag
ColStyle = bitor(ColStyle, 0x20000000) ; * enabledrop
ColStyle = Send_Message(EditTable, "COLSTYLE", 2, ColStyle)
Example 5
* Multi-line column headings
* Change the Column Headers to multi-line and place data within the header
tableCtrl = @window:".TEST_TABLE"
* Set the column header for column 1 to multi-line
ColStyle = Send_Message(tableCtrl, "COLSTYLE", 1)
ColStyle = bitor(colstyle,262144)
ColStyle = Send_Message(tableCtrl, "COLSTYLE", 1, ColStyle)
* Set the column header for column 2 to multi-line
ColStyle = Send_Message(tableCtrl, "COLSTYLE", 2)
ColStyle = bitor(colstyle,262144)
ColStyle = Send_Message(tableCtrl, "COLSTYLE", 2, ColStyle)
* Set the height of the column headers for the edittable
x = set_property(tableCtrl,'HEADERHEIGHT',60)
* Set the header text
headerText<1> = "This line will wrap within the header."
headerText<2> = "This line contains":char(13): "carriage returns."
x = Set_Property(tableCtrl,"LABEL",headerText)