Hide or show the Application menubar

I am developing a Windows desktop application that has a login feature for users.

I made it in such a way to hide the menubar1 if the user is not logged in, and to show it if the user logs in.

Problem is that I have used the MenuBarVisible = false, which in turn turns hides the menubar… but it also turns the Windows taskbar invisible of.

Granted, I found the problem described in old forums. But that did not give me a clue how do I hide/show the menubar???

There are properties within the menubar that look like they should work such as: Enabled and Visible… but they do not work.

What I have done so far is: on App open event handler I try to MenuBar1.visible = False… that does not work at all.

Please help

Have you tried changing the window’s menubar itself?
Window.MenuBar seems to imply you can set the menu bar to none (however it does not state whether you can use the string none, or if nil works, or how you do that) so see if that might be possible to do.

[quote=128897:@Vedran Maricevic]I am developing a Windows desktop application that has a login feature for users.

I made it in such a way to hide the menubar1 if the user is not logged in, and to show it if the user logs in.

Problem is that I have used the MenuBarVisible = false, which in turn turns hides the menubar… but it also turns the Windows taskbar invisible of.

Granted, I found the problem described in old forums. But that did not give me a clue how do I hide/show the menubar???

There are properties within the menubar that look like they should work such as: Enabled and Visible… but they do not work.

What I have done so far is: on App open event handler I try to MenuBar1.visible = False… that does not work at all.

Please help[/quote]

A call is possible at the Windows system level. You can build a declare.

See http://msdn.microsoft.com/en-us/library/windows/desktop/ms633548(v=vs.85).aspx

To hide the taskbar use SW_HIDE, and to show it back SW_SHOWNA.

But if a declare is too complex, the alternative is to use two windows :

  • A plain box window when the user is not logged
  • A normal window with its menu when the user is logged

Make both windows exactly the same size, make sure to place them exactly at the same left and top, and upon login, simply switch from one to the other. Close the first one and show the second.

Cannot edit my previous post : The ShowWindow declare is present in the Windows functionality suite.

Thank you guys for ideas. I have either to play with Windows internals to control the taskbar itself, or play tricks with windows on each other.

It is incredible this doe not work in XOJO:
MenuBar1.Visible = false
MenuBar1.Enabled = false

I placed this in button action… and no effect.

Thank you again :slight_smile:

As Tim notes above, Window.MenuBar can be used to show or hide the menu bar. This code in a PushButton on the Window, toggles the menu bar on or off:

If Self.MenuBar <> Nil Then Self.MenuBar = Nil Else Self.MenuBar = MainMenuBar End If

[quote=128917:@Paul Lefebvre]As Tim notes above, Window.MenuBar can be used to show or hide the menu bar. This code in a PushButton on the Window, toggles the menu bar on or off:

If Self.MenuBar <> Nil Then Self.MenuBar = Nil Else Self.MenuBar = MainMenuBar End If[/quote]

That works very well :slight_smile: