guides:programming:programmers_reference_manual:color_by_pos_message

COLOR_BY_POS message

Set the background color, foreground color, selected background color, and/or selected foreground color, for a specified cell in an edit table.

Edit table.

text = Send_Message(controlID, "COLOR_BY_POS", column, row, color_array)

For COLOR_BY_POS, the Send_Message function has the following parameters.

ParameterDescription
column, rowWhen column and row are both positive, applies the color to the cell; when column is positive and row is 0, applies the color to the entire column; when column is 0 and row is positive applies the color to the entire row.
color_arrayA field mark delimited array for setting the background color, foreground color, background color if selected, and foreground color if selected. The colors are set as follows:

1 - Background color value
2 - Foreground color value
3 - Background color value, if the cell is selected
4 - Foreground color value, if the cell is selected

Note: When setting the color for column and row headings the text color is set. An array is not used to set the color in a column or row header. To set the color in a column or row heading just a single value is passed.

/* Set background color to yellow, foreground color to black, background color if cell is selected to green, and foreground color if cell is selected to red */

 

$insert [[colors|colors]]

 

Declare function Send_Message

Back_color = YELLOW$

Fore_color =  BLACK$

Back_sel_color = GREEN$

Fore_sel_color = RED$

 

/* Set row 1, column 2 to desired color scheme */

rv = Send_Message(@Window:".TABLE_1", "COLOR_BY_POS", 2, 1, Back_color:@FM:Fore_color:@FM:Back_sel_color:@FM:Fore_sel_color)

 

/* Set all cells in column 2 to desired color scheme */

rv = Send_Message(@Window:".TABLE_1", "COLOR_BY_POS", 2, 0, Back_color:@FM:Fore_color:@FM:Back_sel_color:@FM:Fore_sel_color)

 

/*  Set all cells in row 7 to desired color scheme */

rv = Send_Message(@Window:".TABLE_1", "COLOR_BY_POS", 0, 7, Back_color:@FM:Fore_color:@FM:Back_sel_color:@FM:Fore_sel_color)

 

/* Set the color of the text for the first column header */

hdr_color = RED$

rv = Send_Message(@window:".TABLE_1","COLOR_BY_POS",1,-1,hdr_color)

 

/* Set the color of the text for the third row header */

hdr_color = GREEN$

rv = Send_Message(@window:".TABLE_1","COLOR_BY_POS",-1,3,hdr_color)
  • guides/programming/programmers_reference_manual/color_by_pos_message.txt
  • Last modified: 2024/06/19 20:20
  • by 127.0.0.1