There were MANY good reasons to move from 9.0.0 to 9.0.1
After all, 9.0.0 DOES end with "0.0", right?
Announcement
Collapse
No announcement yet.
Another Class migration problem (sorry)
Collapse
X
-
For com programming it's good to move from 9.00 to 9.01.
There was a typelib issue which is solved as well, i find that specific issue an important one.
Leave a comment:
-
Jose:
Bingo! Yes, I'm still @ 9.00. I'm afraid I've always taken the approach of not upgrading software just because a new version is available. I've been burned in the past (not PB however) with upgrades causing problems, so I have a natural reluctance and upgrade when there's a specific fix / new feature I want.
This time it cost me. I guess there's no 'always win' condition.
George
(heading to Update-Land)
Leave a comment:
-
What am I missing?
Update your compiler (it's free) or change
Code:w = TabP.LTblBGet(1)
Code:[B][COLOR="DarkRed"]TYPE SET[/COLOR][/B] w = TabP.LTblBGet(1)
Leave a comment:
-
Petr:
Your sample gives me the same error. Are you saying it compiles clean for you?
Edwin:
I had just completed an almost identical UDT table (TblA) without problems. But on checking back, the actual METHOD to return the whole entry happens to not be called by the main line, just method calls to fetch/set individual fields of the UDT. So I hadn't actually done this successfully before.
The Help file says:
Methods may be declared (using AS type...) to return a string, any of the types, a specific class of object variable (AS MyClass), a Variant, or a user defined Type
So it says it should work. Petr says it works for him.
What am I missing?
George
Leave a comment:
-
Yes, this works, i found out my issue with dual interfaces and thus does not apply to this code:
(25:050): Incompatible with a Dual/IDispatch interface
Line 25: Method LTblBGet (ByVal ix As Long) As LCtlCmd
Leave a comment:
-
Hi,
can you compile this? I think it does what it should:
Code:TYPE LCtlCmd ' Final Line Command entry (After validation) SrcCmd AS STRING * 4 ' Source Command (C, M, CC, etc.) SrcFrom AS LONG ' Source Start Line number SrcTo AS LONG ' Source End Line number SrcRepeat AS LONG ' Source Repeat DstCmd AS STRING * 4 ' Dest Command (A, B, OO, etc.) DstFrom AS LONG ' Dest Start Line number DstTo AS LONG ' Dest Eend Line number DstRepeat AS LONG ' Dest Repeat END TYPE class myClass INSTANCE LTblB() AS LCtlCmd ' Complete line command list class method create() DIM LTblB(500) AS INSTANCE LCtlCmd ' Complete line command list ' -- Some init data LTblB(1).SrcCmd = "AHOY" end method interface myInterface inherit iUnknown METHOD LTblBGet (BYVAL ix AS LONG) AS LCtlCmd METHOD = LTblB(ix) END METHOD end interface end class function pbmain local TabP as myInterface TabP = class "myClass" LOCAL w AS LctlCmd w = TabP.LTblBGet(1) msgbox w.SrcCmd end function
Petr
Leave a comment:
-
I believe you can not return a custom variable, afaik it must be a com-compliant variabletype.
You can return a pointer though.
Btw, i was trying to do this for declaration:
Dim LTblB( 0 To 500 ) As Instance LCtlCmd
Then you would not redim it afterwards.
This is the same as i do like:
Dim LTblB( 0 To 500 ) As Local LCtlCmd
However, i can not make this instance dim to work, so this seems a two steps process after all.
Just curious..
Leave a comment:
-
Another Class migration problem (sorry)
I'm felling really noobyish but I'm stumped.
And yes I know extracts of pieces of code are more difficult but posting the whole program is just not possible:
I've been migrating to a more class oriented approach, and with a few stumbles, it has been going quite well. This was just another global table being converted, like others before it, but this one is balking.
I'm getting a data type mismatch on a method call and I'm stumped.
Here's some extracted stuff:
Code:In the equates etc. .INC file TYPE LCtlCmd ' Final Line Command entry (After validation) SrcCmd AS STRING * 4 ' Source Command (C, M, CC, etc.) SrcFrom AS LONG ' Source Start Line number SrcTo AS LONG ' Source End Line number SrcRepeat AS LONG ' Source Repeat DstCmd AS STRING * 4 ' Dest Command (A, B, OO, etc.) DstFrom AS LONG ' Dest Start Line number DstTo AS LONG ' Dest Eend Line number DstRepeat AS LONG ' Dest Repeat END TYPE In the Class definition .INC file INSTANCE LTblB() AS LCtlCmd ' Complete line command list in the constructor method of the class DIM LTblB(500) AS INSTANCE LCtlCmd ' Complete line command list In the INTERFACE section of the CLASS METHOD LTblBGet (BYVAL ix AS LONG) AS LCtlCmd: METHOD = LTblB(ix): END METHOD in a SUB in the main module (TabP is the created CLASS, works for all kinds of other METHOD's & PROPERTIES) LOCAL w AS LctlCmd w = TabP.LTblBGet(1) ' Copy 1st entry to work data Results in: Error 482 in D:\Public\DOCUME~1\SPFLite\SPFLIte4.BAS(3608:011): Data type mismatch Line 3608: w = TabP.LTblBGet(1)
GeorgeTags: None
Leave a comment: