[futurebasic] Re: [FB] Creating an OS X Dialog box

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 2006 : Group Archive : Group : All Groups

From: Bernie <fb.mailing.list@...>
Date: Mon, 18 Dec 2006 17:22:21 +0000
Max wrote:

> Any more thoughts.


- Copy the following code into an empty FB window, save it and build  
it - you'll have an app named TwentyTwenty.
- Drop the FB file with Stu's code onto the TwentyTwenty icon - a new  
FB file will be generated with the suffix "[2020]"
- Now try running the new file.

Bernie


'----------
output "TwentyTwenty"

local mode
local fn Create2020File( spec as ^FSSpec )
'~'1
dim as FSSpec spec1, spec2
dim as Str255 s
dim as short f

spec1 = spec
spec2 = spec1
spec2.name = spec1.name + "[2020]"
def open "TEXTFB^e"
open "I", 1, @spec1
open "O", 2, @spec2
do
line input #1, s
do
f = instr( 1, s, chr$(202) )
if ( f ) then s = left$( s, f - 1 ) + " " + mid$( s, f + 1 )
until ( f == 0 )
print #2, s
until eof(1)
close
end fn


local mode
local fn DoFinderInfo
'~'1
dim as FSSpec spec
dim as OSType @ fType
dim as short @ count, action, j

count = 0
action = FinderInfo( count, spec, fType )
long if ( count > 0 )
for j = -1 to -count step -1
action = FinderInfo( j, spec, fType )
long if ( action == _finderInfoOpen )
if ( fType == _"TEXT" ) then fn Create2020File( spec )
end if
next
fn ClearFinderInfo
end if
end
end fn

on FinderInfo fn DoFinderInfo

poke long event-8, 0xFFFFFFFF
do
HandleEvents
until 0
'----------