[futurebasic] Re: [FB] Displaying text with a Text Handle

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

From: Steve Crossman <mactech@...>
Date: Sat, 14 Jan 2006 16:34:32 -0500
one that i use to read a text file into a handle

Dim As FSSpec   f
Dim As Handle   h
Dim As Long    finish, fSize, strLen
Dim As Pointer start
Dim As Str255  tempStr

local fn import_file ( filename1 as str255, file_vol )

long  If Len( Files$( _FSSpecOpen, "TEXT","Select the Data file to  
Import", f ) )
Open "I", 1, @f
fSize = Lof( 1 , 1 )

long if syserror = 0
h = Fn NewHandle( fSize )
HLock( h )
Read File #1, [h], fSize
Close 1
end if
end if

end fn

On Jan 14, 2006, at 3:59 PM, maxclass@... wrote:

> To all who would help,
>
> This is the first time I have asked for Help so I'm not even sure I  
> am doing this correctly to start a new Subject. If I did this wrong  
> just let me know and it won't happen again, OK
>
> This is humbling but in all the years I have been using ZBasic and  
> FB (20) I have never had the need to read a text file into a data  
> handle like below.
>
> DIM AS HANDLE DataHandle
>
> DataHandle = FN NEWHANDLECLEAR(  dataLength  )
>
> READ FILE DataHandle
>
> Unless I am misunderstand this process this should be the basics here.
>
> THE PROBLEM
>
> I do not know how to display this in a window with scrollbars so  
> that the file could be edited and then resaved. I know that it is  
> not complicated, it is just that I have never had to do it before.  
> I have always dealt with data files one line at a time using LINE  
> INPUT #[1], gTheLine$ or something to that effect.
>
> My first guess is that I simply need to create one giant edit field  
> the size of the window and hand it the handle to the data. I would  
> also like to find out if there is some special way that resizes the  
> Edit Field when the window is resized or if that is something I  
> would have to implement myself. I have looked everywhere through  
> the FB documentation and have not found any single example that  
> simply does this. There was no example code that I found that  
> addresses this particular point.
>
> Also, if an edit field is the answer is it restricted to 32,768  
> bytes in size.
>
> I will patiently await any response.
>
> Max Taylor
> The MaxClass Guy
>
> PS. How come my posts always show up with my email account instead  
> of my name?
>
> PSS. I run an iMac G5 with System 10.4.3 currently and only use OS X.
>
> --
>