I've written a simple array-type object, and would like to be able to set a default getter and setter for the object. IOW, instead of (in VBScript) writing
MyArray.SetField(3,2) = "42"
I would be able to use (something like)
MyArray(3,2) = "42"
Although I've seen the "default action" possibility somewhere (Python IIRC), I do not even know if its possible in Windows (win32).
Question: Is it possible to define (in the typelib?) a default action (method, property) for an object ? And if so how ?
Property ID 0 will be the default value of an object.
Though it seems that there are a few pitfalls when accessing that default :
The below won't quite do what I thought it would (only figured that out
after displaying the "typename" of 'MyArray' :-\ ) :
MyArray = 42
I have to use
MyArray() = 42
now (calls the defined PropertyGet) returns its value,
throws an error. Trying to change the IDLs PropertyGet into a method causes a "duplicate definition" error. Not really funny, having to use two different notations for the same thing ...
Any ideas ?
Start by describing what you actually use for the default property.
Lol, the pot calling the kettle black (no offence ment).
Would you accept that I use the value 42 for it ? :-)
If not, what exactly are you asking for ? The IDL definition ? The code I wrote ? The way I try to access it from within VBScript ? Something
There's simply not enough information to see what went wrong.
As far as I can tell nothing goes wrong. Its just a question of how
to handle what I'm getting presented.
|Location:||Huddersfield, West Yorkshire, UK|
|Nodes:||8 (1 / 7)|