button has dotted lines on it

I have 2 buttons in my spreadsheet ( libreoffice 6.2.0.3 ), both have identical properties except for the macro they call and their y position. button 1 works perfectly but when i click button 2 it works but then there is a dotted line around the label on the button. If i then click an empty cell the dotted line goes away and the button looks normal again.
Why is this happening and how do i fix it?

The dotted rectangle shows that the button has the focus.
You may generally trigger the action by clicking on it, but if it has the focus, the event ‘Execute action’ will also be raised by pressing the Enter key.
By default the last clicked button takes the focus. You can prohibit this for a control under ‘General’ in the object inspector.
If you click into a cell, the cell takes the focus. …

Why does Button 1 work fine but Button 2 act differently?
Also, how do i start the Object Inspector? I cant find it on any of the menu’s (did I overlook it?)

Since I don’t know how you had set the related properties, I only can guess you clicked “button 2” last. If both the buttons are enabled and have default behaviour concerning the focus, the one clicked last will have the focus (if not user code called by it already changed this). Did you try to click “button 1” a second time? What happened?
Concerning the term “object inspector” you find my answer in the other comment under -3-.

Ok, it turns out that you need to go to design mode and then Right click on the Button and select Control, then under the General Tab set ‘Tab Stop’ to No and set ‘Take Focus on Click’ to No, I did this for both buttons and now they operate as I expected them to

I installed the Object Inspector but after messing around with it some I decided I really did not know how to use it, so I will remove it

-0- Your question primarily was “Why?”. There wasn’t actually something to “fix”, but to change in a way better matching your expectations.
-1- The above is mainly a comment on an answer. It’s doubtable if it is well placed as an answer.
-2- It’s good practice to help users to evaluate answers by either “accepting” one or by up- or downvote them.
-3- The term ‘Object inspector’ as I used it did not refer to an installable tool. What I wanted to talk of was the additional window titled Properties: Push Button that opens if you click the icon Control if previously a control was selected. (If not shown: Enabel View>Toolbars> Form Controls.) Sorry for unclear terminology.
-4- What “Object inspector” did you mess around with?
-5- How did you “go to design mode” without previously having selected the control?
-6- To have controls being members of a tab sequence and to allow them to take the focus is default behaviour for well proven reasons. You can change it.