how read TXT in editText

hi, I try show txt file in editText and it is not works.
I try this:

-----------------
rollout test "test"
(

fn readTXT editTextShow =
(
try
(
local inFolder = getOpenFileName type:"notepad (*.txt)| *.txt "
local inFile = openFile inFolder
editTextShow = inFile
)
catch(false)
)

button testbutton "open"
editText editTextShowBox ""
on testbutton pressed do readTXT editTextShowBox.text
)

-----------------

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jos's picture

how read TXT in editText

hey jmpinero, you should have something like this..
code speaks for itself.

fn readTXT fileName=()

rollout test "test"
(

button testbutton "open"
editText editTextShowBox ""
on testbutton pressed do
(
local inFolder =""
inFolder = getOpenFileName type:"notepad (*.txt)| *.txt "
editTextShowBox.text = readTXT inFolder
)
)
createDialog test

fn readTXT fileName =
(
inText
local inFile = openFile fileName

if inFile != undefined do
(
inText = readLine inFile
)
close inFile
messagebox( inText as string)
return (inText as string)
)

jmpinero's picture

thanks

thanks for your reply

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.