840445m@aucs.uucp (Alan McKay) (12/07/89)
I am working on a program which will offer an intuition interface as well as a command line interface. I want to have a window on the screen with all the buttons and gadgets and stuff as well as a console window so the person can type in commands if he wants. I know how to open windows and do gadgets and stuff but want to know how to open a console window in my program AND attach it to my window if that is possible. Thanks in advance for any help you can give me. -- + Alan W. McKay + VOICE: (902) 542-1565 + + Acadia University + "Courage my friend, it is not yet too late + + WOLFVILLE, N.S. + to make the world a better place." + + 840445m@AcadiaU.CA + - Tommy Douglas +
cmcmanis%pepper@Sun.COM (Chuck McManis) (12/11/89)
In article <1989Dec6.215619.3183@aucs.uucp> (Alan McKay) writes: > ... but [I] want to know how to open a console window in my >program AND attach it to my window if that is possible. It isn't easy using the standard Amiga console.device. If you have ConMan (and you should cuz it's nearly free) you can open a console with a W0x<window-address> keyword and have the console automatically attach to your window (or even more fun us S0x<screen-adddress> and get one on your custom screen. There was an article by Andy Finkel in a past Amiga Mail about how to do this with the Amiga console device however it was a rather ugly hack. The Conman method is much cleaner. --Chuck McManis uucp: {anywhere}!sun!cmcmanis BIX: cmcmanis ARPAnet: cmcmanis@Eng.Sun.COM These opinions are my own and no one elses, but you knew that didn't you. "If it didn't have bones in it, it wouldn't be crunchy now would it?!"
840445m@aucs.uucp (Alan McKay) (12/11/89)
In article <129043@sun.Eng.Sun.COM> cmcmanis@sun.UUCP (Chuck McManis) writes: >In article <1989Dec6.215619.3183@aucs.uucp> (Alan McKay) writes: >> ... but [I] want to know how to open a console window in my >>program AND attach it to my window if that is possible. > >It isn't easy using the standard Amiga console.device. If you have >ConMan (and you should cuz it's nearly free) you can open a console ...... >device however it was a rather ugly hack. The Conman method is much >cleaner. > >--Chuck McManis OK, so now I know what I need to do it, and that it can be done, but I am still in want for the method. Sample code anyone? -- + Alan W. McKay + VOICE: (902) 542-1565 + + Acadia University + "Courage my friend, it is not yet too late + + WOLFVILLE, N.S. + to make the world a better place." + + 840445m@AcadiaU.CA + - Tommy Douglas +
fgd3@jc3b21.UUCP (Fabbian G. Dufoe) (12/12/89)
Perhaps I'm missing something. If you want to open an Intuition window and then use the console.device to handle text output to that window the process is pretty straightforward. You'll need a message port, so call CreatePort(). It's documented in Autodocs1.3:LinkerLibs/amiga.lib.doc. Next you'll need a console message structure. Call CreateStdIO(). Maybe you should call CreateExtIO(). I read some discussion about that recently. You'll find a description of CreateExtIO() in Autodocs1.3:LinkerLibs/amiga.lib.doc. You won't find any documentation for CreateStdIO(). I shouldn't say that. You might find some. I didn't, though, and I looked pretty hard. But CreateStdIO() is the one used in the RKM: Libraries and Devices. It's what I used, and it worked. Once you've set up your message port and message structure you're nearly done. Just call load ConsoleMsg->io_Data with your window pointer and call OpenDevice("console.device", 0, ConsoleMsg, 0). ConsoleMsg is the pointer to the message structure returned by CreateStdIO. To write to the console you load your message structure as follows: ConsoleMsg->io_Command = CMD_WRITE; ConsoleMsg->io_Length = (ULONG)-1; ConsoleMst->io_Data = (APTR)String; and call DoIO(ConsoleMsg). CMD_WRITE is defined in exec/io.h. You use ANSI escape sequences to position the cursor and set display attributes. Well, maybe it's not so straightforward after all. But doing it isn't the hard part. The hard part is finding out how to do it. THE AMIGA REALLY NEEDS BETTER DOCUMENTATION! --Fabbian Dufoe 350 Ling-A-Mor Terrace South St. Petersburg, Florida 33705 813-823-2350 UUCP: ...uunet!pdn!jc3b21!fgd3
morgan@camtwh.UUCP (Morgan W. Jones) (12/13/89)
If anyone is interested, last weekend I sat down and hacked up a couple of routines (in Manx) to handle console stuff much like stdio stuff. I won't say it's great code, but it might be interesting for people who would like to get a complete example. Synopsis is as follows: #include "console.h" CON *OpenConsole(top,left,width,height,title,window_flags) int top,left,width,height; char *title; int window_flags; int ReadConsole(console,buf,len) CON *console; char *buf; int len; int WriteConsole(console,buf,len) CON *console; char *buf; int len; int CloseConsole(console) CON *console; NB: Yes, these routines do automatically create the window. I made these because I wanted to be able to run multiple console windows without screwing around with stuff. Next, I need to come up with a way to have to replies from CMD_READ routed to a different msgport (so that I can have N devices of differing types all sending input to a common port to be processed - this way I avoid having to poll everything and all of the devices are nicely abstracted). -- Morgan W. Jones (morgan@camtwh) Orama Incorporated, Toronto, Canada. (416) 369-5088
cmcmanis%pepper@Sun.COM (Chuck McManis) (12/13/89)
In article <812@jc3b21.UUCP> fgd3@jc3b21.UUCP (Fabbian G. Dufoe) writes: [Excellent description of how to attach a console device to a window deleted] > Well, maybe it's not so straightforward after all. But doing it isn't >the hard part. The hard part is finding out how to do it. THE AMIGA >REALLY NEEDS BETTER DOCUMENTATION! I was answering the question of "How do I attach a CON: stream to my window." Which is decidedly more difficult. Attaching the console.device gives you the ability to send and receive IO requests to the window/keyboard but the CON: lets you use the stdio library of C and that can be a feature. I agree about the need for better documentation, but it's coming. The new Hardware manual it pretty whizzy and the new IntuiExecGraphiLib book should be an improvement as well. --Chuck McManis uucp: {anywhere}!sun!cmcmanis BIX: cmcmanis ARPAnet: cmcmanis@Eng.Sun.COM These opinions are my own and no one elses, but you knew that didn't you. "If it didn't have bones in it, it wouldn't be crunchy now would it?!"
duncant@mbunix.mitre.org (Thomson) (12/13/89)
I've been following this thread with some interest, hoping to find the answer to the following question: Given a window, how can I get a file pointer (of type FILE *) which I can then use in fprintf(), fscanf()(), and so on, to do I/O with the console handler actually handling writing text to the window and reading the junk the user types into the window. I realize that this may not have been the original question, but it's a question which I am sure several people would like the answer to. By the way, I already know that I can do something like: wind_file = fopen( "NEWCON:0/0/100/100/MyWindow", "w+" ); which will open a window and give me a file pointer. What I'd really like to do is get a file pointer which can be used to do IO with a window which already exists. Duncan Thomson
billsey@agora.UUCP (Bill Seymour) (12/14/89)
In article <129114@sun.Eng.Sun.COM: cmcmanis@sun.UUCP (Chuck McManis) writes: :In article <812@jc3b21.UUCP: fgd3@jc3b21.UUCP (Fabbian G. Dufoe) writes: :[Excellent description of how to attach a console device to a window deleted] :: Well, maybe it's not so straightforward after all. But doing it isn't ::the hard part. The hard part is finding out how to do it. THE AMIGA ::REALLY NEEDS BETTER DOCUMENTATION! : :I was answering the question of "How do I attach a CON: stream to my :window." Which is decidedly more difficult. Attaching the console.device :gives you the ability to send and receive IO requests to the window/keyboard :but the CON: lets you use the stdio library of C and that can be a feature. : :I agree about the need for better documentation, but it's coming. The new :Hardware manual it pretty whizzy and the new IntuiExecGraphiLib book should :be an improvement as well. : :--Chuck McManis :uucp: {anywhere}!sun!cmcmanis BIX: cmcmanis ARPAnet: cmcmanis@Eng.Sun.COM :These opinions are my own and no one elses, but you knew that didn't you. :"If it didn't have bones in it, it wouldn't be crunchy now would it?!" -- -Bill Seymour ...tektronix!reed!percival!agora!billsey ...tektronix!sequent.UUCP!calvin!billsey Bejed, Inc. NES, Inc. Northwest Amiga Group At Home Sometimes (503) 691-2552 (503) 246-9311 (503) 656-7393 BBS (503) 640-0842