Minitoolbar update

Minitoolbar update

Anonymous
Not applicable
402 Views
1 Reply
Message 1 of 2

Minitoolbar update

Anonymous
Not applicable

I am trying to built a minitoolbar that will need to udate the label.

My minitoolbar is defined, I have a label, then a button. When I select the button, an other dialog box appear and I can change a text. That text is saved in my my.settings... That work fine.

Then I try to do a m_minitoolbar.controls(1).displayname and change it with a different text, but nothing changed on the toolbar on the screen... Is there a way to update it. Do I need to remove the toolbar and create a new one...

 

Sub question: is there a way in a minitoolbar to have a textbox, I would like the user to be able to type-in some text. It's not a value box, as there no dimensions, but just text?

 

 Public Sub CreateMiniToolBar()
        Try
            m_MiniToolbar = invApp.CommandManager.CreateMiniToolbar
        Catch ex As Exception
            MessageBox.Show(ex.ToString)
        End Try


      
        Dim miniControls As MiniToolbarControls = m_MiniToolbar.Controls
        miniControls.AddLabel("idLabel", "Current: " + My.Settings.Prefix _
                              , "Prefix of the occurence to remove material from")

        m_button1 = miniControls.AddButton("id_btnPrefix", "Change", "Change the prefix to use")

      ' this button is showing a dialogbox and on exiting it's calling MiniToolBarChangeLabel

 


        m_MiniToolbar.Visible = True


    End Sub

    Private Sub MiniToolBarChangeLabel()

               m_MiniToolbar.Controls(1).DisplayName = "Prefix: " + My.Settings.Prefix

    End Sub

0 Likes
403 Views
1 Reply
Reply (1)
Message 2 of 2

ekinsb
Alumni
Alumni

I've discovered what I believe is a problem with the API, but have also found a simple solution.  When you get the control from the mini toolbar, it doesn't update the text of the label, just as you said.  However, if I keep a reference to the label control at the time I create it and then use that reference when editing the text of the label, the label updates as expected. I shouldn't need to do that and it is strange behavior, but it's a simple workaround that will solve the problem for now.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
0 Likes