I'm playing a little bit with PocketC by doing a simple text editor. But with this code to read and to display the contents of the file on the EDIT
control:
int filehandle;
int file_len;
string file_mode;
initComponents()
{
createctrl("EDIT", "test", 2, 1, 0, 24, 70, 25, TEXTBOX);
wndshow(TEXTBOX, SW_SHOW);
guigetfocus();
}
main()
{
filehandle = fileopen(OpenFileDlg("Plain Text Files (*.txt)|*.txt; All Files (*.*)|*.*"), 0, FILE_READWRITE);
file_len = filegetlen(filehandle);
if(filehandle == -1)
{
MessageBox("File Could Not Be Found!", "Error", 3, 1);
}
initComponents();
editset(TEXTBOX, fileread(filehandle, file_len));
}
It's all ok, but my test file, now have returns:
Hello, World! PocketC Test Of My Editor
Then when I open this file on the editor, instead of returns, I just see two squares(that means that it's a unknown character for that control), but if I change the control to a STATIC
, it does he returns ok, but I can't edit the text if I use a STATIC
. Then I want to know what I need to do to do the returns instead of showing those squares.
Also, this field(EDIT
), is like a TextField
, I can't do returns on it, then I want to know how to change this too.