Discussion forum about PANORAMIC language

Mac, Windows & Android application development with PANORAMIC language
 
HomeFAQSearchRegisterMemberlistUsergroupsLog in
Latest topics
» Hello world.
by Mon Jun 19, 2017 1:37 am

» Biomorphes de PICKOVER
by Sun Jun 18, 2017 2:33 am

» In less than 10 lines of code
by Fri Jun 16, 2017 5:03 am

» Effect Dopler
by Fri Jun 16, 2017 3:29 am

» SuperEllipse
by Wed Jun 14, 2017 4:01 am

» Plants
by Wed Jun 14, 2017 3:38 am

» Mira's attractor
by Wed Jun 14, 2017 3:30 am

» Triangle of Sierpinski
by Wed Jun 14, 2017 3:22 am

» Esthétique polaire
by Wed Jun 14, 2017 3:16 am

» Butterfly effect : Lorenz equations
by Wed Jun 14, 2017 3:08 am

» Collision detection
by Tue Jun 13, 2017 5:09 am

» The Bees Laline Paull Epub Books
by Mon Oct 10, 2016 8:58 pm

» PANORAMIC for Mac OSX 10 is available
by Tue Aug 09, 2016 6:08 pm

» ide
by Sat Jul 16, 2016 12:27 am

» Can I change the program icon/logo in my application ?
by Thu Jul 07, 2016 3:32 am

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Share | 
 

 Refer to objects by name instead of number

View previous topic View next topic Go down 
AuthorMessage
treehouse

avatar

Number of posts : 10
Age : 56
Localisation : Yorkshire, UK
Registration date : 2013-10-16

PostSubject: Refer to objects by name instead of number   Thu Oct 17, 2013 2:44 pm

In Panoramic, the created objects are referred to by their ID number, which you first use to create them. This means that you have to remember which number refers to which object, or note them down in rem statements or something. It doesn't seem to have a function that allocates an ID automatically from the operating system, as some languages do.

So here's another way that might be of use.

Code:

' Referencing objects by variable name can be done by
' making them equal to an indexing variable (in this case i%)
' and increasing that by 1 before or after each object is created.
' This avoids having to remember or note the index numbers, and
' also means objects can be created in any order. If the order is
' changed, the numbers will change, but the "names" will not.
label inc
dim i%,scene%,tomato%,apple%,blueberry%
i% = 1
scene%=i%
scene3D scene%:full_space scene%
cam_position 5,0,2

gosub inc
tomato%=i%
3d_sphere tomato%,0.5
3d_color tomato%,140,20,0
3d_position tomato%,0.2,-0.5,-3
gosub inc
apple%=i%
3d_sphere apple%,0.9
3d_color apple%,5,180,10
gosub inc
blueberry%=i%
3d_sphere blueberry%,0.15
3d_color blueberry%,10,0,60
3d_position blueberry%,-1,-0.5,1
end

inc:
   i%=i%+1
return
Back to top Go down
View user profile
papydall

avatar

Number of posts : 39
Age : 67
Localisation : TUNISIA
Registration date : 2013-03-16

PostSubject: Re: Refer to objects by name instead of number   Thu Oct 17, 2013 3:07 pm

It is what we make on the French Forum.
We make something as:
Code:
DIM n%, MyvariableName%
n% = n% + 1 :  rem Create any object
n% = n% + 1 …..
….
n% = n% + 1 : MyVariableName% = n%

We increment the counter of objects and when we wish to use farther in the program this object, we give it a name.
It is almost the same thing as you have have make.

Thank you sunny sunny
Back to top Go down
View user profile
 
Refer to objects by name instead of number
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» program to provide total number of objects present / available on the page
» How Click on Dynamic Objects at Dynamic Positions in Selenium using for loop
» is it possible to find number of elements in an selectd xpath by selenium rc..?
» wrong number of arguments provided in nunit
» how to store number of rows of a table

Permissions in this forum:You cannot reply to topics in this forum
Discussion forum about PANORAMIC language :: Panoramic for Windows :: Source code (snippets)-
Jump to: