PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US

  • Reason
  • Correction
  • Examples
  • Calling a method of a class instance in the click code of a button
  • Using a global class member in the click code of a button
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
Error 1001: The operators: and:: can only be used in the methods of classes
Reason
You are trying to use the ':' and '::' operators at the beginning of a code line that does not belong to a class process.
Reminder:
  • The ':' character is used to access a member or a method of the instance of the current class or base class.
  • The '::' characters are used to access a member, a method or a global constant of the current class or base class.
Correction
  • To access a member or a method of a class instance from a code that does not belong to this class (or to a derived class), the member or the method must be prefixed by the variable corresponding to the instance of the class.
  • To access a member, a method or a global constant of a class from a code that does not belong to this class (or to a derived class), the member (the method or the constant) must be prefixed by the name of the class.
Examples

Calling a method of a class instance in the click code of a button

Code triggering the error
// -- Click code on BTN_Button1
clInstance is Class1
:Méthod1()
Possible correction
Prefix the method by the name of the instance.
// -- Click code on BTN_Button1
clInstance is Class1
clInstance:Method1()

Using a global class member in the click code of a button

Code triggering the error
// -- Click code on BTN_Button1
::GlobalMember1 = 5
Possible correction
Prefix the member by the name of the class.
// -- Click code on BTN_Button1
Class1::GlobalMember1 = 5
Minimum required version
  • Version 0
This page is also available for…
Comments
Click [Add] to post a comment