STYLE_BY_POS to protect cell (OpenInsight 32-bit)
At 18 MAR 2021 07:56:38AM Nick Stevenson wrote:
Hi
OI 9.4
I'm trying to use the STYLE_BY_POS message to conditionally protect a cell in an edit table. Following the reference manual, but the message doesn't have any effect.
Protect the cell at Column 1, Row 2 origColStyle = Send_Message( EditTable, "STYLE_BY_POS", 1, 2 ) newColStyle = bitor( origColStyle, DTCS_PROTECT$ ) ColStyle = Send_Message( EditTable, "STYLE_BY_POS", 1, 2, newColStyle ) The COLSTYLE message works fine, but that addresses an entire column. Thanks </QUOTE> —- === At 18 MAR 2021 08:37AM Carl Pates wrote: === <QUOTE>Hi Nick, Try setting the DTCS_EDIT$ style as well - the control doesn't seem to respond to protected unless Edit is set… <code> cellStyle = send_Message( @window : ".TABLE_1", "STYLE_BY_POS", 2, 1 ) cellStyle = bitOr( cellStyle, DTCS_PROTECT$ ) cellStyle = bitOr( cellStyle, DTCS_EDIT$ ) call send_Message( @window : ".TABLE_1", "STYLE_BY_POS", 2, 1, cellStyle ) </code> Carl Pates </QUOTE> —- === At 18 MAR 2021 09:50AM Nick Stevenson wrote: === <QUOTE>Hi Carl I can get it to work on a new, simple, form. No problem. It just won't work on an existing form. It does, however, work when I leave the ROW parameter as 0 - which means the entire column is protected. I have tried the code on the CREATE event of the form as well as where I want it, on the POSCHANGED event of the edit table. It simply ignores the message, even though I know it is stepping through it. ODD! </QUOTE> —- === At 23 MAR 2021 10:08AM Carl Pates wrote: === <QUOTE>Hi Nick, What happens if you use the column style as the base? <code> cellStyle = send_Message( @window : ".TABLE_1", "COLSTYLE", 2 ) cellStyle = bitOr( cellStyle, DTCS_PROTECT$ ) cellStyle = bitOr( cellStyle, DTCS_EDIT$ ) call send_Message( @window : ".TABLE_1", "STYLE_BY_POS", 2, 1, cellStyle ) </code> Carl Pates </QUOTE> View this thread on the Works forum...