[futurebasic] Re: [FB] RTFtoTXT using Objective-C in FB5

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : July 2009 : Group Archive : Group : All Groups

From: Ken Shmidheiser <kshmidheiser@...>
Date: Thu, 9 Jul 2009 18:54:38 -0400

Well, I solved my problem by outputting to the main window, but it  
looks kinda clunky to me. I assume when you've installed a handler,  
you have to explicitly call the window that contains control/s you  
may be working with.

I left the test code in this to let the list see how I handled the  
troubleshooting, I stepped through the code and printed the output of  
each variable to a test window.

Thanks again for the heads up on the NavDialog. The code certainly is  
streamlined in FB5. Do you foresee the time when the FB File$ command  
is converted to a NavDialog?


local fn MyGetFileHandler( reply as ^NavReplyRecord, userData as  
pointer )
dim as CFUrlRef     url
dim as CFDataRef    dataRef
dim as CFStringRef  cfStr
dim as OSErr        err
// dim as Str255     s
dim as Boolean    ignore

NavDialog_CopyItemCFURLRef( #reply, 1, @url )
long if ( url )
ignore = fn CFURLCreateDataAndPropertiesFromResource 
( _kCFAllocatorDefault, url, @dataRef, #0, 0, #0 )
long if ( ignore )
CFRelease( url )
long if ( dataRef )
cfStr = fn CFStringWithRTFData( dataRef )
CFRelease( dataRef )
long if ( cfStr )
//ignore = fn CFStringGetPascalString( cfStr, @s, 256,  
_kCFStringEncodingMacRoman )
//window 2 : print s : window _mainWnd

// Here's the fix:
window output _mainWnd

err = fn SetControlData( button&( _rtfEUTC ), _kControlEditTextPart,  
_kControlStaticTextCFStringTag, sizeof( CFStringRef ), @cfStr )
end if
end if
end if
end if

end fn