[PB] pb menu details and MDI

Source: Internet
Author: User

Menu Bar-menubar, menu item-menuitem, cascading menu (sub menu)-submenu

A menu item (menuitem) is the most basic element in a menu, as long as there is text content, it is a menu item. A menu bar (menubar) is a general term for the top menu items in a menu. It is also called a menu title. The content of the menu bar is always displayed, and the operations on the menu also start from here. Move the mouse over a menu bar or click a project to display the corresponding content. This is called a drop-down menu, which contains many menu items. Most of them execute relevant functions, A few can also contain more detailed content, called a cascade menu or a submenu. Such menu items have small arrows on the right.

When setting the menu, each step in the design window is reflected in the preview window. You can check whether the level relationship is correct at any time. If an order or level error occurs, you can select the wrong menu item with the mouse (do not edit the menu item) and drag it directly to the correct position. When you enter content in a menu item, two characters have special meanings. "-" can be used to create a separation line between menu items. "... "indicates that a Property dialog window is displayed for this menu item. In addition, a pop-up menu can pop up a drop-down menu or a cascade menu. You can also design a pop-up menu separately, which is no different from the design of the drop-down menu.

[Attribute]

▲Name
Name the menu item in this attribute box. The default menu name is M _ plus the menu item content. When referencing a menu item in a script, you must add the dot symbol at the first level to reference it step by step. For example, to reference the menu item "open" under "file", you can use the "M _ file. M _ open to reference.

▲Text
This attribute is the content entered in each menu item when a menu is created. The entire menu content during running is the content of this attribute.

▲Microhelp
If the menu is attached to mdihelp! In a running window, when the cursor points to a menu item or a small icon in the toolbar, the text can be displayed in the status bar at the bottom of the MDI window.

▲Toolbaritemtext
You can define the text displayed in the toolbar icons to briefly describe the functions of the icons. This text is displayed when the pointer points to a small icon in the toolbar

▲Toolbaritemname
This attribute defines the image displayed on the toolbar icons. You can use or customize many small icons provided by PowerBuilder.

▲Toolbaritemdownname
When the menu is selected, that is, checked, the icon that is pressed is usually the same as the ToolBarItemName

▲Toolbaritemvisible
Display or hide toolbar icons

▲Toolbaritemdown
Select the menu, that is, checked, and click the icon

▲Toolbaritemspace
Specify the spacing between the icon and the preceding icon. Generally, they are all 0. It is necessary to set the spacing between icons in different groups.

▲Toolbaritembarindex
Specifies the toolbar on which the icon is displayed. The icons with the same attribute are displayed in the same row. They can be the same and do not require the attribute to be a continuous number.

▲Toolbaritemorder
Specify the icon display order. The larger the value, the closer it is to the back. The default value 0 is displayed in the order in the menu.
For example, if you need to put the exit icon at the end of the menu file, all others are 0, and you can set exit to 1.

▲Shortcutkey
This attribute is used in combination with the ShortCut cut Alt, ShortCut cut Control, and ShortCut cut ShIft options to define ShortCut keys for menu items.

Other attributes are rarely used.

Menu Programming 〗
● Write scripts for the "exit" menu item
In the menu, parentwindow refers to the window attached to the menu, which is more universal than directly using the window name. Therefore, you can write the script close (parentwindow) in the Clicked event of the "exit" menu item)

● Select a menu item
You can use the Checked Mark to indicate that a menu item is selected. You can write the following script in the Clicked event of the menu item to select the menu item:
If this. checked then
This. checked = false
Else
This. checked = true
End if
You can also use the functions Check and UnCheck to modify attributes. The above script can be changed:
If this. checked then
This. uncheck ()
Else
This. check ()
End if
When a menu item is selected, there is a "√" symbol on the left of the menu item, and the corresponding small icon is pressed.

● Hide a menu item
To hide a menu item, you can change the Visible attribute of the menu item to False. If the menu item is located at the highest level of the menu item, the entire drop-down menu can be hidden. For example, if m_main is attached to a window and the entire "file" drop-down menu is hidden in the window opening event, you can write the following script in the 0pen event of the window:
M_main.m _ file. Visible = False
However, hiding a menu item does not imply its corresponding small icon in the toolbar, and the function of the small icon can still be normally executed. To hide a small icon, set the ToolBarItemVisible attribute to False. For example, you can use the following statement to hide the small icon corresponding to the "open" menu item in the window opening event:
M_main.m _ open the file. m _. ToolBarItemVisible = False

● Invalidate a menu item
If you set the Enabled attribute of a menu item to False, the display of the menu item becomes grayed out, and the corresponding small icon becomes grayed out. If the drop-down menu is left blank, the entire drop-down menu cannot be used, but the small icon corresponding to the drop-down menu can be used normally. If the cascade menu is used, the cascade menu cannot be opened, but the icons corresponding to each menu item under the cascade menu can be used normally. In the window opening event, modify m_open under the "file" in the menu m_main to an invalid script:

M_main.m _ file. m_open.Enabled = False

● Adjust the tool bar position
If the ToolBarUserControl attribute of the toolbar (in application) is set to True, you can right-click the toolbar to bring up the menu. You can use this menu to adjust the position of the toolbar. You can also change the position of the toolbar by dragging it directly. When the position of the toolbar changes, the ToolBarMoved event of the window is triggered. In this event, you can write scripts to determine the movement of the toolbar. When this event is triggered, PB automatically modifies the WordParm and LongParm parameters in the Message to use these two attributes to determine the movement of the toolbar. The attributes are described as follows:
Message. LongParm attributes:
0: move to the left;
1: Move to the top;
2: Move to the right:
3: mobile testing;
4: changed to floating display.
Message. WordParm attributes:
O: FrameBar is moving;
1: The SheetBar is moving.
Programming the tool bar position is generally applied when the window is opened or closed. Close the settings of the toolbar should be saved to restore the toolbar to the last closed state when the window is opened. The information can be stored in the INI file of the application. The developer only needs to understand the specific meaning. When the tool bar is opened, the location of the tool bar is set according to the same meaning. For example, programming in the close () event of Frame (ToolbarAlignment is the property of the window ):
Choose case this. ToolbarAlignment
Case AlignAtTop!
SetProfileString ("C: \ toolbar. ini", "setup", "align", "1 ")
Case AlignAtLeft!
SetProfileString ("C: \ toolbar. ini", "setup", "align", "0 ")
Case AlignAtRight!
SetProfileString ("C: \ toolbar. ini", "setup", "align", "2 ")
Case AlignAtBottom!
SetProfileString ("C: \ toolbar. ini", "setup", "align", "3 ")
Case Floating!
SetProfileString ("C: \ toolbar. ini", "setup", "align", "4 ")
End choose
Similarly, in the Frame opening event, you can determine the display of the toolbar Based on the INI File Settings. For example, the following script reads the configuration in the INI file in the open event to determine the display position of the toolbar:
String ls_align
Ls_align = ProfileString ("c: \ toolbar. ini", "setup", "align", "1 ")
Choose case ls_align
Case '0'
This. ToolbarAlignment = AlignAtLeft!
Case '1'
This. ToolbarAlignment = AlignAtTop!
Case '2'
This. ToolbarAlignment = AlignAtRight!
Case '3'
This. ToolbarAlignment = AlignAtBottom!
Case '4'
This. ToolbarAlignment = Floating!
End choose
Of course, you can also save more settings in the same way, such as whether the toolbar is hidden or whether the text sheet bar is displayed.

● Modify the content in the pop-up menu by right-clicking the toolbar
The ToolBarUserControl attribute of the Application object controls whether users can use the right-click menu on the toolbar. The default value of this attribute is True. The default value is in English format, you can change attributes such as ToolBarFrameTitle, ToolabarSheetTitle, and ToolbarPopMenuText to Chinese text.
ToolBarFrameTitle: Framework (can also be understood as the main menu toolbar) Frambar Chinese
ToolabarSheetTitle: Chinese name of the Sheetbar after opening sheet
You can also write scripts in the opening event of the Frame:
GetApplication (). ToolbarPopMenuText = "left, top, right, bottom, floating, text, and prompt information"
The text is separated by commas (,). If there are more words, the text will be ignored automatically. Only the text in the pop-up menu can be modified, but the corresponding functions cannot be modified. The GetApplication function can get the handle of the current application ). You can also use the following statement in the Frame opening event to restrict the user from using the pop-up menu on the toolbar:
GetApplication (). ToolbarUserControl = false

● Dynamically set MicroHelp
You can use the SetMicroHelp function to dynamically change the MicroHelp content of a menu item. The syntax of this function is:
Windowname. SetMicroHelp (string)
Windowname is the name of the window attached to the menu, and string is the MicroHelp content to be set. If the function is correctly executed, 1 is returned; otherwise,-1 is returned. If the input parameter is null, null is returned. This function is generally used in the Selected event of the menu item.
If you modify the MicroHelp in the control of the custom Frame window, you must cancel the MicroHelp in the related event. Generally, the GetFocus event of the control displays the explanation information about the control provided by MicroHelp, and changes the MicroHelp to "Ready" in the LoseFocus event ".
A good way to save MicroHelp is to use the Tag attribute of the control. In the window canvas, specify the appropriate content for the Tag attribute of each control to display MicroHelp, then, in the script that needs to change MicroHelp, set the Tag attribute as the parameter of the SetMicroHelp function.

● Right-click the menu to pop up
The PopMenu function is used in the RButtonDown event to display the test menu. The syntax of this function is:
Menuname. PopMenu (xlocation, ylocation)
Here, menuname is the name of the menu to be displayed. It can be a drop-down item in a drop-down menu or a cascading menu. Xlocation and ylocation are the positions displayed in the menu. The value of the coordinates is relative to the window. The PointerX and PointerY functions are usually used to obtain the coordinates, so that the menu is displayed at the place where the mouse clicks. The syntax format of these two functions is the same. The format of PointerX is:
Objectname. PointerX ()
Here, objectname is the control name, and X is the distance between the cursor position and the Left Border of objectname. The default value is the control where the script is located. When used with the function PopMenu, you should obtain the coordinates relative to the window. Although xpos and ypos parameters are available in the RbuttonDown event of each control, they are relative to the control.
In other words, xpos and ypos are rarely used except for the menus to be popped up in the window. It is generally menuname. PopMenu (parent. pointerX (), parent. pointerY ()).
* Menu4 NewMenu
NewMenu = CREATE Menu4
NewMenu. m_language.PopMenu (PointerX (), PointerY ())
NewMenu. m_language.PopMenu (w_frame.PointerX (), w_frame.PointerY ())

● Change the menu in the window
The function ChangeMenu can dynamically change the menu of the window. Its Syntax format is:
Windowname. ChangeMenu (menuname {, position })
Here, windowname is the name of the window to be changed; menuname is the name of the menu to be attached to the window; position is an optional parameter and is only used in the MDI Frame window, indicates the position of the appended menu title in the current window list. The default value is 1. All opened sheets appear at the bottom of the drop-down menu of the first menu title.


Hide and display Toolbar
Windowname. ToolbarVisible = True/False
Hide and show text
GetApplication (). ToolbarText = True/False
Hide and display prompt information
GetApplication (). ToolbarTips = True/False

[MDI]-Multiple Document Interface

* Menus are indispensable in the MDI application. Not only must a Frame have a menu, but also each Sheet opened in the customer area should have a menu, if not, the menu of the previous Sheet is automatically inherited. There are two common ways to provide menus for the MDI Sheet: Share a menu between the frame and each Sheet, or provide a separate menu for each Sheet, these two methods can also be used in combination. When multiple Sheet with menus are opened, only the current Sheet menu is displayed at the top of the Frame, and other Sheet toolbar can be displayed without their menus. The menu provides the ability to switch between Sheet and most of the functions that can be completed in Sheet. Each menu can have its own toolbar or its own toolbar. It can also correspond to multiple toolbar. These are all designed in the menu canvas.

* The customer zone is the user's work interval in the MDI window. Sheet is displayed in this region and their display range does not exceed this region. If a control is placed in the MDI Frame, such an MDI window is called a custom Frame, otherwise it is called a standard Frame. The customer zone is actually a very special controller. The control is called mdi_1 and is only available at runtime. When a custom Frame is used, the mdi_1 control cannot be correctly displayed in the visible area, and Sheet cannot be displayed normally. You should write a script in the Resize event of the Frame to locate mdi_1 again. Assume that the command key cb_1 is placed on the top of the Frame, and mdi_1 is displayed between the command key and the status bar. The script is as follows:
Uint li_x, li_y, li_width, li_height
Li_x = WorkSpaceX ()
Li_y = cb_1.y + cb_1.Height
Li_width = WorkSpaceWidth ()
Li_height = WorkSpaceHeight ()-li_y-mdi_1.MicroHelpHeight
Mdi_1.Move (li_x, li_y)
Mdi_1.Resize (li_width, li_height)
The functions WorkSpaceX, WorkSpaceWidth, WorkSpaceHeight, and other functions in the preceding script are used to obtain parameters about the work area. The usage is relatively simple, note that these functions do not include the areas occupied by toolbar. Through the above script, the mdi_1 control can be correctly displayed within the visible range of the Frame, and no exception will occur when the Sheet is opened.
When a standard Frame is used, the system automatically maintains the location and size of the customer zone.

* In the MDI application system, the Frame window must contain a menu, which may or may not have a toolbar. You can write a script to open Sheet in the Frame menu. Sheet is not a special type of window. It is called Sheet when it is opened in a Frame. It is actually a non-MDI type window. Although Sheet is a normal window, it cannot be opened using the Open function. You must use the OpenSheet or OpenSheetWithParm function to Open it. Sheet can have a menu or no menu. When a Sheet with a menu is opened, the Sheet menu automatically replaces the Frame menu. When a Sheet without a menu is opened, the Sheet automatically uses the Frame menu (of course, it may be the built-in menu of the Frame, or it may be another menu of the Sheet ). In this case, a problem occurs. When the Sheet with a menu is opened, the Sheet menu overwrites the Frame menu. How does one implement the functions in the Frame menu? A good solution is to use the toolbar. After the Sheet menu replaces the Frame menu, the Frame toolbar can always be displayed. The Frame menu function can still be normally executed using the toolbar. Therefore, when creating a Frame menu, the good habit is to create a menu toolbar at the same time. However, when using this solution, the ease of use of the small icon feature in the toolbar is very important. Developers should provide as much information about small icons as possible, such as MicroHelp, Tips, and
ToolBarItemText. Another solution may be applicable when all Sheet share the Frame menu. When all Sheet perform operations of the same type or similar type, for example, when Sheet, like Microsoft's Word, edits files, this method is more practical and menu maintenance is simpler.

[Function]

★Opensheet and opensheetwithparm
You can write a script to open sheet in the Frame menu. Sheet is not a special type of window. It is called sheet when it is opened in a Frame. It is actually a non-MDI type window. Although Sheet is a common window, it cannot be opened using the open function, use the OpenSheet or OpenSheetWithParm function. The OpenSheet function does not pass parameters to Sheet, while the OpenSheetWithParm function can pass parameters while opening Sheet. The syntax format of OpenSheet is;
OpenSheet (Sheetrefvar {, windowtype}, mdiframe, {, position {, arrangeopen }})
Here, Sheetrefvar is the name of the Sheet to be opened (Note: it cannot be a MDl window); mdiframe is the name of the Frame, it indicates that sheetrefvar is to be opened in the client area of this Frame. The two parameters indicate which Sheet to be opened in which Frame is required. The variable windowtype is of the string type and is used to indicate the name of the window to be opened. If this parameter is specified, the type of sheetrefvar must be a value that can accept the window type, in this case, the function indicates to open the window with the windowtype name and save its instance in the sheetrefvar variable. You can use this variable to reference this sheet. Position is an integer parameter, indicating the position in the menu bar. The newly opened sheet name is added as a menu item in the drop-down menu of the position. The project position on the leftmost side of the menu bar is 1, which is added in sequence. When this parameter is greater than the number of items in the menu bar, add the sheet name to the bottom of the penultimate menu on the right. If more than 9 sheet data are opened, the redundant data is displayed in the more
Windows. The arrangeopen parameter refers to the layout mode in the customer zone after sheet is opened. It is a value of the arrangeopen Enumeration type and has three available values.
Cascaded! : Stack the opened sheet so that all the title bars are visible. This is the default method.
Layered! : Completely overwrite the opened sheet in the customer zone, and then overwrite the previous sheet.
Original! : Use the original size of the window to open the window and use Cascaded! Layout.
Eg: In the Frame named MDI_my, open the window named w_edit.
Opensheet (w_edit, MDI_my)
Opensheet (w_edit, MDI_my, 3, Cascaded !)
Window lw_w
Opensheet (lw_w, "w_edit", MDI_my, 3, Cascaded !)
Similar to the opensheet function, many parameters in the opensheetwithparm function have the same meanings. The syntax format is as follows:
OpenSheetWithParm (Sheetrefvar, parameter {, windowtype}, mdiframe {, position {, arrangeopen }})
Here, parameter is the parameter to be passed. It can be of the String, Number, or PowerObject type. The usage and parameter meaning of this function are exactly the same as that of opensheet.

★GetActiveSheet
You can use the GetActiveSheet function to obtain the current Sheet. The syntax of this function is as follows:
Mdiframewindow. GetActiveSheet ()
Here, mdiframewindow is the name of the current Frame. This function returns a value of the window type, which is the sheet of the current activity. If an error occurs during execution, invalid data is returned. If mdiframewindow is null, null is returned. This function is often used with IsVaild to check whether the window returned by the function is valid.
IsValid to determine whether the specified object is valid. The function syntax is:
IsValid (objectname)
Objectname is the object for effective judgment. This function returns a value of the boolean type.
Getfirstsheet ()
Getnextsheet ()

★Arrangesheets
The arrangesheets function can be used to arrange the layout of the currently opened and minimized sheet. The syntax of this function is:
Mdiframe. arrangesheets (arrangetype)
Here, mdiframe is the frame name, And arrangetype is a numerical value of the arrangetypes Enumeration type, which can be taken:
Cascade! : Stack the opened sheet so that all the title bars are visible.
Layer! : Completely overwrite the opened sheet in the customer zone.
Tile! : The opened sheet is arranged from left to right in tile mode.
Tilehorizontal! : Place the opened sheet side by side.
Icons! : Only the smallest sheet is placed at the bottom of the frame.
If the function is correctly executed, 1 is returned; otherwise,-1 is returned. If the input parameter is null, null is returned.

★Gettoolbar, gettoolbarpos, settoolbar, and settoolbarpos
Get tool bar Information
You can use attributes and functions to obtain information about toolbar.
The following are the attributes of the toolbar of the Application object. These attributes are often used with the getapplication function. These attributes can control the display of toolbar and obtain information about toolbar.
Toolbarframetitle string the title of the floating display Toolbar
ToolbarSheetTitle string the title on the floating display sheet Toolbar
ToolbarPopMenuText string
ToolbarUserControl boolean toolbar can be controlled using a pop-up menu
Indicates whether or not the small icon in the ToolbarText boolean toolbar displays text.
ToolbarTips boolean indicates whether a prompt is displayed for small icons in the toolbar.
Function to get toolbar information-GetToolbar, GetToolbarPos
Window. GetToolbar (Toolbarindex, visible {, alignment {, floatingtitle }})
Window is the name of the Frame, and Toolbarindex is the index number of the toolbar for obtaining information, which is an integer value. These two parameters should have clear values before the function is executed, it can be a constant or a variable of the corresponding type. Other parameters must be variables. After the function is executed, save the specific information about the toolbar. The alignment parameter is a ToolbarAlignment enumerated variable used to save the alignment of the toolbar. this parameter is optional. The floatingtitle parameter is a string variable used to save the title of the floating toolbar. If the function is correctly executed, 1 is returned; otherwise,-1 is returned. If any parameter is null, null is returned.

* Save and restore the toolbar
Gf_sav1_lbar (window fa_win) // Save the toolbar
Int li_row, li_Offset, li_x, li_y, li_width, li_height // Save the location information of the toolbar.
Boolean lb_visible // whether the toolbar is visible
Boolean lb_tips, lb_showtext // whether a bubble prompt or text is displayed on the toolbar
ToolBarAlignment lta_align // align
String ls_title, ls_alignment, ls_section
If fa_win.GetToolBar (1, lb_visible, lta_align, ls_title) <> 1 Then Return-1 // obtain the toolbar Information
Ls_section = fa_win.ClassName () // obtain the window name
If lb_visible Then // The toolbar is visible.
SetProfileString ("test. ini", ls_section, "visible", "True") // Save the visible attribute as "True"
Else // If the toolbar is a hidden SetProfileString ("test. ini", ls_section, "visible", "False") // save as "False"
End If
Choose Case lta_align // save according to the alignment attribute of the toolbar
Case AlignAtLeft!
Ls_alignment = "left"
Case AlignAtRight!
Ls_alignment = "right"
Case AlignAtTop!
Ls_alignment = "TOP"
Case alignatbottom!
Ls_alignment = "bottom"
Case floating!
Ls_alignment = "floating"
End choose
Setprofilestring ("test. ini", ls_section, "alignment", ls_alignment) // Save the alignment attribute
Fa_win.gettoolbarpos (1, li_row, li_offset) // obtain the row and offset information of the toolbar.
Setprofilestring ("test. ini", ls_section, "row", string (li_row ))
Setprofilestring ("test. ini", ls_section, "offset", string (li_offset ))
Fa_win.gettoolbarpos (1, li_x, li_y, li_width, li_height) // you can specify the height, width, and start position.
Setprofilestring ("test. ini", ls_section, "X", string (li_x ))
Setprofilestring ("test. ini", ls_section, "Y", string (li_y ))
SetProfileString ("test. ini", ls_section, "width", String (li_width ))/
SetProfileString ("test. ini", ls_section, "height", String (li_height ))
Lb_showtext = GetApplication (). ToolbarText // whether text is displayed on the small icon in the toolbar
If lb_showtext Then
SetProfileString ("test. ini", ls_section, "showtext", "True ")
Else
SetProfileString ("test. ini", ls_section, "showtext", "False ")
End If
Lb_tips = GetApplication (). ToolbarTips // whether the prompt information is displayed on the small icon in the toolbar
If lb_tips Then
SetProfileString ("test. ini", ls_section, "tips", "True ")
Else
SetProfileString ("test. ini", ls_section, "tips", "False ")
End If
Return 1

Restore tool bar
Int li_row, li_offset, li_x, li_y, li_width, li_height
Boolean lb_visible
String ls_showtext, ls_tips, ls_title, ls_alignment, ls_visible, ls_section
Toolbaralignment lta_align
// Determine whether a toolbar exists
If fa_win.gettoolbar (1, lb_visible, lta_align, ls_title) <> 1 then return-1
Ls_section = fa_win.classname () // read the window name
Ls_visible = profilestring ("test. ini", ls_section, "visible", "") // read the visible attribute of the toolbar
If ls_visible <> "" Then // The property is read correctly.
Ls_alignment = profilestring ("test. ini", ls_section, "alignment", "TOP") // read alignment
Ls_title = profilestring ("test. ini", ls_section, "title", "") // read the toolbar title
If upper (ls_visible) = "true" then
Lb_visible = true
Else
Lb_visible = False
End If
Choose Case Lower (ls_alignment) // convert struct type to Alignment type
Case "left"
Lta_align = AlignAtLeft!
Case "right"
Lta_align = AlignAtRight!
Case "Top"
Lta_align = AlignAtTop!
Case "botTom"
Lta_align = AlignAtBotTom!
Case "floating"
Lta_align = Floating!
End Choose fa_win.SetToolBar (1, lb_visible, lta_align, ls_title) // you can specify the information of the current toolbar.
Li_row = ProfileInt ("test. ini", ls_section, "row", 1)
Li_offset = ProfileInt ("test. ini", ls_section, "offset", 0)
Li_x = ProfileInt ("test. ini", ls_section, "x", 0)
Li_y = ProfileInt ("test. ini", ls_section, "y", 0)
Li_width = ProfileInt ("test. ini", ls_section, "width", 0)
Li_height = ProfileInt ("test. ini", ls_section, "height", 0)
Fa_win.SetToolBarPos (1, li_row, li_offset, False)
Fa_win.SetToolBarPos (1, li_x, li_y, li_width, li_height) // you can specify the position of a toolbar.
Ls_showtext = ProfileString ("test. ini", ls_section, "showtext", "True") // whether to display text
If Upper (ls_showtext) = "TRUE" Then
GetApplication (). ToolbarText = True
Else
GetApplication (). ToolbarText = False
End If
Ls_tips = ProfileString ("test. ini", ls_section, "tips", "True") // whether to display the prompt information
If Upper (ls_tips) = "TRUE" Then
GetApplication (). ToolbarTips = True
Else
GetApplication (). ToolbarTips = False
End If
End If
Return 1

* Traverse menu items
Integer li_MenuTitle // Save the menu title
Integer li_totalTitles // total number of saved titles
Integer li_MenuItem // Save the menu item
Integer li_totalItems // Save the total number of menu items
Li_totalTitles = UpperBound (This. MenuID. Item)
For li_MenuTitle = 1 To li_totalTitles
Li_totalItems = UpperBound (This. MenuID. Item [li_MenuTitle]. item)
For li_MenuItem = 1 To li_totalItems
MessageBox (String (li_MenuTitle) + "/" + String (li_MenuItem ),&
This. MenuID. Item [li_MenuTitle]. Item [li_MenuItem]. Text)
Next
Next
The above script has no practical significance, but it illustrates a very useful technology, that is, how to traverse all non-cascade menu items in the menu.

From:

Http://hi.baidu.com/cwding/blog/item/0c770d7ad6440de82f73b301.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.