PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → How to iterate through controls of a window and determine the type of control?
How to iterate through controls of a window and determine the type of control?
Débuté par meikl, 14 aoû. 2023 10:06 - 4 réponses
Membre enregistré
127 messages
Posté le 14 août 2023 - 10:06
as title

pseudo code (not possible)

For Each Control C IN MyWindow
SWITCH C..ControlType
CASE typButton:
//do something
CASE typTable:
//do something
CASE typText:

etc...


thanks

meikl ;)
Message modifié, 14 août 2023 - 10:25
Posté le 21 août 2023 - 07:53
To iterate through controls of a window and determine their type, you can use a loop to access each control and check its type using the GetType() method or the is operator. By using conditional statements or switch cases, you can perform specific actions based on the control type.
https://www.tellpopeyes.biz/
Membre enregistré
127 messages
Posté le 21 août 2023 - 15:38
thanks victor :thank you:

but, i don't find any document about GetType() at PCSoft Help nor it is recognized in the PCSoft Code-Editor :(

can you give a small running samplecode?
Posté le 29 août 2023 - 22:42
Hi Meikl

If you are still working on this, try the code below:

nSubscript is int = 1
sControlType is string
sNameChildControl is string
c is Control

sControlInfo is string = gpwEnumControl("WIN_TestCode", nSubscript)
WHILE sControlInfo <> ""
Trace(sControlInfo)
Switch ExtractString(sControlInfo, 3, TAB) //
Case typButton
//Button code
Case typTable
//Table code
Case typText
//text code
end

c <- {sNameChildControl,indControl} //Assigns the current code to c so it can be manipulated

nSubscript += 1
sControlInfo = gpwEnumControl("WIN_TestCode", nSubscript)

end

How this helps
Simon Phillips
Membre enregistré
127 messages
Posté le 30 août 2023 - 11:26
Thanks Simon :)
Helps a lot