PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Enumerating Controls on a Tab?
Enumerating Controls on a Tab?
Débuté par Tom, 01 jan. 2009 23:10 - 2 réponses
Posté le 01 janvier 2009 - 23:10
Hi folks,
Anyone point me in the right direction for the syntax of looping thru controls on a Tab, I did it on a window using enumcontrol() but found out that this is no use if the controls are on a Tab.
Thanks
Tom
Posté le 01 janvier 2009 - 23:11
Hi Tom, the controls on a Tab sit on
WindowName.Tab[1].ControlName
otherwise a recursive enumeration will help:
Here's an enumeration for all elements of a window
// Fill the table with all window controls
// Entry:sParentName of parent element - in this case it is the Window's name!
Procedure FillAll(sParent)
// First window control
sControlName is string=EnumSubElement(sParent,enumFirst)
WHILE sControlName""
// Full control name
sFullName is string=sParent+"."+sControlName
// Retrieve the element type
nType is int={sFullName,indGPW}..Type

// If this is a control group or a tab
IF nType=typTab OR nType=typTable OR nType=typToolbar THEN
// List the controls placed inside
FillAll(sFullName)
ELSE
// No action if this is a MENU item
IF nTypetypMenuOption THEN
// Add the element to the table
AddElement(sFullName,nType,{sFullName,indGPW}..Caption,{sFullName,indGPW}..Group)
END
END
// Next control
sControlName=EnumSubElement(sParent)
END

Regards,
Guenter
Posté le 02 janvier 2009 - 11:27
Guenter,
Thank you very much works a treat!
Tom