Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sun Nov 19, 2017 11:15 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: With ... End With
PostPosted: Sat Oct 20, 2012 3:49 pm 
Offline
User avatar

Joined: Thu Dec 29, 2011 6:46 pm
Posts: 191
Location: Edmonton, AB, Canada
Is there anything as "With ... End With", how should re-write this code in RealBasic ?

Dim n As Long
If Rnd * 32 > 1 Then Exit Sub
n = getPt
If n = ptMax Then Exit Sub
With pt(n)
.v = True
.t = 0
.x = Int(Rnd * 480) + 16
.y = -16
.dy = 0
.r = 16
.p1 = 5
End With

_________________
Regards,
TomazVDaSilva


Clean Code: Robert C. Martin
It is not the language that makes programs appear simple.
It is the programmer that make the language appear simple!


Top
 Profile  
Reply with quote  
 Post subject: Re: With ... End With
PostPosted: Sat Oct 20, 2012 4:07 pm 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
Change the code. there is no with in RB.

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: With ... End With
PostPosted: Sat Oct 20, 2012 4:17 pm 
Offline

Joined: Mon May 30, 2011 12:56 am
Posts: 702
dim TheThing

theThing = pt(n)

theThing.v = True
theThing.t = 0
theThing.x = Int(Rnd * 480) + 16
theThing.y = -16
theThing.dy = 0
theThing.r = 16
theThing.p1 = 5


Top
 Profile  
Reply with quote  
 Post subject: Re: With ... End With
PostPosted: Sat Oct 20, 2012 4:20 pm 
Offline
User avatar

Joined: Thu Dec 29, 2011 6:46 pm
Posts: 191
Location: Edmonton, AB, Canada
Thank You, disregard the same question I did before I saw your answer.

_________________
Regards,
TomazVDaSilva


Clean Code: Robert C. Martin
It is not the language that makes programs appear simple.
It is the programmer that make the language appear simple!


Top
 Profile  
Reply with quote  
 Post subject: Re: With ... End With
PostPosted: Sat Oct 20, 2012 4:23 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
But note that you cannot convert an integer to an object reference. Return a pt from getPt and modify your test against ptMax somehow. I really can't recommend anything without more information.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group