Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Structures & Uppercase


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-05-2008, 11:27 AM
Junior Member
 
Join Date: Dec 2007
Posts: 43
Default Structures & Uppercase

Hello Erel,

perhaps is something already know, but I noticed this behaviour in B4PPC.
if you declare in Sub Global

Dim Type(a,b,c,d) pippo

the right panel displays under Global Variables
pippo: Structure

if you declare instead in Sub Global

Dim Type(a,b,c,d) Pippo '(uppercase)

the right panel displays under Global Variables
pippo: Array

Is any reason for that?

May I use the declared structure (eg: pippo) as a standard Data Type to dim/redim other arrays?

Many thanks
Mimmo
Reply With Quote
  #2 (permalink)  
Old 02-05-2008, 11:50 AM
Junior Member
 
Join Date: Dec 2007
Posts: 43
Default

I forgot one question:

The help says (under DIM): "The same array can be declared many times and its size can be changed"

I tried with an array of structure

Sub Globals
Dim Type(a,b,c,d) pippo(0) 'empty array
End Sub

then in AppStart I tried to redim the array

Sub AppStart
'--- Dim Type(a,b,c,d) pippo(50) '----> Syntax error
Dim pippo(50) '----> works

but when I assign a value

pippo(10).a="xxxxx"

i got an error message "Indices lenght does not match the array rank".

Many thanks for your help

Mimmo
Reply With Quote
  #3 (permalink)  
Old 02-06-2008, 05:56 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,334
Default

The Array description in the right panel is a bug. It should show Structure in both cases.
One dimension structures are actually two dimensions arrays.
To redim the structure you should use:
Code:
Dim pippo(50,4) '4 is the number of fields.
Reply With Quote
  #4 (permalink)  
Old 02-06-2008, 06:54 AM
Junior Member
 
Join Date: Dec 2007
Posts: 43
Default

Many thanks Erel!

I did'nt tested it, but I hope the bug is only cosmetic and the defined structure will be treated as a structure along the source code.

Your tip about redim is welcome. Just as a little remind for future B4P versions, I would suggest the possibility to define a structure of structures as in VB

Dim Type (a,b,c) MyStruct
Dim Type (c,d,e,MyStruct) NewStruct

NewStruct.c=123
.....
NewStruct.MyStruct.a="xxxxxxxx"
NewStruct.MyStruct.b="zzzzzzzz"
NewStruct.MyStruct.c="yyyyyyy"

Thanks again for your help.

Mimmo
Reply With Quote
  #5 (permalink)  
Old 02-06-2008, 07:00 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,334
Default

This bug only affects the description in the right panel. Not the actual behavior of the structure.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Legal Structures ?? adbftrainer Questions & Help Needed 9 09-09-2008 06:54 PM
Create an array of structures serge Questions & Help Needed 1 06-21-2008 08:55 PM
Uppercase ! superbabicka Questions & Help Needed 5 04-09-2008 10:04 AM
How to redimension an array of structures HARRY Code Samples & Tips 3 02-20-2008 12:53 PM
lowercase 2 uppercase kavka Questions & Help Needed 1 01-12-2008 10:25 PM


All times are GMT. The time now is 02:06 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0