how can i do save&load field text?

Post Reply
chjchjch
Posts: 13
Joined: Wed Jun 10, 2015 12:40 am
My devices: iphone 4s / iphone.5

how can i do save&load field text?

Post 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

User avatar
Mr. Kibernetik
Site Admin
Posts: 4782
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

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

Post 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$

chjchjch
Posts: 13
Joined: Wed Jun 10, 2015 12:40 am
My devices: iphone 4s / iphone.5

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

Post by chjchjch »

always thank you!

text load is ok

but

text field is multiline

but load text field is

only one line looks.

User avatar
Mr. Kibernetik
Site Admin
Posts: 4782
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

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

Post by Mr. Kibernetik »

Yes, this command reads file line by line.

There is no command to read all text at once.

chjchjch
Posts: 13
Joined: Wed Jun 10, 2015 12:40 am
My devices: iphone 4s / iphone.5

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

Post by chjchjch »

ok
thankyou very much!
have a nice day :)

Post Reply