Knowledge Base 
Adding CommandBars and Menu to the main VFP screen 
 Thursday, October 29, 2020

Adding CommandBars and Menu to the main VFP screen

You can add CommandBars and Menu to the main VFP screen. To do this, you need to set the AttachToScreen property to .T.. This property should be set before the InitCommandBars method is called.

To hide the Visual FoxPro system menu, set the HideSysMenu property to .T. after the InitCommandBars method is called.

Set properties in the Properties window (or Builder) or put the following code in the Init event of the form:


ThisForm.CBM.AttachToScreen = .T.
ThisForm.CBM.AttachToFrame = .T.
ThisForm.CBM.InitCommandBars()
ThisForm.CBM.HideSysMenu = .T.
Now you can run the form:
Do Form "formName" NoShow
Or, in case of the form is defined as a class:

loForm = CreateObject( "formWithCommandBars")
loForm.CBM.HideSysMenu = .T.