Modifying Toolbar menu items

Add-in Express™ Support Service
That's what is more important than anything else

Modifying Toolbar menu items
 
Carl Wuensche




Posts: 50
Joined: 2008-11-07
I'm trying to share the instance of the toolbar between all windows forms so I can modify the menu for example when I log in successfully.

I have it successfully sharing data so I can change the instance to logged in or not logged in when a username/password is matching the database row, but I need to be able to modify menu items when this happens.

I tried searching for what to do, but I can't find anything.
Posted 14 Apr, 2011 13:36:32 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hi Carl,

Sorry, but I don't quite understand you. Could you please take a screenshot of the toolbar menu items you want to share?

What version and build number of Add-in Express do you use? What is the host application of your add-in project?
.NET, Extended MAPI, Windows Phone & RT
Posted 15 Apr, 2011 04:21:51 Top
Carl Wuensche




Posts: 50
Joined: 2008-11-07
Ok,
well I have a login modal window. I can successfully log in. What I want to do is modify the menustrip menu item from a modal window.

I'm trying to use SendMessage, because I think that's how you're supposed to do it... but I can't access the SendMessage or SendMessageToAll method from a modal. I'm using the latest Add-In Express build from January.


        If rows > 0 Then
' if there are results with the given username/password
            MessageBox.Show("You have successfully logged in!")
            GlobalData.Instance.setLoggedIn(True)
            Dim barItem As AddinExpress.IE.ADXIEBarItem = IEToolbarModule.CurrentInstance(0)
            Dim barObj As AddinExpress.IE.ADXIEBar = barItem.BarObj

            Me.Close()
        Else
'No rows exist, username/password do not exist.
            MessageBox.Show("There was a problem with your username/password or your account doesn't exist.")
        End If



I was trying to follow examples in the documentation to access the bar to get to the menustrip, but it doesn't work.
Posted 15 Apr, 2011 13:14:20 Top
Carl Wuensche




Posts: 50
Joined: 2008-11-07
See I'm trying to do something like this


Dim inst As New IEToolbarModule
                inst.LoginToolStripMenuItem.Visible = False
                inst.LogoutToolStripMenuItem.Visible = True
                inst.LoginToolStripMenuItem.Text = "Logout"


None of those things work. There are no errors, but the results don't show up on the menu bar.
Posted 18 Apr, 2011 00:32:34 Top
Sergey Grischenko


Add-in Express team


Posts: 7224
Joined: 2004-07-05
Hi Carl,

Please use the code below to access the module from the modal form.

IEBarModule.CurrentInstance(AppDomain.GetCurrentThreadId())
Posted 18 Apr, 2011 12:39:08 Top
Carl Wuensche




Posts: 50
Joined: 2008-11-07
Thank you very much for your help!
Posted 19 Apr, 2011 13:26:07 Top