Ask Your Question
0

How do I make a button visible from a macro? [closed]

asked 2017-06-02 10:48:22 +0100

David_Ssc gravatar image

During the processing of an add data form I am using a macro to determine based on the data entered whether a button should become visible. The button is named "bSODb". The code that I am using is includes the following (triggered by a different button):

    Me = oEvent.Source.Model.Parent
    Button = Me.GetByName("bSODb")
    ButtonCtrl = ThisComponent.CurrentController.getControl(Button)
    Msgbox ButtonCtrl.isVisible()
    ButtonCtrl.setVisible(True)
    Msgbox ButtonCtrl.isVisible()

The outcome of both Msgboxs is False, the button does not display, nor does it produce an error. What am I missing? (LO 5.2.7.2, OSX 10.12.5) Thanks.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by David_Ssc
close date 2017-06-02 16:30:36.865804

2 Answers

Sort by » oldest newest most voted
0

answered 2017-06-02 16:20:17 +0100

Ratslinger gravatar image

You are trying to change the visibility in the View and it should be in the Model. This will work:

    Me = oEvent.Source.Model.Parent
    Button = Me.GetByName("bSODb")
    Msgbox Button.EnableVisible
    Button.EnableVisible = True
    Msgbox Button.EnableVisible

If this answers your question please click on the ✔ (upper left area of answer).

edit flag offensive delete link more

Comments

Perfect! Lots to learn with a new package. Thank you.

David_Ssc gravatar imageDavid_Ssc ( 2017-06-02 16:30:17 +0100 )edit
0

answered 2017-06-02 13:31:04 +0100

peterwt gravatar image

I believe it should be -ButtonCtrl.Visible = True or False

edit flag offensive delete link more

Comments

This solution doesn't change the Visibility nor generate an error message (The Msgbox after executing this command is still False).

David_Ssc gravatar imageDavid_Ssc ( 2017-06-02 13:41:22 +0100 )edit

Question Tools

1 follower

Stats

Asked: 2017-06-02 10:48:22 +0100

Seen: 195 times

Last updated: Jun 02 '17