Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Basic4ppc Wishlist > Bug Reports
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Bug Reports Post about errors or bugs encountered.

Re-declaring arrays of structures

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-29-2011, 11:27 AM
Basic4ppc Expert
 
Join Date: May 2008
Location: Berkshire, UK
Posts: 810
Awards Showcase
Beta Tester 
Total Awards: 1
Default Re-declaring arrays of structures

The B4PPC help says that arays can be re-declared anywhere in a program (to change the size). I have done this many times with simple arrays but now I try it with an array of structures I get a syntax error message (running under desktop IDE, so far).

With no caveat about this in the help, it must be a bug?

Mike.
Reply With Quote
  #2 (permalink)  
Old 12-29-2011, 12:55 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,701
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

Can you post the code that you are trying to run?
Reply With Quote
  #3 (permalink)  
Old 12-29-2011, 02:35 PM
Basic4ppc Expert
 
Join Date: May 2008
Location: Berkshire, UK
Posts: 810
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
Originally Posted by Erel View Post
Can you post the code that you are trying to run?
Thanks Erel.

Perhaps first you would download StellaFerox's Planetarium and try running it under the IDE and then tell me why it fails on the call frmMain.Polygon().

Then insert
Code:
Dim Type(X,Y) ArrayXY(0)
in the Sub Globals and
Code:
Dim Type(X,Y) ArrayXY(Orbit + 1)
just before the line
Code:
For JJ = J To J+Orbit Step Size
Of course if you can explain to me why my code is faulty without running it, that would be good too!

I have actually got it to work by using a 2D array instead of an array of structures, which is less readable although very similar (identical?) in operation though not in syntax. The complete modification of course requires two extra lines to set up the array content and a change of format of the frmMain.Polygon().

Regards, Mike.
Reply With Quote
  #4 (permalink)  
Old 12-30-2011, 08:45 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

I'm guessing but I am playing with the source of Basic4ppc and there is a bug in Polygon in the IDE in v6.90 that means that it doesn't accept Double arrays, Erel didn't quite finish converting it to accept Double as well as String arrays .
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.

Last edited by agraham : 12-30-2011 at 08:58 AM.
Reply With Quote
  #5 (permalink)  
Old 12-30-2011, 09:06 AM
Basic4ppc Expert
 
Join Date: May 2008
Location: Berkshire, UK
Posts: 810
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
Originally Posted by agraham View Post
I'm guessing but I am playing with the source of Basic4ppc and there is a bug in Polygon in the IDE in v6.90 that means that it doesn't accept Double arrays, Erel didn't quite finish converting it to accept Double as well as String arrays .
Hi Andrew, thanks for looking. But on the face of it that doesn't explain how I got it to work using a 2D array rather than array of structures.

BTW I shall check with StellaFerox that it is OK to publish a slightly impproved, and still working, version of his source plus executable. Within his original thread to make the provenance clear.

Cheers (Happy New Year) Mike.
Reply With Quote
  #6 (permalink)  
Old 12-30-2011, 11:27 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

I had to go out but now I am back I have downloaded StellaFerox's Planetarium and don't get any error on the call to Polygon as he is using ArrayLists not arrays. What error do you get?

To redeclare your type you need to do

Dim ArrayXY(Orbit + 1, 2)

The "2" is the number of elements of the Type.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #7 (permalink)  
Old 12-30-2011, 12:22 PM
Basic4ppc Expert
 
Join Date: May 2008
Location: Berkshire, UK
Posts: 810
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
Originally Posted by agraham View Post
I had to go out but now I am back I have downloaded StellaFerox's Planetarium and don't get any error on the call to Polygon as he is using ArrayLists not arrays. What error do you get?

To redeclare your type you need to do

Dim ArrayXY(Orbit + 1, 2)

The "2" is the number of elements of the Type.
Thanks Andrew, but I thought that I had tried that variation, despite the fact that it conflicts with my original Global declaration of ArrayXY as a structure. If that is how it must be done then there should have been a warning in the Help!

On the matter of the ArrayList, I reported my problem, including error screen-shot, in an earlier thread which perhaps no-one read: http://www.basic4ppc.com/forum/share...html#post75179.

I don't understand what the problem is; I'm using the beta version of 6.90. Maybe I should try an older version since I thought I had used ArrayLists myself in a similar context (but maybe not with Polygon).

Mike.
Reply With Quote
  #8 (permalink)  
Old 12-30-2011, 12:33 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by mjcoon View Post
despite the fact that it conflicts with my original Global declaration of ArrayXY as a structure
Types are translated into arrays so there is no conflict.

Quote:
I don't understand what the problem is; I'm using the beta version of 6.90
If it's a beta and not the final release its probably a bug that was fixed later, though as I said there is still a bug in Polygon in the final v6.90 release. Polygon was extensively altered to accept Number arrays as well as String arrays and arrayLists.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
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 Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble declaring a subclass that extends AsyncTask thedesolatesoul Libraries developers questions 7 08-20-2011 07:08 PM
Declaring view gjoisa Basic4android Updates and Questions 1 01-19-2011 03:23 PM
Question about structures derez Beta Versions 2 03-04-2010 12:44 PM
Declaring array size Saj Questions (Windows Mobile) 3 07-30-2009 07:22 PM
Legal Structures ?? adbftrainer Questions (Windows Mobile) 9 09-09-2008 05:54 PM


All times are GMT. The time now is 03:05 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0