C++Language FeatureLearn C++

Easily Learn About Basic Windows Components In C++ Development (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.

close
Related posts
C++C++11C++14C++17Learn C++

Quickly Learn To Use Quick Sort Algorithm In C++ On Windows

C++Language FeatureLearn C++

Easily Learn To Use The Clipboard In Modern C++ On Windows

C++C++11C++14C++17Language FeatureLearn C++

Learn To Create Alpha Color Bitmap From A Bitmap By A Given Color In Modern C++

C++Learn C++Videos

Learn C++ With Effective Remote C++ Development with Codespaces by Nick Uhlenhuth (CPPCon 2020) Video

Worth reading...
Learn C++ With Techniques for Moving Work to Background Threads by Anthony Williams (CPPCon 2020) Video
en_USEnglish