ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Windows functions / Project functions
  • 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)
PROCEDURE 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
Example PCSOFT
Exemplo de uso do EnumControl
Lista objetos da tela
Inclusive os sub objetos

j is int = 1
ResChamp is string
ResChamp = EnumControl(MyWindow.Name, j)
WHILE ResChamp <> ""
j++
Trace(ResChamp)
listeélément(MyWindow.Name+"."+ResChamp)
ResChamp = EnumControl(MyWindow.Name, j)
END


INTERNAL PROCÉDURE listeélément(NomElt)
i is int = 1
sResChampSousElt is string
sResChampSousElt = EnumSubElement(NomElt, i)
WHILE sResChampSousElt <> ""
i++
Trace(NomElt+"."+sResChampSousElt)
listeélément(NomElt+"."+sResChampSousElt)
sResChampSousElt = EnumSubElement(NomElt, i)
END
END


The Free Technical Support is entirely at your service.
Boller
14 Dec. 2023

Last update: 05/26/2022

Send a report | Local help