About the author
While working on a support case involving StarTeam and CaliberRM, I had to write a program to see which of the following scenario is true:
So guess what language I chose to use? Delphi! ;o)
Given:
var Folders: IStCollection; V: OleVariant;
and that Folders has an Items default property returning a IStCollection,
I had to cast Folders[ItemIndex]: OleVariant to another interface, IStFolder (var Folder: IStFolder)
So, I tried this:
Folder := Folders[ItemIndex];
and got “[Pascal Error] StarTeamFolderEnumerator.pas(70): E2010 Incompatible types: 'IStFolder' and 'OleVariant'”.
And this:
Folder := Folders[ItemIndex] as IStFolder;
and got “[Error] StarTeamFolderEnumeratorImpl.pas(61): E2015 Operator not applicable to this operand type”.
My good friend, Tim to the rescue again! It turns out that I have to cast Folders[ItemIndex] to an IDispatch first, before casting it to an IStFolder, because Folders[ItemIndex] is an OleVariant, which, in this case, is just an IDispatch.
V := Folders[ItemIndex];Folder := IDispatch(V) as IStFolder;
Tim explains,
“
”
Continued discussion of undocumented Delphi 8 Property Access Specifiers, and other ways of adding and removing delegates / events handlers, including clearing the list of all the delegates / event handlers.