How to hide a command bar?

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

How to hide a command bar?
 
Oleg Demchenko




Posts: 29
Joined: 2007-12-10
Hello,

I created an ADXOlExplorerCommandBar that should be hidden in some conditions.

When I set it's Visible=false; it disappears, but when folders are switched toolbar appears again.

I tried using ExplorerFolderSwitch and was setting CommandBar Visible property to false again, but that causes Command bar to appear and disappear, which is visibly noticeable.

I am using Outlook 2003, ADX Standard 3.8.1886.2005 and VS 2005

How can I hide commandbar without it reappearing when folders are switched?
Posted 18 Jun, 2008 17:22:40 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hello Oleg,

Try to use the ExplorerBeforeFolderSwitch event.
.NET, Extended MAPI, Windows Phone & RT
Posted 19 Jun, 2008 04:33:37 Top
Oleg Demchenko




Posts: 29
Joined: 2007-12-10
Hi Eugene,

I tried using ExplorerBeforeFolderSwitch event and the result is even worse - command bar appears and disappears several times..
Posted 19 Jun, 2008 13:50:16 Top
Andrei Smolin


Add-in Express team


Posts: 16612
Joined: 2006-05-11
Hi Oleg,

Yes, you can set any string value, which isn't a folder name, to the FolderName property, in order to effectively hide the command bar. Does it work for you?

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 19 Jun, 2008 14:55:45 Top
Oleg Demchenko




Posts: 29
Joined: 2007-12-10
Hi Andrey,

Thanks for the reply.

Setting FolderName to the string that has no match with the folder name does help in a way, BUT the problem is that command bar does not disappear until folder is changed..

To reiterate:
1. On one command bar there is a button1 that toggles visibility of another coommand bar by setting FolderName to '*' to make it visible, and to 'QEWOIUQW' to make it invisible
2. When button1 is pressed command bar sometimes does not disappear/appear
3. When folders are switched command bar disappears/appears

Why is commandbar.Visible property not working on the first place? Isn't that a bug?

The way commandbar.Visible property works now is:
1. Visible set to false
2. Command bar disappears immediately
3. When folders are switched command bar appears again..

Expected:
1. Visible set to false
2. Command bar disappears immediately
3. When folders are switched command bar stays invisible
Posted 20 Jun, 2008 00:36:06 Top
Eugene Astafiev


Add-in Express team


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

I created a sample add-in and, in the BeforeFolderSwitch event handler, wrote the following line:

adxOlExplorerCommandBar1.FolderName = "qqq#%$ddd";

It works fine for me. Does it work for you?
.NET, Extended MAPI, Windows Phone & RT
Posted 20 Jun, 2008 06:14:11 Top
Oleg Demchenko




Posts: 29
Joined: 2007-12-10
BeforeFolderSwitch happens before folders are switched...

I need toolbar to disappear without switching folders

What about Visible property?
Posted 20 Jun, 2008 12:04:48 Top
Andrei Smolin


Add-in Express team


Posts: 16612
Joined: 2006-05-11
Oleg,

In the scenarios below, on I assume that
- On a command bar there is a button1 that toggles visibility of another command bar (commandBar2)
- CommandBar2 should be visible (or invisible, when you need) for the inbox only (CommandBar2.FolderName = 'Personal Folders\Inbox')
- The current folder is the inbox

1. To hide CommandBar2, set CommandBar2.Visible = False. When the user navigates to some other folder and then returns to the inbox, Add-in Express sets CommandBar2.Visible to true because CommandBar2.FolderName = 'Personal Folders\Inbox'.

2. To hide CommandBar2 "for ever", set CommandBar2.Visible = False and set CommandBar2.FolderName = 'QEWOIUQW'.

3. To unhide CommandBar2, set CommandBar2.Visible = True. When the user navigates to some other folder and then returns to the inbox, Add-in Express sets CommandBar2.Visible to true because CommandBar2.FolderName = 'Personal Folders\Inbox'.

4. To unhide CommandBar2 "for ever", set CommandBar2.Visible = True and set CommandBar2.FolderName = 'Personal Folders\Inbox'.

Please let me know whether this works for you.

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 20 Jun, 2008 14:53:29 Top
Oleg Demchenko




Posts: 29
Joined: 2007-12-10
Hi Andrei,

Your assumptions are almost right: CommandBar2 should be visible/invisible for all folders (CommandBar2.FolderName="*")

I tried your suggested solution but it does not work.

Setting Visible=false and FolderName to 'qwerqwe' seems to work for hiding, BUT setting Visible=true and FolderName to '*' doesn't always show commandBar2.

I tried it on both OL2003 and OL2007 and the right sequence for reproducing the 'not showing' effect seems to be:
1. Select 'inbox'
2. Hide commandBar2 (Visible=false, FolderName='qweqwe')
3. Switch folder to 'Sent items' (or any other folder)
4. Show commandBar2 (Visible=true, FolderName="*")
5. commandBar2 is not shown..

Posted 23 Jun, 2008 13:19:11 Top
Andrei Smolin


Add-in Express team


Posts: 16612
Joined: 2006-05-11
Hi Oleg,

I've tested this scenario and found that, when restoring command bar visibility, you also need to set Enabled to true before setting Visible to true.


      If Me.AdxCommandBarButton1.Caption = "Hide CommandBar2" Then
         Me.AdxOlExplorerCommandBar2.Visible = False
         Me.AdxOlExplorerCommandBar2.FolderName = "qweqwe"
         Me.AdxCommandBarButton1.Caption = "Show CommandBar2"
      Else
         Me.AdxOlExplorerCommandBar2.Enabled = True
         Me.AdxOlExplorerCommandBar2.FolderName = "*"
         Me.AdxOlExplorerCommandBar2.Visible = True
         Me.AdxCommandBarButton1.Caption = "Hide CommandBar2"
      End If


Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 24 Jun, 2008 04:13:55 Top