POSCHANGED before CLICK???? (OpenInsight 32-Bit)
At 15 JUN 2011 01:13:53PM Sonny Patterson wrote:
When I click on a cell, POSCHANGED fires and CLICK doesn't, which seems wrong to me. It seems like CLICK should fire then POSCHANGED. But never mind that.
What I'm trying to do is have a column in an edit table with checkboxes, but I never want the caret in that column. Rather, I want it to move to the next column. However, I want to be able to click on the check box. It seems I can't have my cake and eat it too, as setting "Skipped" on the column makes it unclickable.
So I'm answering my own question here (maybe; I haven't tried it yet), but capturing the mouse event using the Windows API (per a Sprezzatura blog post I read) seems like what I need. Any thoughts?
At 15 JUN 2011 03:01PM Ray Chan wrote:
Hi Sonny,
Have you looked at the SRP EditTable? I think it could work for you. Here's a simple Example with a checkbox.
If you have any questions, contact Don Bakke.
HTH,
Ray Chan
At 16 JUN 2011 09:58AM cpates@sprezzatura.com wrote:
Hi Sonny,
Yes it's possible to do it with a bit of WINMSG processing - here's a simple example that works from the button-up messageā¦
In the CREATE event of your window qualify the ETM_LBUTTONUP$ message like so:
0001 $insert winAPI_EditTable_Equates 0002 $insert logical 0003 0004 call send_Message( @window : ".TABLE_1", | 0005 "QUALIFY_EVENT", | 0006 ETM_LBUTTONUP$, | 0007 TRUE$ )(The winAPI_EditTable_Equates record can be downloaded from our website - it's part of the WinAPI library we mentioned on the blog. It defines the style and message constants for the EditTable)
You can then use the POSCHANGED event to ensure that the user always skips the checkbox cells by altering the CARETPOS property.
In the WINMSG event of the EditTable you need to trap the ETM_BUTTONUP message and check the passed mouse coordinates to see if they are over a checkbox control, and if so you can set the check yourself, e.g:
$insert winAPI_EditTable_Equates $insert logical begin case case ( message == ETM_LBUTTONUP$ ) xPos = bitAnd( lParam, 0x00FF ) yPos = bitShr( lParam, 16 ) cellPos = send_Message( @window : ".TABLE_1", | "POS_BY_CLIENT_CURSOR", | xPos, | yPos ) colPos = cellPos<1> rowPos = cellPos<2> if ( colPos == 2 ) and rowPos then cellChk = send_message( @window : ".TABLE_1", | "TEXT_BY_POS", | colPos, | rowPos ) cellChk = not( cellChk ) call send_message( @window : ".TABLE_1", | |"TEXT_BY_POS", | colPos, | rowPos, | cellChk ) end end caseThat's it in a nutshell - you can obviously tighten this code up but hopefully you get the idea!
cpates@sprezzatura.com
Battlestar Sprezzatura - BSG 77
Colonial leaders in all things RevSoft
At 16 JUN 2011 06:50PM Sonny Patterson wrote:
Did I mention you are awesome?