ruslan@ecsvax.UUCP (Robin C. LaPasha) (01/31/88)
Just tried running some of the new demos (from the Badge Killer Demo contest) on Fish disks 123-127. They didn't exit with ^C as hoped. I was running them from Workbench (on an A1000 with 2M Starboard.) The demos were set up to run using Xicon (2.0). [I already eliminated the possibility of interaction with PopCLI or ver. 2.7M of the Shell; can't get out of the demo whether they're there or not.] Have I missed a bug report on Xicon 2.0? Did I get a bad copy? Email is fine if this has been gone over before.[A[B Thanks, Robin LaPasha ruslan@ecsvax.UUCP
pete@violet.berkeley.edu ( Pete Goodeve ) (02/13/88)
In an earlier message (31 Jan 88) Robin LaPasha (ruslan@ecsvax.UUCP) says: > Just tried running some of the new demos (from the Badge Killer > Demo contest) on Fish disks 123-127. They didn't exit with ^C > as hoped. > [.....] You're right. Sorry about that. > Have I missed a bug report on Xicon 2.0? Did I get a bad copy? Nope. And it's not really a bug [!] It's due to a quirk in AmigaDOS that I couldn't find any way around. This is mentioned in the Xicon manual, and a work-around is described there too. Fred apparently missed this -- as did the folks who put the BADGe Demo disks together. Not surprising, I guess: it's sort of buried in the "Caveats" section! So I'd better go into a little more detail now. There are a couple of other tricks as well that make a xicon-driven application more portable; this is a good time to mention them too. The ctrl-C problem is a result of the way you have to pass a command script to the Execute() call. The only way to avoid starting a new CLI for each line in the script is to pass the SCRIPT as the INPUT stream, which -- due to the way in which the possible options are set up -- totally blocks you from making the resulting CLI interactive! The window attached to the CLI is output only; as a result ALL input -- including ctrl-Cs and such -- is totally ignored. The fix, in any situation where you need keyboard input to a program invoked by the script, is to redirect standard input for that program from another, temporary, CON: window. For something like ShowANIM, which only has to see a ctrl-C, it doesn't really matter how small or where it is, as long as it remains the active one. For example, this is the original script (rundemo) for "car" off Fred Fish's disk #123: ----------- echo "To stop this demo type CTRL-C at any time and then click on the" echo "Xicon window close gadget. This may take about 60 seconds to load..." echo "" AmigaLibDisk123:Car/ShowANIM +3 -c AmigaLibDisk123:Car/Car.anim ----------- This is the simplest modification to fix the problem: ----------- echo "To stop this demo type CTRL-C at any time and then click on the" echo "Xicon window close gadget. This may take about 60 seconds to load..." echo "" AmigaLibDisk123:Car/ShowANIM <CON:... +3 -c AmigaLibDisk123:Car/Car.anim --------- add this ^^^ ^insert whatever window parameters you like here. (You'll have to size the window as well of course, but I left that out so I could squeeze it on the page.) We can improve things a lot more by using some of the ToolTypes options in Xicon 2.0. For a start, there'll be no need for "clicking on the Xicon window close gadget" if you include the ToolType "MODE=closewindow" in the icon info. Then, to avoid having to include the whole path ("AmigaLibDisk123:Car/") in the script, you can put "LOCDIR=RAM:__car_dir" (or some such unlikely name) in the set of ToolTypes, and start the script with the command CD <RAM:__car_dir >NIL: ? [!!] ...Complicated looking, but fairly straightforward (he says...). The trailing question-mark makes CD "prompt" (to device NIL:) for its argument, then read it from the input stream -- which has been redirected from the file that Xicon created on instruction from the LOCDIR tooltype. (You can then delete that file.) From then on you are working IN the directory that contains the icon, and presumably all the associated files. The advantage of this approach is that you can move the "car" directory bodily -- without having to change the script or any other files in it -- to any other disk that contains Xicon (in the :c directory if the "Default Tool" is ":c/xicon" as it is in the original). These are the ToolTypes I use for the "Car" demo icon: --------- LOCDIR=RAM:__car_dir MODE=closewindow WINDOW=20/20/500/160/The Car is coming.... --------- and here's the script that it invokes: --------- echo "To stop this demo type CTRL-C." echo "This may take about 60 seconds to load..." echo "CAUTION -- don't touch the left mouse button" echo "or you may not be able to use ctrl-C to stop" echo "" cd <RAM:__car_dir >NIL: ? ;switch to proper working directory delete RAM:__car_dir stack 16000 ;not sure this is necessary -- seemed a good idea showanim <CON:440/140/25/25/ +3 -c Car.anim ;^^ allows recognition of ctrl-C when called from xicon ; -- NOTE! this won't work if you're running ConMan.. ; in that case you'll probably have to re-boot to exit (:-() --------- The warning about the left mouse button is of course because if you change active windows while showANIM is playing, you may have a hard time reactivating the right one! The warning about ConMan is because of some early experiences; I haven't verified it recently -- it's just a pointer if you find things still dont work. (And if they STILL don't work, please let me know!) > Email is fine if this has been gone over before. [I'd have sent you E-mail, if I could ever get our damn mailer to recognize a path...] -- Pete Goodeve --