Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Basic Realbasic > Re: Vb to Realb...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 6 Topic 3274 of 3321
Post > Topic >>

Re: Vb to Realbasic conversion

by Joe Strout <joe@[EMAIL PROTECTED] > Oct 23, 2007 at 08:51 PM

In article 
<4a44955b060c061759751cbf0388991f@[EMAIL PROTECTED]
>,
 "mhartman" <usa.mark@[EMAIL PROTECTED]
> wrote:

> Hello. How would I handle the below in Realbasic
> '
> '
> //Custom variable declaration
> Type Complex
> 	Real as Integer
> 	Imag as Integer
> End Type

A "Type" in VB is most literally like a "Struct" in RB, but I wouldn't 
recommend using Struct except in certain very special circumstances.  
Instead, I think you should make a Class with two properties, Real and 
Imag.  (And are you sure you don't want them to be type Double rather 
than Integer?)

> //--------------------------------
> 
> //Window 1 declarations and code
> 
> Dim Spectrum(-1) as Complex
> Dim Data(-1) As Integer

This is the same.  Though you'd declare these using the "New Property" 
command in the window's code editor.

> '
> //Usage---------------------------
> 
> Spectrum(5).Real = Data(5)
> Spectrum(5).imag = Data(10)

This usage is the same too.

> So far I have created a Class Titled "Complex" with the Shared
Properties,
> "Real" and "Imag" in it

Oops.  Nope, you don't want Shared properties here; those would be 
shared among all instances of the class.  You want regular old 
properties instead, so that every instance can have its own values.


Best,
- Joe

-- 
"Polywell" fusion -- an approach to nuclear fusion that might actually
work.
Learn more and discuss via: 
<http://www.strout.net/info/science/polywell/>
 




 6 Posts in Topic:
Vb to Realbasic conversion
"mhartman" <  2007-10-23 21:10:42 
Re: Vb to Realbasic conversion
Joe Strout <joe@[EMAIL  2007-10-23 20:51:25 
Re: Vb to Realbasic conversion
"mhartman" <  2007-10-24 09:16:01 
Re: Vb to Realbasic conversion
Joe Strout <joe@[EMAIL  2007-10-24 08:31:51 
Re: Vb to Realbasic conversion
"mhartman" <  2007-10-27 11:58:36 
Re: Vb to Realbasic conversion
Mac Dude <do@[EMAIL PR  2007-10-29 07:04:20 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Jul 8 23:13:04 CDT 2008.