Form Default Button to run a macro

Creating and using forms
Post Reply
TrevorT
Posts: 7
Joined: Sun Oct 04, 2015 6:49 am
Location: Australia

Form Default Button to run a macro

Post by TrevorT »

I have a form that consists of several text boxes for entering data. The form also contains a button to run a macro which processes & checks the text box entries, and ultimately saves the data.
I would like that button to work as the form default button so that I can press Return in any of the fields, and have the macro run. Just setting the "Default Button" property to "Yes" doesn't do the job, and there does not seem to be an appropriate option under the "Action" property.
How is this usually achieved? It seems that I am missing something simple.
Thanks,
Trevor
OpenOffice 4.1.1 on Mac OSX 10.10 and WindowsXP
F3K Total
Volunteer
Posts: 1038
Joined: Fri Dec 16, 2011 8:20 pm

Re: Form Default Button to run a macro

Post by F3K Total »

Hello,
as the enter key has many other jobs, i would create a key combination to start the macro.
R
  • MMove 1.0.6
  • Extension for easy, exact positioning of shapes, pictures, controls, frames ...
  • my current system
  • Windows 10 AOO, LOLinux Mint AOO, LO
TrevorT
Posts: 7
Joined: Sun Oct 04, 2015 6:49 am
Location: Australia

Re: Form Default Button to run a macro

Post by TrevorT »

Thanks for that suggestion. A key combination could do it.
I was thinking that it could also be done by using a key listener to trap the Return key and run the macro behind the button. I didn't want to head off down that track if there was a simple inherent way of doing it - hence the posted question.
In this particular form, the return key serves no special function, so trapping it won't cause a problem that I can see.
Not all of the text boxes need to have data placed in them, so the form data entry process could then become - Data in field1 - Tab - data in field2 - Tab- data in field3 - Return (to skip the remaining fields and run the macro).
I think perhaps that the listener would provide a more user friendly interface - needs only two keys (Tab & Return/Enter - no mouse) to navigate the data entry process.
Thank you for that suggestion. I will keep it in mind.
Trevor
OpenOffice 4.1.1 on Mac OSX 10.10 and WindowsXP
Post Reply