[futurebasic] Re: [FB] a few more FBtoC questions

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 2008 : Group Archive : Group : All Groups

From: Brian Stevens <bstevens33@...>
Date: Sat, 4 Oct 2008 16:19:14 -0700
On Oct 4, 2008, at 3:04 PM, Mark Chappell wrote:

> First, one specifically for Robert P:     some years back (November  
> 2000) you wrote a very nifty numeric expression evaluator demo for  
> FB.  I shamelessly incorporated it into my program (well, there was  
> some shame ... I did ask Robert if this bit of plagiarism was OK  
> before proceding).    Unfortunately it doesn't work in FBtoC, at  
> least on intel machines as it has a bit of  PPC assembly language.   
> I think there are a few other issues that make it unworkable in  
> FBtoC generally, even on a PPC machine.   Robert.... any chance you  
> could update this?   I think it's very cool, and useful as well, but  
> my skills are waaaaay to minimal to fix it myself.
If this refers to the code at:

/* Donations*/Robert P 's Favorite Examples/Calculations/Expression  
Evaluator Folder

in a way it has already been updated. It is one of the primary  
ingredients in FBtoC's parsing.

> Second, I used some of Robert's suggested code to read text from a  
> container into a scrolling edit field created via a .nib file.  It  
> works well in nearly all respects:  it loads and shows the text,  
> lets me type new text or delete text, saves the changes back into  
> the container, and also lets me copy text and paste it elsewhere  
> (e.g., into a Word file).  However, it will not let me paste text  
> into the scrolling field.   Any explanation or solution for this?   
> It's not a biggie; mainly I'm curious.
Set up an application event handler.  Intercept the edit menu  
selections and use the TXN calls. Here is a snippet since you're only  

case _kHICommandUndo
TXNUndo( txtObject )
result = _noErr
case _kHICommandRedo
TXNRedo( txtObject )
result = _noErr
case _kHICommandCut
ignore = fn TXNCut( txtObject )
result = _noErr
case _kHICommandCopy
ignore = fn TXNCopy( txtObject )
result = _noErr
case _kHICommandPaste
ignore = fn TXNPaste( txtObject )
result = _noErr
case _kHICommandClear
ignore = fn TXNClear( txtObject )
result = _noErr
case _kHICommandSelectAll
TXNSelectAll( txtObject )

> Third, I haven't tackled the FinderInfo replacement issue yet, as  
> this isn't critical to my users.   But I would like to be able to  
> launch the app by double-clicking one of its (typed) data files, and  
> get the running app to load a double-clicked data file.   I've  
> looked over the drag-and-drop example and have to admit that for me  
> and my non up-to-date programming knowledge, it's utterly non- 
> intuitive.    Is there any simple FBtoC code for responding to a  
> double-clicked data file.

Use the code in the FBtoC examples at:

/Files/FinderInfo/FinderInfo Replacement.bas

That code combined with the appropriate plist entries for file types  
will allow the app to open files double clicked from the Finder. It  
will need to be tailored to your needs of course.