Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
New Visual FreePro objects
Message
De
05/10/2013 17:47:24
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
New Visual FreePro objects
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01584824
Message ID:
01584824
Vues:
94
I wanted to convey some new syntax abilities defined in VXB++ for use in Visual FreePro. These relate to form objects, or class objects.

Traditionally, in order to access something one must at some point use the full form to obtain the reference:
thisForm.someObject1.someObject2.someProperty = "foo"

* This can be truncated for lots of use with WITH, or even:
lo = thisForm.someObject1.someObject2
lo.someProperty = "foo"
In Visual FreePro, a new property is added to every object, nameStatic. Like "name", it identifies the object. However, the nameStatic property doesn't change and can be duplicated if there exists more than one object of the same class. However, when there is only one object of the same class, or when the nameStatic values are all set to unique values, they can be referenced simply as:
thisForm!itsNameStatic.propertyOrMethod

* Example:
* Suppose the object above has the name "someObject2" and the nameStatic "myControl".
thisForm!myControl.someProperty = "foo"

* This can also be truncated to:
!myControl.someProperty = "foo"   && To access a property
!myControl.click()                && To access a method

* And it can be referenced from any object on the form.  So long as there is only one nameStatic
* somewhere, it will always find that exact control.

* Note:  Also, when referencing a nameStatic in a class, you can use "thisClass!nameStatic"
*        to access that particular instance.  Or if it's in a class that's referenced somewhere,
*        you can use "thisForm.myClass!nameStatic".
thisClass!nameStatic.someProperty = "foo"
thisForm.myClass!nameStatic.someProperty = "foo"

* And for a class that is a member of a parent form, class, or container object, you can
* use "thisContainer!nameStatic" to reference the item:
thisContainer!nameStatic.someProperty = "foo"

* Note:  You can also use thisClass and thisContainer as you would normally with
*        dots between each property, as like thisForm.
See this page for more information:
www.visual-freepro.org/wiki/index.php/VXB%2B%2B


-----
Note: My desire here is to introduce new abilities defined in VXB++ to be used in Visual FreePro as I encounter them from time to time in other posts. In this case, the ability to find a control is most likely straight-forward since it's most likely a top-level control. However, if it were part of a class it becomes more tricky requiring recursion.

Note: The purpose of nameStatic is to bypass this issue and make coding known things much simpler as the Visual FreePro IDE knows about nameStatic and will update it through SourceLight (the Visual FreePro name for its Intellisense-like ability).
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform