TweetFollow Us on Twitter

Oct 94 Top 10
Volume Number:10
Issue Number:10
Column Tag:Think Top 10

Think Top 10

By Mark B. Baldwin and Craig Connor, Symantec Technical Support

This is a monthly column written by Symantec’s Technical Support Engineers intended to provide you with information on Symantec products. Each month we cover either a specific application of tools or a “Q&A” list.

Q. Can pointers to base classes be cast as pointers to derived classes?

A. Yes. Run-Time Type Identification (RTTI), allows the safe casting of base class pointers to derived classes. If the cast is not allowed, a NULL pointer is returned.

Q. How come I get an error when I declare a variable of any type with the name 'v' or 'h'?

A. There’s an enumeration in Types.h that looks like:

     
     enum { h, v };
     

which clutters the namespace for both h and v.

Q. Using TCL, when I create a series of CEditText panes in a window, why are they placed at seemingly random places on the screen?

A. The coordinates that you are setting for your CEditText object are not being interpreted as window coordinates. Have your object call FrameToWindR(Rect *windowCoordinates). This will adjust the frame of the pane to the correct position on the screen.

Q. Why doesn’t the example in the manual for CArrayIterator work? I get the following:

     File "CPtrArrayIterator_myClass.cp"; Line 7
     Error:   'gAncestors' is not a member of struct 
     'CPtrArrayIterator<myClass>'
     
     File "CPtrArrayIterator_myClass.cp"; Line 9
     Error:   unable to open input file 'CPtrArrayIterator.tem'

A. The example in the manual for CArrayIterator is incorrect. 1) Remove the line for TCL_DEFINE_CLASS. You do this because the base class for CArrayIterator is not an RTTI class. 2) Remove the #include CArrayIterator.tem. This file does not get created because you are no longer calling TCL_DEFINE_CLASS.

Q. How do I change the foreground/ background color of a CStaticText?

A. Instantiate a pointer to your CStaticText object, or if you are using VA, find where the object pointer is created in x_CMain. Then use the following formula:


/* 1 */
((*CColorTextEnvirons)myCStaticText->itsEnvirons)
 ->SetColorInfo(*RGBColor forecolor, *RGBColor backcolor);  

Notice we cast from a base to a derived class CEnvrirons to a derived class CColorTextEnvirons.

Q. How do I read in a CBitMapPane?

A. Try the following code segment. It reads a bitmap from a file and assigns it to a CBitMapPane object.

     
/* 2 */
    CPNTGFile   *theFile = NULL;
    SFTypeList  myList;
    SFReply theReply;
    Point   where;
     
    where.h=120;  where.v=190;  // SF dialog window position
             
    myList[0]='PNTG';
         
    SFGetFile(where,0,NULL,1,myList,0,&theReply);
         
    if(theReply.good)
    {
        theFile = new CPNTGFile;   // Make a File object and read the
        theFile->SFSpecify(&theReply);// data into a new BitMap
        theFile->Open(fsRdWrPerm);
        theBitMap = ((CPNTGFile *)itsFile)->ReadNewBitMap(TRUE);
     
        myBitMapPane->SetBitMap(theBitMap);
    }

Q. How do I use VA to make CIconButtons work like radio buttons? It works when I do a Try Out, but then the code is not generated.

A. Version 7.0.3 fixes this problem. Download the 7.0.3 Patch from an on-line service.

Q. How do I make a PICTGrid in a Window using VA?

A. Create the window you want to use. Temporarily create a tear-off menu view, and copy the PICTGrid from the menu, and paste it into your window. Then delete the tear-off menu.

Q. Everytime I create a VA project it takes a very long time to compile. How can I reduce the compile time?

A. Open the “Project Models:Visual Architect:@1.1” file, and compile it. From now on, the TCL files will be compiled upon the creation of a new VA project.

Q. How do I add a new project type to the project models that appear in the New Project Dialog?

A. Create a new project, include the files and libraries you want, compile it, and copy the whole folder over to the Project Models folder. Name the project file “@1.1”. The “@1” will be replaced with the project name you specify. If you have trouble, take a look at the existing project models to see the naming convention for the project files.

Special Thanks To

Steve Howard, Michael Hopkins, Colen Garoutte-Carson, Rick Hartmann, Kevin Irlen, Yuen Li, Celso Barriga, Scott Shurr, and Chris Prinos, et al.

 
AAPL
$570.56
Apple Inc.
+0.00
MSFT
$29.11
Microsoft Corpora
+0.00
GOOG
$609.46
Google Inc.
+0.00
MacTech Search:
Community Search:

Are You Smarter Than A 5th Grader? &...
Are You Smarter Than A 5th Grader? & Friends Free Review By Jennifer Allen on May 24th, 2012 Our Rating: :: LACKINGUniversal App - Designed for iPhone and iPad An underwhelming use of a great franchise.   | Read more »
Fruit Ninja Gets New Update With Powerup...
Fruit Ninja is about to get its biggest update yet to celebrate its second anniversary on Thursday, May 24th. The key new element in the game appears to be that players will now be able to earn an in-game currency, called starfruit, that can be used... | Read more »
Fotor – CameraBag Review
Fotor – CameraBag Review By Jennifer Allen on May 23rd, 2012 Our Rating: :: PLENTIFULiPhone App - Designed for the iPhone, compatible with the iPad A photography app that wants to be able to do everything that could ever be asked... | Read more »
playGO AP1 is the Next Generation of Aud...
With all of Apple’s relatively recent success in the smartphone and tablet market, we can forget sometimes that what kicked off their modern dominance was a device that simply played music. BICOM, Inc. has been recognizing how important music is to... | Read more »
Monkey Pong Review
Monkey Pong Review By Angela LaFollette on May 23rd, 2012 Our Rating: :: BALL BUSTING ACTIONiPhone App - Designed for the iPhone, compatible with the iPad Help the hungry monkey reach all the fruit by bouncing a ball in this family... | Read more »
Heroes & Generals Enters Closed Beta
Creators of Hitman, Roto-Moto, has launched a closed beta of their game, Heroes & Generals. The game is a massively multiplayer first-person shooter involving online fighting between the Axis and Allied forces in Europe. | Read more »
FeedFriendly Review
FeedFriendly Review By Angela LaFollette on May 23rd, 2012 Our Rating: :: EASY TO USEUniversal App - Designed for iPhone and iPad Combine the top three social network newsfeed updates into one location with the help of FeedFriendly... | Read more »

Price Scanner via MacPrices.net

Are You Sure You Really Want A Retina Display MacB...
Apple didn’t invent the laptop computer, but over the past 21 years they’ve continuously set and reset the bar for laptop innovation and engineering advances, with PC competitors mostly playing catch... Read more
Two PC Pundits Weigh In On PC To Mac Switching (Or...
ZNet’s Stephen Chapman and Forbes’ Brian Caulfield have posted recent blogs on the topic of their personally switching from Windows PCs to Macs. From PC to Mac 10-Months Later ZNet blogger Stephen... Read more
Apple Maintains Top Mobile PC Share in Q112 on Str...
Apple shipped nearly 17.2 million mobile PCs in Q112, accounting for 118% year-over-year shipment growth, according to preliminary results from the latest NPD DisplaySearch Quarterly Mobile PC... Read more
Apple offering refurbished 17″ MacBook Pros for $3...
 The Apple Store has Apple Certified Refurbished 17″ 2.4GHz MacBook Pros available for $2119 including free shipping. That’s $380 off the price of new models. Apple’s one-year warranty is standard. Read more
Week’s Best MacBook Deals
We’ve posted the Week’s Best Deals on MacBook Airs and MacBook Pros for Wednesday, the 23rd of May. Find the lowest price or the best set of bundles from Apple’s Authorized Resellers with these deals... Read more
MacBook Airs on sale for up to $101 off MSRP, free...
 Adorama has MacBook Airs on sale today for up to $101 off MSRP including free shipping. NY and NJ sales tax only. Their prices are among the lowest available for these models from any Apple... Read more
Open-box special: 2.3GHz Mac mini for $493
MacMall has open-box return 2.3GHz Mac minis available for $493 including free shipping. That’s $106 off MSRP. Apple’s one-year warranty and all materials are included. Act now if you’re interested,... Read more
Apple iPhone Charger’s Secrets And Engineering Sup...
Blogger Ken Shirriff’s has posted a thoroughgoing Apple iPhone charger teardown and analysis, the one-line takeaway being: “quality in a tiny expensive package.” Shirriff says that disassembling... Read more

Jobs Board

MAC Imaging/Packaging, Administration.Pr...
Skills: Very good experience in building MAC ( Apple Macintosh ) operating system images. OS imaging Knowledge on ... Knowledge on configuring the LAN and Wireless network on MAC note books Knowledge... Read more
*Apple* Solutions Consultant-Retail Sal...
Requisition Number 15545402 Job title Apple Solutions Consultant-Retail Sales Location Mobile Country United States City Mobile State Alabama Job type Job description Read more
iPhone Developer at Mastech (Los Angeles...
We are currently seeking an Android/ iPhone Developer for our client in the Insurance domain. We value our professionals, providing comprehensive benefits, exciting challenges, and the opportunity... Read more
24 funny 2d Charaters for iPhone game. a...
We are developing an iPhone game and desire to have 24 characters drawn to our specification. Attached is the detailed spec. Desired Skills: Cartoon, Illustration Read more
*Apple* Solutions Consultant-Retail Sal...
Requisition Number 15545261 Job title Apple Solutions Consultant-Retail Sales Location Spanish Fort Country United States City Spanish Fort State Alabama Job type Job Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.