Is there a function in LO Basic that returns the name of the form control that has focus?

I need to assign the name of the form control that has focus (in this instance one of several text boxes) to a variable in a LO basic macro. Is anyohe aware of a function that accomplishes this? I’ve been looking for a few hours with no luck.

More specifically, the macro is being designed to be triggered by an image button elsewhere on the form upon a mouse click. I’m attempting to design the macro so it will insert a text string into the textbox that has focus at the time the image button is clicked. The target textbox will have focus due to the user having just added text via the keyboard with the cursor still residing in the textbox at the time the image button is clicked. If there is a function that will return the name of the form control that has focus at the time the function is called (something like “getByFocus()”) it would make my life a lot easier. So far, my searching has not turned up such an animal. The closest thing I’ve found thus far is “getCurrentController()”

Thanks in advance.

Once the image has been clicked, the textbox focus is lost. The image button now has focus. You may want to consider macros tied to the textbox event ‘When losing focus’. The macro could set a unique id to be read by the macro called by the image click. That id could then tell you where to send your result.

lol…that was a bonehead move on my part. I didn’t think about the fact that the focus switched to the image button upon clicking it. I think I’ve been at this too long. Thanks for the tip, ratslinger. Time to do something else…

I did find a way around the push button taking focus from the textbox. Under the form control properties for a push button, under the “general” tab there is an option “take focus on click”. If this option is set to “no”, then the textbox that was last selected by the user should retain focus. It would still be good to know if a function in LO basic does exist that returns the identity of the text box, or other control, that has focus so it can be assigned a variable and manipulated as desired