Page 1 of 1
How do you save the contents of an editor gadget?
Posted: Tue Oct 28, 2003 6:10 pm
by Mr Tickle
I've managed to open a textfile and show the contents of it in an editor gadget. But once I've edited the file I can't seem to save it.
What's the easiest way to write the contents of an Ed Gadget?
Cheers
Posted: Tue Oct 28, 2003 6:30 pm
by Kale
Open a file, get the text from the Editor Gadget using 'Text$ = GetGadgetText(#Gadget)' then write that to the file using 'WriteString(Text$)'. Thats the easiest way... BUT you will have problems with strings over 64k due to PB internal string buffer, so its maybe best in using memory buffers to hold the string before writing and using 'WriteData(*MemoryBuffer, LengthToWrite)'.

Posted: Tue Oct 28, 2003 11:08 pm
by Mr Tickle
Thanks Kale, I nearly got it right. I tried using GetItemText before realizing it's not a tree view
I don't fully understand about using a mem buffer to hold the string
Won't it too only hold the max value of the string (64k)

Posted: Wed Nov 12, 2003 3:20 pm
by Kale
Won't it too only hold the max value of the string (64k)
No... you are only limited to your free memory, but you'll have to avoid most PB's native string commands and supplement them with the Windows API.