PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN

  • 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/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
The Class property is used to get the actual type of the class instance handled by an object, variant or dynamic object variable.
When used on advanced types (gglxxx, rssxxx or xlsxxx variables), the Class property gets the type of variable.
Versions 17 and later
iPhone/iPad This property is now available for iPhone/iPad applications.
New in version 17
iPhone/iPad This property is now available for iPhone/iPad applications.
iPhone/iPad This property is now available for iPhone/iPad applications.
Versions 21 and later
Apple Watch This property is now available in Apple Watch mode.
Universal Windows 10 App This property is now available in Universal Windows 10 App mode.
New in version 21
Apple Watch This property is now available in Apple Watch mode.
Universal Windows 10 App This property is now available in Universal Windows 10 App mode.
Apple Watch This property is now available in Apple Watch mode.
Universal Windows 10 App This property is now available in Universal Windows 10 App mode.
Versions 22 and later
Java This property is now available for Java applications.
Android This property is now available for Android applications.
Android Widget This property is now available in Android Widget mode.
New in version 22
Java This property is now available for Java applications.
Android This property is now available for Android applications.
Android Widget This property is now available in Android Widget mode.
Java This property is now available for Java applications.
Android This property is now available for Android applications.
Android Widget This property is now available in Android Widget mode.
Example
// Declare the base class named CBase
CBase is Class
END
 
// Declare the sub-class named CSub
CSub is Class
inherits from CBase
END
 
// allocate a dynamic object of BaseC type
po is object dynamic = new CBase
// the real type of the dynamic object is CBase:
// the trace displays the "CBase" string
Trace(po..Class)
 
// allocate a dynamic object of CSub type
po is object dynamic = new CSub
// the real type of the dynamic object is CSub:
// the trace displays the " CSub " string
Trace(po..Class)
Syntax

Finding out the type of the class instance Hide the details

<Result> = <Variable used>..Class
<Result>: Character string
  • Class name,
  • Empty string ("") if the dynamic object is not allocated.
<Variable used>: Variable name
Name of the object, dynamic object or variant variable to be used.
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 = Class1 THEN ...
Another example:
SWITCH po..Class
CASE Class1:  ...
CASE Class2: ...
END

Finding out the type of an advanced variable

When used on an advanced type, the Class property gets the type of 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 make sure the code to is compatible between the French and the international versions, directly compare the result of the Class property with the desired type (without quotes). For example:
IF v..Class = Border THEN
...
END
SWITCH v..Class
 CASE Border:
  ...
 CASE xlsRow:
END
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment