XTimers unitXDialogs unitXMenus.pas unit

    This unit contains definition of XMenu (similar to TMainMenu in VCL) and XPopup (similar to TPopupMenu in VCL). The main difference is that menus in XCL are not necessarily part of applet and functioning as well as add-ons, attaching to events On_Message of parent form when used. Also, XMenu and XPopup are designed to simplify its usage in XCL environment, where there are no visual programming at all. Menus are creating on base of simple array of strings, representing menu items. There are some recommendations below how to create and handle its optimally.
    Unfortunately, there are some garbages in implementation of menu in Windows which are leading to flickering of main menu bar of window when it is resizing with mouse. Now I do not see any way to avoid it excluding of replacing menu bar with toolbar panel and creating popup menu for every of such toolbar button (toolbar can be based on Windows toolbar control or just emulated as panel with buttons). May be, there is sensible to create such menu control as x-control later making it compatible with XMenu.

XMenu = class( XChild );

XMenu properties:

Properties inherited from XClass:


XMenu methods:


XMenu events:

type XOnMenuItem = procedure( Sender : TObject; Item : Integer ) of object;


XPopupMenu = class( XMenu );

    Properties, methods and events are the same as for XMenu (see above). Difference is only that You have to use additional method Popup( X, Y : Integer ) to show pop-up menu on screen (e.g., in responce to right mouse button click).

Tasks.

    XMenus unit is intended to use in XCL non-visual programming environment, so some efforts were made to simplify its creation and usage. As You can see, it is creating using array of strings as template. Writing of such strings is more easy task then working with menu resources. But it requires that You always remember number of menu items to have access to its and to handle meny messages. I recommend follow next steps when creating menu:

Remark: XMenu and XPopup are very similar and useful when menu are static (i.e., You do not plan to create or change it dynamically excluding first creation). These both do not support shortcuts and showing of shortcuts. Its can flick when form is resising.
    But these are very small and convenient to use with XCL.

You can find example of using XMenu and XPopup in Sample3, supplied with xcl package.


goto XCL page

goto home page