Right Click - Context menus (OpenInsight 32-Bit)
At 13 MAR 2009 03:44:01AM Colin Rule wrote:
I have set up some right-click context menus on edit tables.
Generally when using windows, the right-click selects the current row and then, actions on this row. For example, in Windows Explorer.
In the OI Edit tables, if you have a row highlighted, and then right-click on another row, and select a context option, say properties (where I pick up the selpos property), this applies to the currently selected row, and not the row which you right-clicked on.
Is there any way of making the right-click perform a poschanged before actioning the right click, or some other way of doing the same?
Thanks
Colin
At 13 MAR 2009 09:47AM Sean FitzSimons wrote:
Colin,
That is a limitation with the ContextMenus at the moment. The right click is not causing FOCUS or POSCHANGED events, you need to click twice, once on the left and then on the right. This has been reported in the Issue Tracker and is queue for a fix.
Thanks,
Sean
At 14 MAR 2009 03:06AM Anders Lindholt wrote:
Dear Colin,
Could you pass me some further details how to set up a right-click context menus on edit tables ?
evt. at my hotmailadress: [email protected]
Thank's
Anders
At 15 MAR 2009 06:45PM Colin Rule wrote:
Anders
I have Emailed.
Colin
At 15 MAR 2009 06:51PM Colin Rule wrote:
Sean, thanks, it will be much better when this is in place.
Imagine our embarrassment when in user training, we have to tell users they have to click, then right click to do some function.
The users go 'whoa, what rubbish' and we have to divert the issue to the fact that we will be looking at this in the future, and then move on quickly to other things.
If the ContextMenu program was made available as source, is there a possibility that we could get the current entity and set the position somehow, ie anything to trap the xy position, and deal with ourselves? As I say, if the program was made available… hint hint.
Colin
At 16 MAR 2009 01:56PM Jim Vaughan wrote:
I don't know if this helps but …
This code should give the row number that you right clicked on. I just quickly pulled this out of a bunch of other code, so me not be perfect. Code is held in WINMSG event.
Y_Pos_Of_Table=Get_Property(CtrlEntId, "Size"[/color])2] [/color]X_Pos=Bitand(lparam,[/color]65535[/color]) Y_Pos=((Lparam - X_Pos)/[/color]65536 [/color]) + Y_Pos_Of_Table Dot.pos=Index(CtrlEntId,[/color]"."[/color],[/color]1[/color]) Win=CtrlEntId[/color]1[/color],dot.pos-[/color]1[/color] [/color] [/color]Call [/color]Get_Table_Info(CtrlEntId, Row_Height, Heading_Height) Sizetable=Get_Property(CtrlEntId, [/color]"SIZE"[/color]) RowNumber=(Y_Pos - Heading_Height - Sizetable1][/color])/ Row_Height RowNumber=Int(RowNumber + .999999999) [/color] [/color]Subroutine [/color]Get_Table_Info(Obj, Row_Height, Heading_Height) [/color]Declare Function [/color]Sendmessage, Get_Property [/color] [/color]Equ [/color]Dtm_Getdtmetrics$ [/color]To [/color]1120 [/color]Equ [/color]Dt_Rowheight$ [/color]To [/color]1 [/color]Equ [/color]Dt_Rowwidth$ [/color]To [/color]2 [/color]Equ [/color]Dt_Headinght$ [/color]To [/color]3 [/color]Equ [/color]Dt_Labelwidth$ [/color]To [/color]4 [/color] [/color]Row_Height=[/color]0 [/color]Heading_Height=[/color]0 [/color]Obj_Handle=Get_Property(Obj, [/color]"Handle"[/color]) Row_Height=Sendmessage(Obj_Handle, Dtm_Ge tdtmetrics$, Dt_Rowheight$, [/color]0[/color]) Heading_Height=Sendmessage(obj_Handle, Dtm_Getdtmetrics$, Dt_Headinght$, [/color]0[/color]) [/color]Return[/color][/color][/size]
At 16 MAR 2009 09:04PM Colin Rule wrote:
Jim
Thanks, helps a great deal.
I got the code to run, the calculations dotn quite seem right and the Obj handle returns null, but I should be able to trace this through and find out why, and get working.
Colin
At 16 MAR 2009 09:31PM Colin Rule wrote:
Jim
I realised part of the problem is the failure of the lower case property names 'Handle' and 'Size', I uppercased these and get some results now, although the calculation seems wrong still, I have at least something to work with.
Colin
At 17 MAR 2009 12:00AM Colin Rule wrote:
Jim,
Made a few amendments and now have it working well.
Thanks very much.
I have also included code to accumulate the column widths of each column in the table, calculate the X offset, and locate the cell in this which is used to set the col position as well, so the code selects the exact column and row.
Hopefully Revelation will put this in to a future release.
Colin
At 17 MAR 2009 06:33PM [email protected] wrote:
Folks,
Check out the POS_BY_CURSOR message that was added in OI 8 IIRC - this will tell you exactly what cell you're over from screen coordinates using the EditTable's internal calculations.
There's also the undocced POS_BY_CLIENT_CURSOR message which is the same but using client cooordinates rather than screen coordinates.
Battlestar Sprezzatura - BSG 77
Colonial leaders in all things RevSoft
<img src=http://www.sprezzatura.com/zz.gif"
At 17 MAR 2009 06:34PM Jim Vaughan wrote:
Well that makes it a tad easier!
At 17 MAR 2009 07:49PM [email protected] wrote:
Hi Jim,
I added it with all that drag and drop work :)
Battlestar Sprezzatura - BSG 77
Colonial leaders in all things RevSoft
At 17 MAR 2009 11:21PM Colin Rule wrote:
Great stuff, thats much easier, handles row markers being on/off and visible/invisible headers.
This is my WINMSG now, nice and simple, in case anyone needs it in the future.
* Right Click Set position
CellPos=Send_Message(CtrlEntId,"POS_BY_CURSOR","","")Call Set_Property(CtrlEntId,"SELPOS",CellPos)RETURN 1