I have a very simple form - let’s say two text input boxes only.
I would like a macro to copy whatever content is entered into box 1 and enter it into box 2. Can this be done?
I have a very simple form - let’s say two text input boxes only.
I would like a macro to copy whatever content is entered into box 1 and enter it into box 2. Can this be done?
Big picture, this is not a great idea. Data should be stored only once. That said, the code in LO Basic you are looking for is as follows for text box controls. Every kind of control has a different method, text boxes use method text
while numeric boxes use value
; use .dbg_methods
and .dbg_properties
to find right method:
root_doc = ThisComponent
form_container = root_doc.Drawpage.Forms
main_form = form_container.MainForm
field_src = main_form.getByName("TextBox1")
field_dest = main_form.getByName("TextBox2")
field_dest.text = field_src.text
field_dest.commit()
Have this macro be triggered from push button, loss of focus on source, something like that.