C++ComponentsLanguage FeatureLearn C++

Easily Learn About Basic Windows Components In C++ Development (QuickLook Part 7)

In this post MainMenu, PopupMenu and MenuBar, ToolBar, SpeedButton that are basic components of C++ Builder are listed. You can get more information about each of these components from the Offical DocWiki Web Page of Embarcadero. Menus are really important if you have a lot of options to select, may be they are in groups, so user may reach the right menu item by using groups. Menus are one of the basic components of Windows applications. Menus can be done by using many components in C++ Builder. Easiest and the best way is to use MainMenu, PopupMenu and MenuBar components. If you have less items ,an another way is using Toolbar as a menu holder and Buttons inside it as Menu.

C++ Builder is the easiest and fastest C and C++ IDE for building simple or professional applications on the Windows, MacOS, iOS & Android operating systems. It is also easy for beginners to learn with its wide range of samples, tutorials, help files and LSP support for code. C++ Builder comes with Rapid Application Development Studio, also known as RAD Studio, and C++ Builder is one of the most professional IDE’s that work under RAD Studio. It is the oldest IDE (it began as Borland TurboC in 1990 and was later renamed Borland C++ Builder). Under the Embarcadero brand it comes with new versions, features, updates and support. RAD Studio’s C++ Builder version comes with the award-winning VCL framework for high-performance native Windows apps and the powerful FireMonkey (FMX) framework for cross-platform UIs. There is a free C++ Builder Community Edition for students, beginners and startups.

You can download the free C++ Builder Community Edition here: https://www.embarcadero.com/products/cbuilder/starter.
Professional developers can use the Professional, Architect or Enterprise versions of C++ Builder. Please visit https://www.embarcadero.com/products/cbuilder.

MainMenu

MainMenu (TMainMenu) is used to describe the structure of the form’s main menu. TMainmenu is composed of TMenuItems. Each menu items can be used as menus. To create a main menu, just drag it and double click on it to open Items Editor and follow the instructions as described here

MenuBar

MenuBar (TMenuBar) describes the structure of a menu bar that can be moved, resized, and edited. TMenuBar is composed of TMenuItems.

Represents an editable menu bar.

PopupMenu

PopupMenu (TPopupMenu) is used to describe a menu that appears only when the Popup procedure is called. TPopupMenu appears at the coordinates indicated by the parameters of the Popup procedure as in given example below. TPopupMenu is composed of TMenuItems. To create a popup menu, just drag it and double click on it to open Items Editor and follow the instructions as described here

Simply, if you created your popup menu, you can popup by giving its X and Y coordinates as below;

ToolBar

ToolBar (TToolBar) represents a toolbar component for use in FireMonkey forms. It is generally usually aligned at the top or bottom of a form, and has a bunch of buttons that represent shortcuts or ways to access the functionality embedded into your application. A toolbar holds essentially speed buttons, but any other FireMonkey control can sit inside a toolbar. All tool buttons on a toolbar should maintain a uniform width and height for consistency.

Typically, the tool buttons correspond to items in an application’s menu and give the user more direct access to the application’s commands, but they can access other functionality implemented into your application.

SpeedButton

SpeedButton (TSpeedButton) represents a push button that contains a text caption, for usage in various toolbars that you might employ into your applications. A TSpeedButton is a general-purpose push button for use in an application’s toolbar. These buttons can be enabled, disabled, pressed, and can respond to control keys such as ESCAPE and ENTER. These speed buttons can also have a modal result attached to them. Their distinctive appearance differentiates them from other buttons. Also, speed buttons cannot receive TAB focus. SpeedButtons can be used like menu items in ToolBars.

SpeedButtons are same as Buttons but no borders they have. Generally they can be used with Aligned to Left in ToolBars, Margins and Padding settings. It can be used with OnClick() event.

Conclusion

As shown above in addition to Buttons we can use all these components as menus to run procedures on user clicks in our codes. If you have a lot of options ( mostly in detailed windows applications) we recommend you to use MainMenu, PopupMenu. If you have less items (this is may be graphically good to simplify your view) we recommend you to use MenuBar or Toolbars with SpeedButtons, or some Buttons simply. C++ Builder has a good feature, visual Styles which will make them glorious in your applications. There are more information about using menus in a FireMonkey applications here.

Oh hi there 👋
It’s nice to meet you.

Sign up to receive awesome C++ content in your inbox, every day.

We don’t spam! Read our privacy policy for more info.


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial

Free C++Builder Community Edition

About author

Dr. Yilmaz Yoru has 35+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux, and some other operating systems. He graduated and received his MSc and PhD degrees from the Department of Mechanical Engineering of Eskisehir Osmangazi University. He is the founder and CEO of ESENJA LLC Company. His interests are Programming, Thermodynamics, Fluid Mechanics, Artificial Intelligence, 2D & 3D Designs, and high-end innovations.
Related posts
C++C++11C++14C++17C++20Introduction to C++Learn C++

Learn Copy Constructors in C++ Classes

C++C++11C++14C++17Introduction to C++Learn C++Syntax

Learn How To Use Types Of Destructors In C++?

C++C++11C++14Learn C++Syntax

How To Convert u32string To A wstring In C++

C++C++11C++14C++17C++20Introduction to C++Learn C++

How To Learn The Move Constructors In Modern C++?

Worth reading...
Learn About Basic Windows Components In C++ Development (QuickLook Part 3)