Hello,
For one example of conversion from Rose script to VB where type casting is involved, please see this solution: http://solutions.rational.com/solutions/display.jsp?solutionId=136402065 Please see the method: "IdentifyClass" available when using Visual Basic: theString = theRoseObject.IdentifyClass ( ) The method: "getPropertyClassName" is also very useful, and available in both Rose Script and VB: theClassNameAsString = theElement.GetPropertyClassName () Regards, Lara ========================================================================== Solutions knowledge base http://solutions.rational.com ========================================================================== ========================================================================== Lara Ziosi Technical Support Engineer Rational WW Customer Service Rational Software Phone: +31 (0)20 4546 200 Fax: +31 (0)20 4546 201 Beechavenue 30 -- 1119 PV Schiphol-Rijk The Netherlands Email: [EMAIL PROTECTED] http://www.rational.com/support ========================================================================== -----Original Message----- From: Neil Pitman [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 01, 2002 6:02 AM To: Lo, Tammy Cc: '[EMAIL PROTECTED]' Subject: Re: (ROSE) RoseItemView Hello Tammy, I haven't been using Rose automation for a while, but I think that what you see is natural. Downcasting is a function of the language not the object. CanTypeCast() and TypeCast() are the RoseScript solutions. Other languages have their own and they are not specific to Rose Automation. For example, in VB, I would simply set an on-error block and assign the object to a variable of the specific type. If it worked, I can merrily continue. If not, I'll end up in the error block and deduce that it was not really that type. You can put this in a separate function to simulate the CanTypeCast() and TypeCast(). Since I'm rusty, and I remember VB being a little tricky, you might actually have to DO something with the object before you get an exception. i.e. you will have to use a function. There are some other functions within VB to query the metadata, but the names escape me. I'll leave that as an exercise for the class, as they say. Java works similarly, but more sanely. I never used C++ to drive automation. Hope this helps. Happy Thanksgiving to Americans on the list. Lo, Tammy wrote: > Hi all > > I noticed that CanTypeCast() and TypeCast() are only available for Rose > scripting. Can I achieve the same result with other methods that are > available to Rose Automation? I would like to check a particular ItemView > to see if it can be type cast to a class view. And later on, typecast this > Itemview into class. In particular, I am using the sample script code > provided by Rational solutions. > > http://solutions.rational.com/solutions/display.jsp?solutionId=12372 > > Thank you so much for your help in advance > > Tammy -- Neil Pitman [EMAIL PROTECTED] +1.514.863.5465 ************************************************************************ * Rose Forum is a public venue for ideas and discussions. * For technical support, visit http://www.rational.com/support * * Post or Reply to: [EMAIL PROTECTED] * Subscription Requests: [EMAIL PROTECTED] * Archive of messages: * http://www.rational.com/support/usergroups/rose/rose_forum.jsp * Other Requests: [EMAIL PROTECTED] * * To unsubscribe from the list, please send email * To: [EMAIL PROTECTED] * Subject: <BLANK> * Body: unsubscribe rose_forum ************************************************************************* ************************************************************************ * Rose Forum is a public venue for ideas and discussions. * For technical support, visit http://www.rational.com/support * * Post or Reply to: [EMAIL PROTECTED] * Subscription Requests: [EMAIL PROTECTED] * Archive of messages: * http://www.rational.com/support/usergroups/rose/rose_forum.jsp * Other Requests: [EMAIL PROTECTED] * * To unsubscribe from the list, please send email * To: [EMAIL PROTECTED] * Subject: <BLANK> * Body: unsubscribe rose_forum *************************************************************************
