------------------------------- > Brian Heibert <bheibert@...> > Subject: Re: [FB] Splitting a Edit Field up > Ok now I am getting a error: > Error: There is a Limit of 32k bytes for Local variables. > in file TBASIC.proj:TBASIC.MAIN at line 200 in doMenus > DIM runcodeLines$(500) ------------------------------- Hi Brian; re Al's solution given below ... Your array is too big. DIM runcodeLines$(500) ' <----------------- CHANGE THIS This line requests a large amount of memory. Each string variable uses 256 bytes of memory by default so this array needs 256 x 500 or 128,000 bytes; over the 32K limit. (Actually it is 256 x 501, counting element zero.) One approach is to use shorter length strings, say 60 bytes each. This may work if you know each line never exceeds 59 characters. (Byte #0 stores the # of actual characters used in the string.) DIM 60 runcodeLines$(500) ' <---- needs ~ 30,000 bytes However, it still potentially wastes lots of memory and has a limit of only 500 strings; you may want more some day. A second approach is to use DYNAMIC arrays which must be declared as GLOBALS and can be as large as needed. I suspect you'll want to use global variables so different subprograms can work with the same data. DIM DYNAMIC runcodeLines$(_maxInt) ' 256 bytes each or DIM DYNAMIC 63 runcodeLines $(_maxInt) ' 64 bytes each This works by assigning memory to the array only for the elements actually referred to. If there were on 125 lines in your edit field then only 125 elements of the array use memory, not 500. The size limit for a dynamic array is 2 GB; it should be enough. ;-) See the FB HELP--->REFERENCE--->DYNAMIC for more details. Other approaches exist for managing lists of data but that lesson is for another day. Using an array is a quick way to get started. HTH -Stu C. --------------------------------------------------- ' Al's solution .... >'Look at EDIT$ FUNCTION in the Reference Manual. >' Here's a sample. > > DIM runcodeLines$(500) <----------------- CHANGE THIS > DIM howManyLines > DIM efHandle& > DIM X > > efHandle& = TEHANDLE (WINDOW(_efNum)) > howManyLines = efHandle&..teNLines% > IF howManyLines = 0 THEN howManyLines = 1 > IF howManyLines > 500 THEN howManyLines = 500 > FOR X =3D 1 TO howManyLines > runcodeLines$(X) = EDIT$(1, X) > NEXT X > > ' Now we can open a window and print all of the lines > WINDOW 2 > FOR X = 1 to howManyLines > PRINT runcodeLines$(X) > NEXT X > >' by Al Staffieri Jr. ------------------------------