Hi Karl, > (1) Was the mouse pressed in a particular cell, and if so, which one? > > (2) Was the mouse pressed on a column header, and if so, which column? > > (3) Was the mouse pressed on a row marker, and if so, which row? > > (4) Was the mouse pressed outside of header, row markers and cells? > > (5) How can I find out, which rows are selected, if any?
In general, the current column position can be obtained via http://api.openoffice.org/docs/common/ref/com/sun/star/form/XGrid.html#getCurrentColumnPosition (at the Source member of the event you got). I am not sure, however, whether this is updated *before* or *after* your listener is called, i.e. if it still returns the old column. The selection, as said by Fernand, can be obtained using the getSelection method (or the Selection property, which is the same in Basic). The current row cannot be obtained, though perhaps implicitly be determined by the current row of the form. Probably the safest way for the concrete row would be taking the pixel position of the mouse, and calculating the affected cell, taking into account the header and row height. However, this probably requires translating the heights from logical units into pixels, which requires the XUnitConversion interface, which is available in 3.1 only. This approach might even work for the concrete column, by calculating with the column widths. However, I am not sure at the moment the width of the row header is available at the grid control model ... All in all, there's pretty much uncertainty in here, so I think fixing the issue with the grid column events might be ... safer. Though, column-related events won't solve the problem of obtaining the current row ... > (6) When I press the right mouse button in a cell or on a column header, a > pop-up menu appears. Can I add my own menu items to these menus, and if so, > how? No, that's not possible. Ciao Frank -- - Frank Schönheit, Software Engineer frank.schoenh...@sun.com - - Sun Microsystems http://www.sun.com/staroffice - - OpenOffice.org Base http://dba.openoffice.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@dba.openoffice.org For additional commands, e-mail: dev-h...@dba.openoffice.org