Paolo Mantovani wrote:
Hi,
sorry for reposting the same question, but I really need help.
If this is the wrong ML, please point me to the right one.
Thanks in advance for any information
Paolo Mantovani
Alle 16:06, lunedì 2 ottobre 2006, Paolo Mantovani ha scritto:
Hi all,
I can't found any specifications for the use of basic udt's, a part from a
small example in the OOBasic guide.
But perhaps there could be some recent documentation that I'm not aware.
Anyway I'm looking for the following information:
- Can I declare a type into an external library?
A userdefined datatype is valid on module level only (implicitly private).
You can implement functions like myLib.moduleUDT.getNewUDT() or
myLib.moduleUDT.makeUDT(Obj,sName,oListener,iCount) in order to "export"
your type.
Function getNewUDT() as myType
Dim retVal as new myType
getNewUDT = retVal
End Function
- Can I use public/private keywords in order to affect the UDT scope?
example Private Type MyUDT
..
...
End Type
- can I use an UDT as a result type for a basic function? example:
Type MyUDT
..
End Type
Function Test() as MyUDT
....
End Function
- Can I use an UDT as a parameter type into a basic sub or function?
example:
sub Test( myParam As MyUDT )
...
End Sub
- Can I use Basic UDT's as parameters for Windows API's as it usually
happens in VB/VBA ? (guess no)
I don't know.
- Can I declare an array as an UDT's member ? example
Type MyUDT
MyList(4) As Long
...
- Can I declare a fixed lenght string as an UDT's member ?
Type MyUDT
MyFixedString As String*6
...
Thank you very much for any information
Paolo Mantovani
No, you can't store arrays in structs, but you can store other
userdefined structs and uno-structs, just like other objects. Andrew
Pitoniak describes how to create nested structs in order to get
something like hashes (dictionaries).
If you need to preserve your struct as a global variable you have to
save it within an *variant*-array. It gets lost otherwise.
http://www.openoffice.org/issues/show_bug.cgi?id=52057
This may be used for implementing crude pseudo-classes in pure Basic,
but you have to write "constructors" and "destructors" by your own.
Type myType
S as String*5
Address as com.sun.star.table.CellAddress
'Elements(0) 'compile error
End Type
Global gType as myType 'gets lost
Global gTypes(0) as myType 'values in gTypes(0) get lost
Global gTypesVariant(0) 'values in gTypesVariant(0) are preserved after
execution
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]