Login   /   Register

Constructor Arguments in VBScript!

October 10th, 2008 by Yaron Assa
     2 votes, average: 2 out of 52 votes, average: 2 out of 52 votes, average: 2 out of 52 votes, average: 2 out of 52 votes, average: 2 out of 5
Loading ... Loading ...

Our Class Inheritance Parser has just received a major update. Among the changes is the support for Constructor Arguments.

Most programming languages allow you to pass parameters when you create an instance of your class. These are called constructor arguments. VBScript’s constructor (the Class_Initialize sub) can not receive parameters, so usually we must resort to solutions as a “Build” or “Start” sub, in addition to the actual constructor, in order to relay the parameters.

Well, No more! The class parser allows support for constructor arguments in the most native and fluent manner.

Class Inheritance in VBScript – Now at your Doorstep!

October 4th, 2008 by Yaron Assa
     6 votes, average: 4 out of 56 votes, average: 4 out of 56 votes, average: 4 out of 56 votes, average: 4 out of 56 votes, average: 4 out of 5
Loading ... Loading ...

VBScript’s lack of class inheritance can be quite problematic for those of us who are using Classes regularly throughout our scripts. The attached file provides a parser which enables you to effectively use class inheritance in VBScript by placeing ‘ ParentClassName comments within your classes. The mechanism will:

1. Enable inheritance from multiple parents (just use multiple lines with Inherit comments)
2. Copies Properties, Variables, Functions and methods from the parent class to the derived class.
3. In case the derived class already has a code segment with the same name, the copied code-segment is changed to MyBase_. Inner segment placements are updated accordingly.
4. Enables inheritance through multiple hierarchies (e.g. GrandParent->Parent->Child inheritance). Circular inheritance protection. The order of appearance in the files is irrelevant, the parser will make sure the parent classes are parsed before their derived classes.
5. The parser has a major downside – as the technique uses ExecuteGlobal to load the processed classes into QTP, you cannot debug the code in mid-run.

Exploring Custom Controls (cont.)

March 30th, 2008 by Yaron Assa
     1 votes, average: 2 out of 51 votes, average: 2 out of 51 votes, average: 2 out of 51 votes, average: 2 out of 51 votes, average: 2 out of 5
Loading ... Loading ...

Reminder
Last time we implemented a tab navigation function for our custom control. We saw how to use the object-spy to locate “interesting” RO properties and methods, and how to switch to debug view to drill even deeper into the inner control structure. Today we’ll master these techniques to implement our second goal – pressing a […]

VBScript Nitpicking (the good kind) - part.2

March 30th, 2008 by Yaron Assa
     1 votes, average: 4 out of 51 votes, average: 4 out of 51 votes, average: 4 out of 51 votes, average: 4 out of 51 votes, average: 4 out of 5
Loading ... Loading ...

Possible ByRef catastrophes

The example from part 1 (regarding passing objects as ByVal parameters) might lead us to believe that when passing an object to a function, we shouldn’t care less if it’s passed ByVal or ByRef, as we’re passing the object’s reference in any case. Any change to the object within the function’s scope will […]

VBScript Nitpicking (the good kind) - part.1

March 30th, 2008 by Yaron Assa
     2 votes, average: 1 out of 52 votes, average: 1 out of 52 votes, average: 1 out of 52 votes, average: 1 out of 52 votes, average: 1 out of 5
Loading ... Loading ...

A very refreshing debate at SQAForums has really opened my eyes on the small details involved with Objects, Scopes and Procedure calls. I thought it was a good idea to write a summary of what went on there, and I took the opportunity and added a very detailed background about many basic terms that may […]