Re: [dba-dev] Form Tablecontrol event: how to obtain column, row and other information

2009-03-03 Thread Frank Schönheit - Sun Microsystems Germany
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



Re: [dba-dev] Form Tablecontrol event: how to obtain column, row and other information

2009-02-26 Thread Fernand Vanrie

Karl Weber wrote:

Hi,

I hope, this is the proper list. 
  

we have the same problem and developed kind of a work around

- we know  when a   row  or a column  is selected   if  
ubound(eventt.source.selection) = 0


- we uses the right cursor click  for avoiding accidental clicks (when 
selecting a row)eventt.buttons = 2


- if you are courragious :-) then you can put a listener on the mouse 
itself and via the mouse postion find out with column is needed. We did 
this sucesfull in the past with OO-dialogs, but i am not sure if this 
will work in Forms


Hope it helps

Fernand
I have a tablecontrol in a form and I can assign macros/scripts to various 
events. I already noticed, that one can also assign macros to events of 
columns, but this doesn't seem to work. (OOo 3.0) There should be an open 
issue about this problem.


So for the moment I have to live with events -- e.g. mouse pressed -- fired 
from the tablecontrol as a whole. 

When this event is fired, I need to know a couple of things I don't know how 
to find out. Maybe someone can help me:


(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?

(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?


Lot's of questions, but any help is very wellcome! (Pointers to documentation 
may suffice, if there is any. I didn't find any help in the DevGuide. )


Thanks in advance,

-Karl

-
To unsubscribe, e-mail: dev-unsubscr...@dba.openoffice.org
For additional commands, e-mail: dev-h...@dba.openoffice.org
  



-
To unsubscribe, e-mail: dev-unsubscr...@dba.openoffice.org
For additional commands, e-mail: dev-h...@dba.openoffice.org