Page 1 of 1

how can i do save&load field text?

Posted: Sun Jul 19, 2015 8:23 am
by chjchjch
hello

how can i do

save, load, and view field text(multiline)?

example source is here

'example
DIM box$(1)
box$(0)="mltext"

FIELD box$(0) TEXT "" AT 10,100 SIZE 300,200 ML

BUTTON "saveload" TEXT "saveload" AT 10,10

LOOP:
IF BUTTON_PRESSED ("saveload") THEN GOTO SAVE
GOTO LOOP

SAVE:
filenames$="test.txt"

FILE filenames$ WRITELINE FIELD_TEXT$(box$(0))


LOAD:
FILE filenames$ SETPOS 0
FILE filenames$ READLINE FIELD_TEXT$(box$(0))

VIEW:

FIELD box$(0) TEXT "" AT 10,10 SIZE 300,200 ML

Re: how can i do save&load field text?

Posted: Sun Jul 19, 2015 8:59 am
by Mr. Kibernetik
Command

FILE filenames$ READLINE FIELD_TEXT$(box$(0))

is incorrect - you need to supply variable to read to, like:

FILE filenames$ READLINE t$

Use FIELD TEXT command to set text to your text field, like

FIELD box$(0) TEXT t$

Re: how can i do save&load field text?

Posted: Sun Jul 19, 2015 10:24 am
by chjchjch
always thank you!

text load is ok

but

text field is multiline

but load text field is

only one line looks.

Re: how can i do save&load field text?

Posted: Sun Jul 19, 2015 10:42 am
by Mr. Kibernetik
Yes, this command reads file line by line.

There is no command to read all text at once.

Re: how can i do save&load field text?

Posted: Sun Jul 19, 2015 10:52 am
by chjchjch
ok
thankyou very much!
have a nice day :)