Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
COLSTYLE message (Checkbox column style)
in OpenInsight
I have code that uses the COLSTYLE message to change the style of the first column of an OI edit-table to a checkbox for each cell:
EditTable = @Window:".EDT_PRINT_FAX"
ColStyle1 = Send_Message(EditTable, "COLSTYLE", 1)
ColStyle1 = bitor(ColStyle1, 0x10000)
ColStyle1 = Send_Message(EditTable, "COLSTYLE", 1, ColStyle1)
If the cell has not before been ticked, I need two single mouse-clicks to tick the box:
one click to highlight the cell;
a second click to produce a tick in the cell's checkbox.
Subsequently the same cell can be unticked and ticked with one mouse-click.
Has anyone found a workaround to avoid two initial single-clicks to produce a tick?
EditTable = @Window:".EDT_PRINT_FAX"
ColStyle1 = Send_Message(EditTable, "COLSTYLE", 1)
ColStyle1 = bitor(ColStyle1, 0x10000)
ColStyle1 = Send_Message(EditTable, "COLSTYLE", 1, ColStyle1)
If the cell has not before been ticked, I need two single mouse-clicks to tick the box:
one click to highlight the cell;
a second click to produce a tick in the cell's checkbox.
Subsequently the same cell can be unticked and ticked with one mouse-click.
Has anyone found a workaround to avoid two initial single-clicks to produce a tick?
Comments
P.S. I highly recommend you add the RTI_Style_Equates insert into your code so you can use DTCS_CHECKBOX$ instead of 0x100000 when working with styles. It will make your code much easier to read.
Thanks for the insert advice. I will add it to this old code.
There is code to tick every cell in the column as the default when starting the window, courtesy of a "select all" checkbox outside the table. With every cell initially ticked, one click suffices to toggle the tick. But by unticking this "select all" checkbox to untick every cell in the column, I am back to needing two clicks to initially produce a tick in a cell.
When I was at first trying to fix this, I added code in a CLICK event subroutine for this edit-table (CLICK.EDT_PRINT_EMAIL) to toggle the tick. But, using the debugger, the tick toggled in the window before the CLICK event code was reached. I cannot find the code that does this, and a colleague thinks that it is tied up with the COLSTYLE message that I posted earlier.
(By the way, ".EDT_PRINT_FAX" in my first post should have read ".EDT_PRINT_EMAIL".)
If I place debugs everywhere I can think of (excluding the WINMSG and MOUSEOVER events), the tick still toggles on returning from PROMOTED_EVENTS, but now stopping at the beginning of the ..._EVENTS stored procedure for this window, again before the the runtime program reaches the CLICK event handler.
This next question may reveal my unfamiliarity with the windowing world, but is it at all possible that the COLSTYLE message code in my first post could be solely responsible, both for the tick toggling before the CLICK event handler and for the initial single click on an unticked box failing to fill the box? Or will it always have to be some event that is triggered, for which I have not found the code?
What event handler is calling Send_Message to set COLSTYLE?
I have tried removing the COLSTYLE code. The column then populates with ones and zeros rather than ticks and no ticks. In that case I don't need to click twice to toggle a cell.
I think I understand your question but I'm not 100% sure how to answer it. I do not think the checkbox has its own event handler, if that helps. I'm still inclined to believe you have related event handlers that are interfering with normal behavior. The only way to know for certain is to remove all event handlers. That may prove to be difficult. At the very least, open up another application (like EXAMPLES) where there are no promoted events, and create a simple form with an edit table control and create a column with checkboxes. See if you can tick the checkbox in one click or two clicks.