Getting string value from Text field: my 2.5 code stopped
working
Ruslan Zasukhin
sunshine at public.kherson.ua
Wed May 14 13:34:50 CDT 2008
On 5/14/08 8:44 PM, "Matthew Jew" <mjew at icnc.com> wrote:
Hi Matthew,
> (This is another version 2.5.8 to 3.5.2 issue).
>
> I have for years been using this code to retrieve my long text values
> from my TextFields:
>
> I_FldBlob_Ptr pBlobField = dynamic_cast< I_FldBlob* >
> (aHTMLTemplateTable->valueText.get());
> dataLength = pBlobField->get_DataSize();
> aMutableData = [[NSMutableData alloc] initWithLength:dataLength];
>
> Const_I_Value_Ptr myStringValue = aHTMLTemplateTable->valueText-
>> get_Value();
> unsigned long myStringLength = myStringValue->get_Length();
> myStringValue->get_String( (unichar *) [aMutableData mutableBytes],
> dataLength );
>
> returnValue = [NSString stringWithCharacters: (const unichar *)
> [aMutableData mutableBytes] length:myStringLength ];
>
>
> Although this compiles, now my application gets a EXC_BAD_ACCESS
> error on the get_DataSize() call.
>
> Is there a new way to do this?
Please try this line
I_FldBlob_Ptr pBlobField = QI( aHTMLTemplateTable->valueText, I_FldBlob );
QI is short cut for QueryInterface(), method good known in the COM.
This is kind of dynamic_cast<>, but based on COM mechanims.
We do not use try COM, we use its ideas
--
Best regards,
Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc
Valentina - Joining Worlds of Information
http://www.paradigmasoft.com
[I feel the need: the need for speed]
More information about the Valentina
mailing list