I wanna be able to load and save text area text to a file but I'm having trouble with the lines. I know I need chr$(10) and chr$(13) at the end of every line but it isnt quite working how it should. Here is my code:
Global Config
Global TextField1
Global EnterAHomepage
Global TEXTAREA1
Global EnterYourApps
Global Submit
CreateConfig()
While WaitEvent()
If EventID()=$401 And EventSource()=submit
DeleteFile("config.txt")
file=WriteFile("config.txt")
WriteLine(file,TextFieldText(textfield1))
WriteLine(file,TextAreaText(textarea1))
FreeGadget(config)
End If
If EventID()=$803 And EventSource()=config
FreeGadget(config)
End If
Wend
Function CreateConfig()
Config = CreateWindow("Butane Configuration",220,151,300,295,Desktop(),17)
TextField1 = CreateTextField(5,20,280,20,Config,0)
label1 = CreateLabel("Enter Your Homepage",5,5,280,15,Config,0)
TEXTAREA1 = CreateTextArea(5,65,280,180,Config,0)
label2 = CreateLabel("Enter Application Locations and Nicknames",5,50,280,15,Config,0)
Submit = CreateButton("Enter",100,250,100,20,Config,0)
file=ReadFile("config.txt")
SetGadgetText(textfield1,ReadLine(file))
While Not Eof(file)
AddTextAreaText(textarea1,ReadLine(file))
AddTextAreaText(textarea1,Chr$(10))
AddTextAreaText(textarea1,Chr$(13))
Wend
CloseFile(file)
End Function
Global Config
Global TextField1
Global EnterAHomepage
Global TEXTAREA1
Global EnterYourApps
Global Submit
CreateConfig()
While WaitEvent()
If EventID()=$401 And EventSource()=submit
DeleteFile("config.txt")
file=WriteFile("config.txt")
WriteLine(file,TextFieldText(textfield1))
WriteLine(file,TextAreaText(textarea1))
FreeGadget(config)
End If
If EventID()=$803 And EventSource()=config
FreeGadget(config)
End If
Wend
Function CreateConfig()
Config = CreateWindow("Butane Configuration",220,151,300,295,Desktop(),17)
TextField1 = CreateTextField(5,20,280,20,Config,0)
label1 = CreateLabel("Enter Your Homepage",5,5,280,15,Config,0)
TEXTAREA1 = CreateTextArea(5,65,280,180,Config,0)
label2 = CreateLabel("Enter Application Locations and Nicknames",5,50,280,15,Config,0)
Submit = CreateButton("Enter",100,250,100,20,Config,0)
file=ReadFile("config.txt")
SetGadgetText(textfield1,ReadLine(file))
While Not Eof(file)
AddTextAreaText(textarea1,ReadLine(file))
AddTextAreaText(textarea1,Chr$(10))
AddTextAreaText(textarea1,Chr$(13))
Wend
CloseFile(file)
End Function