Hyderabad Jobs Book Website FREE PowerBuilder Training I Love Hyderabad Hyderabad Colleges
Home Business Emails Hyderabad Classifieds Contact Us
7 Wonders of Hyderabad Web Hosting Yellow Pages Our Network

 
Webpowerbuilder.hyderabad-colleges.com

Advanced PowerBuilder

HomePrevious Lesson: Minimizing Application When Idle
Next Lesson: Scoping Variables

Customizing Toolbars

When you click on any toolbar icon with the right mouse button, PowerBuilder displays a pop-up menu and allows you to change the toolbar position, show/hide the toolbar text and even the toolbar itself.

Once the toolbar is hidden by deselecting the Sheetbar option, there is no default method to display the toolbar again; hence, you need to provide a menu option to display the toolbar. That's the purpose of the menu option 'Window > Toolbars' in the m_sheet_menu. Add the following code to the Window > Toolbars menu option:
// Object: Window/Toolbars in "m_sheet_menu" menu.
// Event: Clicked
If ParentWindow.Toolbarvisible = true Then
   ParentWindow.Toolbarvisible = False
   This.Text = "Show Toolbar" 
Else
   ParentWindow.Toolbarvisible = True
   This.Text = "Hide Toolbar" 
end if

This simply checks if the toolbar is visible and toggles between on or off, and changes the text displayed in the menu option at the same time.

This code has its disadvantages. If you show/hide the toolbar by selecting this option, it works fine. However, when we try to hide toolbar from the pop-up menu, we expect the menu item text to change accordingly, but it won't. To solve this problem, add the following code to the Window menu option:


// Object: Window option in m_sheet_menu menu.
// Event: Clicked
If ParentWindow.Toolbarvisible = true Then
Parent.m_window.m_toolbars.Text = "Hide Toolbar" 
Else
Parent.m_window.m_toolbars.Text = "Show Toolbar" 
end if

To select Toolbar option from the menu, the user has to click on the Window menu option. At this point just change the text, so that the user always sees the correct menu option.

There is always a possibility that the user may press the Alt key to activate the menu, rather than clicking on it. For it simply add this one line code in the selected event of the menu bar item:


// Object: window in m_sheet_menu menu.
// Event: Selected
TriggerEvent(This, Clicked!)
HomePrevious Lesson: Minimizing Application When Idle
Next Lesson: Scoping Variables

Copyright © 1996 - 2006 HamaraShehar.com Pvt. Ltd. All Rights Reserved.
Domain Registration, Website Design, Website Hosting by HamaraShehar.com