replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - If I EDIT_FILE_OPEN a text file in an edit box in SCC.....
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

If I EDIT_FILE_OPEN a text file in an edit box in SCC.....

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
Little-Acorn



Joined: 06 Jul 2008
Posts: 111
Location: San Diego

PostPosted: Wed Dec 05, 2012 2:38 am    Post subject: If I EDIT_FILE_OPEN a text file in an edit box in SCC..... Reply with quote

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);   
}
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8211
Location: Salford, UK

PostPosted: Wed Dec 05, 2012 9:08 am    Post subject: Reply with quote

The second argument for %eb is the size of the buffer. If this is zero then %eb uses its own buffer.
Back to top
View user's profile Send private message AIM Address
Little-Acorn



Joined: 06 Jul 2008
Posts: 111
Location: San Diego

PostPosted: Wed Dec 05, 2012 7:51 pm    Post subject: Reply with quote

Bingo! Works great now! Thank you again, Paul!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group