Little-Acorn
Joined: 06 Jul 2008 Posts: 111 Location: San Diego
|
Posted: Wed Dec 05, 2012 2:38 am Post subject: If I EDIT_FILE_OPEN a text file in an edit box in SCC..... |
|
|
I set up an edit box with a buffer called asmfilebuf. I had previously defined that buffer as a global variable with a "char asmfilebuf[10000]" statement, at the top of the program before any functions or main() is defined.
The edit box also has menus, one of which is "Open", with the callback function "EDIT_FILE_OPEN", filter "*.*", and stringname "file", which is defined as "char file[129]".
If I click on the menu Open, the normal file-open box comes up, letting me browse to find a text file I prepared earlier. I click on that text file and click on "Open" in the box, and the text file opens in the edit box. This all works as it should, and I can see the contents of the text file in the edit box.
My problem is, I was hoping to find the contents of that text file in the buffer asmfilebuf.
The sequence is:
1.) I start the program, which opens the edit box.
2.) I click File/Open at the top of the edit box, and open the text file. Its contents appear in the Edit box.
3.) I click another control which prints the text "asmfilebuf:" and then prints the contents of the asmfilebuf buffer and then closes the edit box.
I was hoping to see the contents of the text file printed after "asmfilebuf:", but all I got was "asmfilebuf:" followed by nothing.
Is there some way, when I use EDIT_FILE_OPEN, to get the contents of the file I open, into a buffer that can then be copied or printed by other parts of the program?
Relevant code is here:
Code: |
int asmfilewin(int xul, int yul) /* From "Help for SCC", "callback functions" */
{
char file[129];
char new_file[129];
int asmsrcctrl,asmgreyctrl;
writstat("Opening Assembler Source window...");
winio("%ca[Assembler Source]&"); /* Insert window title as caption */
winio("%sp&",xul,yul); /* position asm-src window in pixels */
asmsrcctrl=1;
winio("%mn[&File[&Open,&Save,Save &As,E&xit],&Edit[&Copy,Cu&t,&Paste],&Help[&Contents,&Help on help]]&",
"EDIT_FILE_OPEN", "*.*",file,
"EDIT_FILE_SAVE", "*.*",new_file,
"EDIT_FILE_SAVE_AS","*.*",new_file,
"EXIT",
"COPY","CUT","PASTE",
"HELP_CONTENTS","c:\\edithelp.hlp",
"HELP_ON_HELP", "c:\\edithelp.hlp");
winio("%lw&",&asmsrcctrl); /* Leave Asm-src window open */
winio("%ww[no_frame]&"); /* %ww=Window control. Makes window resizeable,
[no_frame] omits thin-line frame inside
window border. Other options available.*/
winio("%pv&"); /* %pv=Pivot. Things to right move right, things
below move down when window is resized. */
winio("%60.20eb[hscrollbar,vscrollbar]&",asmfilebuf,0);
/* Insert edit box for assembly-code source editor */
winio("%ff%`rp&",3.0,1.0); /* move below edit box to place ASSEMBLE button */
asmgreyctrl=1;
winio("%?~^bt[Assemble][Assemble as ARM code]",&asmgreyctrl,assemble_ARM);
return(1);
}
|
|
|