Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 14 in printed book and digital formats -- plus a one-year subscription so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

PDF:

Beginner's Corner

Typecasting

Working with datatypes

Issue: 7.4 (May/June 2009)
Author: Marc Zeedar editor-at-rbdeveloper.com
Article Description: No description available.
Article Length (in bytes): 10,439
Starting Page Number: 46
RBD Number: 7414
Resource File(s):

Download Icon 7414.zip Updated: Friday, May 1, 2009 at 11:37 AM

Related Link(s): None
Known Limitations: None

Excerpt of article text...

In last issue's Beginner's Corner, I wrote about working with windows. One feature involved building a menu of open windows where I saved the window's reference into a menuitem's tag property. I did this with code that looked like this:

docWindow(wmenu.tag).show

A reader wrote with a question about this and I realized that I probably glossed over an interesting topic. The above code confused the reader because the syntax makes it appear as though I'm passing wmenu.tag as a parameter to docWindow. That's not at all what's happening, but since the syntax is the same as passing parameters to functions, it certainly is confusing. I know when I first ran into this I found it bewildering.

Typecasting

What we are doing here is called typecasting. It's the conversion of data from one type to another. There are two types of typecasting. Most of us are so familiar with the implicit type that we aren't even aware of it. Think about the following code:

dim pi as double = 3.14159265359

...End of Excerpt. Please purchase the magazine to read the full article.

Article copyrighted by REALbasic Developer magazine. All rights reserved.


 


|

 


Weblog Commenting and Trackback by HaloScan.com