PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Listing the main menus of a window
EnumSubElement (Example)
Listing the main menus of a window
This example is used to list the options found in the the drop-down menus of a window. A recursive procedure is used.
// Call to the recursive procedure
FillMenu(MyWindow..Name)
PROCÉDURE FillMenu(sParent, nLevel is int = 0)

// Enumerate the menu options
sOption is string = EnumSubElement(sParent, enumFirst + enumMainMenu)

// The name of the main menu must not be specified
IF nLevel = 0 AND sOption <> "" THEN
FillMenu(sParent + "." + sOption, nLevel + 1)
RETURN
END

WHILE sOption <> ""

// Full name of the menu option
sFullName is string = sParent + "." + sOption

// Add the menu option
IF {sFullName,indGPW}..Type = typOptionMenu THEN
Trace(sFullName, typMenuOption, {sFullName,indGPW}..Caption, "", nLevel)
END

// Options of higher level
FillMenu(sFullName, nLevel + 1)

// Next option
sOption = EnumSubElement(sParent)
END
Minimum version required
  • Version 16
This page is also available for…
Comments
Click [Add] to post a comment