| View previous topic :: View next topic |
| Author |
Message |
cazbym Power User

Joined: 16 Mar 2009 Posts: 63
|
Posted: Sat Apr 28, 2012 9:26 am Post subject: [SOLVED] Mouse Event on Base Form Table Control Query |
|
|
Have only just begun to delve into macros, so a definite novice here. But I have a nice double click macro working to filter a form and open a subform, which I am pleased as punch with. This has been assigned to the column control of a form table control on mouse pressed event.
However, when I try to run the exact same code on a TableControl based on a query from joined tables nothing happens - nothing at all - it doesn't even bring up an error in the code.
I have played around with the oEvt.source.model.parent / oEvt.source.parent but I don't think this is the problem as I can alter the TableControl properties and change it to just one of the tables involved in the query, (this obviously means some columns are blank), but then the code works fine. Is it not possible to use a mouse event on a non-editable TableControl? If this is the case, is there any other answer to my problem, apart from a subform based solely on one table, which sort of defeats the object of the clutter caused by subforms. _________________ OpenOffice 3.3
Windows 7
HSQL 2.1 file mode
JRE 1.6.0 30
Last edited by cazbym on Sun Apr 29, 2012 12:13 am; edited 1 time in total |
|
| Back to top |
|
 |
RPG Super User

Joined: 24 Apr 2008 Posts: 2696 Location: Apeldoorn, Netherland
|
Posted: Sat Apr 28, 2012 3:25 pm Post subject: |
|
|
Hello
Your question is not real clear for me but maybe this can help you?
Some events are bound to the gridcontrol and other events are bound to the controls in the gridcontrol.
You can test it with beep.
The events in the gridcontrol can change from version to version. The reason is they working on the events of a grid.
http://user.services.openoffice.org/en/forum/viewtopic.php?f=39&t=24013&p=109535&hilit=grid+control#p109535
When you have the event then you must find which column you need. The CurrentColumnPosition is a property of the view of the gridcontrol. Then with this number you can get the control in the grid with the property getbyindex. This means you have to learn the difference between the view of the control and the model of the same control
Romke
| Code: | Sub findControlingrid(oEvent as object)
dim oGridview
dim oColumninGrid
oGrid=oEvent.source
oColumninGrid=oGrid.model.getbyindex(oGrid.CurrentColumnPosition)
print oColumninGrid.name
End Sub |
_________________ OOo 3.4.5 on openSUSE 12.1
Use this forum : http://user.services.openoffice.org/en/forum |
|
| Back to top |
|
 |
cazbym Power User

Joined: 16 Mar 2009 Posts: 63
|
Posted: Sun Apr 29, 2012 12:13 am Post subject: |
|
|
Hi RPG - now have code working properly.
With the original macro I had it assigned to the Column Mouse Pressed Event which I mistakenly thought I needed as I was pulling the data from a particular Column, but have now changed to the TableControl Mouse Pressed Event, .
This has given me a brilliant lesson in identifying Columns - thank you.  |
|
| Back to top |
|
 |
|