OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

[SOLVED] Mouse Event on Base Form Table Control Query

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
cazbym
Power User
Power User


Joined: 16 Mar 2009
Posts: 63

PostPosted: Sat Apr 28, 2012 9:26 am    Post subject: [SOLVED] Mouse Event on Base Form Table Control Query Reply with quote

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
View user's profile Send private message
RPG
Super User
Super User


Joined: 24 Apr 2008
Posts: 2696
Location: Apeldoorn, Netherland

PostPosted: Sat Apr 28, 2012 3:25 pm    Post subject: Reply with quote

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
View user's profile Send private message
cazbym
Power User
Power User


Joined: 16 Mar 2009
Posts: 63

PostPosted: Sun Apr 29, 2012 12:13 am    Post subject: Reply with quote

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. Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group