Displaying the Navigation Toolbar

Description

The vCshowNavBar check box on the Main Menu form displays the Navigation Toolbar. It uses the following Xbasic code.

 Xbasic Code Run by the vCshowNavBar OnChange Event

if (vCshowNavBar = "yes") then
    dim global vcToolbarName as C
    vcToolbarName = show_nav_toolbar()
else
    if (ui_modeless_dlg_exist(vcToolbarName) then
        ui_modeless_dlg_close(vcToolbarName)
    end if
end if

 An Explanation of the Xbasic Code

The session variable vCshowNavBar is defined at the form level and initialized to "no". Consequently, the Navigation Toolbar does not display when the application starts. The first action is to create the variable vcToolbarName, which can later be used to test whether the toolbar is open.

if (vCshowNavBar = "yes") then
    dim global vcToolbarName as C

If the user wants to show the Navigation Toolbar, we call the function that opens it. The show_nav_toolbar() function returns the name of the toolbar.

vcToolbarName = show_nav_toolbar()

The alternative is that the user wants to close the toolbar. Before closing the toolbar, use the ui_modeless_dlg_exist() function to make sure that the user did not already close it.

else
    if (ui_modeless_dlg_exist(vcToolbarName) then

If we have established that the toolbar is still open, then close it.

ui_modeless_dlg_close(vcToolbarName)
    end if
end if

See Also