|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Declare fields in a structureI'm starting to convert a large VBA project into OOBasic, and it mostly looks straightforward; however, i've hit a stumbling block because I have a number of structures declared with arrays in them, and the OO compiler says I can't have arrays inside of structs. So I'm not at all sure how to work around this.
For example, I have these structures: Type FieldPairType fieldName As String fieldValue As String End Type Type FieldsListType fieldCnt As Integer fieldsAllocated As Integer fields() As FieldPairType End Type And I dynamically resize (ReDim) the fields array as required when working with this type. The compiler won't allow me to declare fields() inside the structure. There's got to be a way around this, but I don't see it yet. I guess i can turn FieldPairType into a class and then make fields a linked list of objects, but I've got more than a few structures that work this way, and that means a lot of extra work. Is there an easier way to handle a dynamically sized 'array' of values inside a structure in OO Basic? |
|
|
Re: Declare fields in a structureOn 08/22/2009 04:31 PM, sphiller wrote:
> I'm starting to convert a large VBA project into OOBasic, and it mostly looks > straightforward; however, i've hit a stumbling block because I have a number > of structures declared with arrays in them, and the OO compiler says I can't > have arrays inside of structs. So I'm not at all sure how to work around > this. > > For example, I have these structures: > > Type FieldPairType > fieldName As String > fieldValue As String > End Type > > > Type FieldsListType > fieldCnt As Integer > fieldsAllocated As Integer > fields() As FieldPairType > End Type > > And I dynamically resize (ReDim) the fields array as required when working > with this type. The compiler won't allow me to declare fields() inside the > structure. There's got to be a way around this, but I don't see it yet. I > guess i can turn FieldPairType into a class and then make fields a linked > list of objects, but I've got more than a few structures that work this way, > and that means a lot of extra work. > > Is there an easier way to handle a dynamically sized 'array' of values > inside a structure in OO Basic? > not know if this will work or not. i think that I tried this some years back, but I do not remember the outcome. -- Andrew Pitonyak My Macro Document: http://www.pitonyak.org/AndrewMacro.odt My Book: http://www.hentzenwerke.com/catalog/oome.htm Info: http://www.pitonyak.org/oo.php See Also: http://documentation.openoffice.org/HOW_TO/index.html --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
| Free embeddable forum powered by Nabble | Forum Help |