PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN

This content has been translated automatically. Click here to view the French version.
  • Comparing the instance of a class
  • Finding out the type of an advanced variable
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
The Property Class allows to know the real type of the class instance manipulated by an Variable of type object, variant or dynamic object type.
On the advanced types (gglxxx, rssxxx or xlsxxx variables), Class is used to find out the type of the variable.
Versions 22 and later
Java This property is now available for Java applications.
New in version 22
Java This property is now available for Java applications.
Java This property is now available for Java applications.
Example
// Déclaration de la classe de base CBase
CBase is Class
END
 
// Déclaration de la classe dérivée CDérive
CDérive is Class
inherits of CBase
END
 
// allocation d'un objet dynamique de type CBase
po is object dynamic = new CBase
// le type réel de l'objet dynamique est CBase:
// la trace affiche la chaîne "CBase"
Trace(po.Class)
 
// allocation d'un objet dynamique de type CDerive
po is object dynamic = new CDerive
// le type réel de l'objet dynamique est CDerive:
// la trace affiche la chaîne " CDerive "
Trace(po.Class)
Syntax

Finding out the type of the class instance Hide the details

<Result> = <Variable used>.Class
<Result>: Character string
  • Name of the class,
  • Empty string ("") if the dynamic object is not allocated.
<Variable used>: Name of variable
Name of variable (object, dynamic object or variant) to use.
Remarks

Comparing the instance of a class

The instance of a class can be directly compared to the name of the class (without using quotes).
For example:
IF po..Class = Classe1 THEN ...
Another example:
SWITCH po..Class
CASE Classe1:  ...
CASE Classe2: ...
END

Finding out the type of an advanced variable

The Property Class used on an advanced Variable allows to know the type of the Variable. The name of the type is returned in the language of the runtime framework (in French for a French version, in English for an international version).
To ensure a compatible code between the French and international versions, it is advised to compare directly the result of the Property Class to the desired type (without the quotes). For example:
IF v..Class = Cadre THEN
...
END
SWITCH v..Class
 CASE Cadre:
  ...
 CASE xlsLigne:
END
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment