Hi,
For me array support is enough to cover passing arrays to
OLE calls and maybe getting back arrays from OLE calls.
I've implemented some limited support for arrays. It's enough for the
simplest OpenOffice oDesktop:loadComponentFromURL() calls. Though, I do
not have more tests for multidimensional array parameters, or array
return values.
See, new hbole/tests/testole.prg -> OpenOffice Writer test. It creates
table and formating inside Writer.
Full support in hbwin (xhb) is quite strange, f.e. there is such
code in testole.prg:
[ #xtranslate :<!Method!>( <args,...> ) := => :<Method>( <args> ):Value := ]
#1 oAS:Cells( 3, 1 ) := "Explict DEFAULT Method Text:"
#2 oAS:Cells[ 2, 3 ] += "!"
#3 oAS:Cells( 4, 1 ):Value := "Numeric:"
Three different ways next to each other to express the same thing,
quite unclean. We should probably employ a syntax which works
properly in all situations, whatever that syntax might be. Pbly array
assignment is the one, but I also trust your judgement.
#1 requires PP hack, it also has some side effects.
The real type of oAS:Cells(3,1) is object (HB_OLEAUTO to be precise). #1
look like a attempt to assign string value to object.
Using PP hack
oAS:Cells( 3, 1 ) := "Explict DEFAULT Method Text:"
will work, but
oI := oAS:Cells( 3, 1 )
oI := "Explict DEFAULT Method Text:"
will not work.
Another problem is, that
oAS:Cells( 3, 1 ) := "Explict DEFAULT Method Text:"
? oAS:Cells( 3, 1 )
will not print anything because oAS:Cells(3,1) is object! So, I want to
avoid automatic/hidden :Value property implementation and suggest to use
:Value explicitly. This will help to avoid side effects also.
#2 is hidden :Item() method call, for ICollection interface. You can
always do:
oAS:Cells:Item(2):Item(3)
instead of
oAS:Cells[2,3]
but oAS:Cells[2,3] is also a object, not a value of the cell, so most
side effect for #1 ir valid for #2 also.
One more thing is that OLE uses different (aka column based, Fortran)
array index order. So,
oAS:Cell[2, 3]
is equivalent to:
oAS:Cells(3, 2)
Notice a different index order. These are the reasons, why I do not want
implement array access operator. Those who want to reach the exact array
access action can call a documented :Item() method of ICollection.
Array assignment causes even more problems!
So, I left a valid #3 and changed testole.prg to work using this syntax.
Regards,
Mindaugas
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour