[net.micro.amiga] Need Help w/String Gadgets

hsgj@batcomputer.TN.CORNELL.EDU (Dan Green) (06/11/86)

Another Amiga Question:
   In my desperate attempt to create a way for a user to input a filename
(from my C prog) I have discovered that string gadgets can be attached to
Requester windows.  That, unfortunately, is my problem.  I used the
InitRequester(MyRequester) to initialize a requester structure, and then
filled in the position. (eg MyRequester.Width = 100, etc).  I then
created a struct Gadget MyGadget.  Operating from the RKM v2 intuition.h
documentation, I filled in the Gadget.Type with STRGADGET.  I assume
this means a string gadget which lets you input a line of text.  Now there 
was an UNDOCUMENTED field in the Gadget struct that I didn't know what
to do with.  It is called "SpecialInfo" and the RKM merely says,
its (paraphrased) "a special data pointer required by String Gadgets".
   Of course, no where else anywhere was this thing mentioned.  So I
set it to NULL.
   Then I did a ReqWindow = BuildSysRequest( and for the parameters I used 
the current window and the size info, and three IntuiText thingies.
Then later on in my program, when I wanted the requester displayed, I did
a Request(MyRequester,ReqWindow).

Results:  Immediately after the BuildSysRequest got executed a requester
popped up that had a Positive gadget, a Negative gadget, but no goddamn
string gadget.  The Amiga never waited for me to call the Request() function,
instead it built the window when BuildSysRequest was called.  The Request
window had no close box or other way to kill it - clicking on the Pos or
Neg gadgets did nothing except inverse video the gadgets.
   According to my lousy Sybex "Amiga Programmers Handbook" *supposedly*
no requester window will be generated until Request() is called.  Obviously
that was wrong...

My Question:  Can anyone tell me (a) how to use String Gadgets, (b) how
to incorporate these gadgets into Requesters, and (c) whether anyone has
JUST the Intuition Manual for sale...

Sample code would be VERY nice, but english is ok, too.  I have V1.1 of
Kickstart and Workbench, and Lattice v3.3.

Oh by the way:  when my program actually did get around to executing the
Request() function, the amiga emitted a low sustained beep, and the screen
cycled blue and white 2pixel high bars for about 30 seconds.  Then it auto
rebooted.  My apartment-mate was impressed.  "Gee, you can turn the screen
into a barbershop pole!"

Thanks very much for reading this long tale of frustrations :-)
-- 
Dan Green    ARPA:    hsgj@vax2.ccs.cornell.edu
~~~~~~~~~    BITNET:  hsgj@cornella
             UUCP:    {decvax,ihnp4,allegra}!cornell!batcomputer!hsgj

rj@amiga.UUCP (Robert J. Mical) (06/12/86)

In article <431@batcomputer.TN.CORNELL.EDU> hsgj@batcomputer.TN.CORNELL.EDU (Dan Green) writes:
>Another Amiga Question:
>   In my desperate attempt to create a way for a user to input a filename
>(from my C prog) I have discovered that string gadgets can be attached to
>Requester windows.  That, unfortunately, is my problem.
>  ... UNDOCUMENTED field in the Gadget struct that I didn't know what
>to do with.  It is called "SpecialInfo" and the RKM merely says,
>its (paraphrased) "a special data pointer required by String Gadgets".
>window had no close box or other way to kill it - clicking on the Pos or
>Neg gadgets did nothing except inverse video the gadgets.
>
>   According to my lousy Sybex "Amiga Programmers Handbook" *supposedly*
>no requester window will be generated until Request() is called.  Obviously
>that was wrong...
>
>My Question:  Can anyone tell me (a) how to use String Gadgets, (b) how
>to incorporate these gadgets into Requesters, and (c) whether anyone has
>JUST the Intuition Manual for sale...
>
>Dan Green    ARPA:    hsgj@vax2.ccs.cornell.edu

Your questions are good ones.  But the answers would be long, and
unnecessary.  All of the answers to your questions can be found in the
Intuition manual published jointly by Addison-Wesley and 
Commodore-Amiga.

You *must* read the Intuition manual.  I am surprised that you've gotten
as far as you have without it!  Requesters, string gadgets, SpecialInfo,
all this stuff is explained in great detail in the Intuition manual.

Accept no cheap substitutes.  Get the Addison-Wesley version of the
Intuition manual, which was written by me (the creator of Intuition)
and Susan Deyl, and proofed by Amiga people.  It will make your
life a lot easier, not just with Inutition but with the entire Amiga
System Kernel, because Intuition's relationship to the system on the
whole is well-described in this book.

Good luck!

******************************************************************************
   =RJ Mical=
   
    (415) 573-0497

    Suite 123
    999C Edgewater Blvd.
    Foster City, CA   94404
******************************************************************************

higgin@cbmvax.UUCP (06/13/86)

In article <1285@amiga.amiga.UUCP> rj@amiga.UUCP (Robert J. Mical) writes:
>All of the answers to your questions can be found in the
>Intuition manual published jointly by Addison-Wesley and 
>Commodore-Amiga.
>
>You *must* read the Intuition manual.  I am surprised that you've gotten
>as far as you have without it!  Requesters, string gadgets, SpecialInfo,
>all this stuff is explained in great detail in the Intuition manual.
>
>Accept no cheap substitutes.  Get the Addison-Wesley version of the
>Intuition manual, which was written by me (the creator of Intuition)
>and Susan Deyl, and proofed by Amiga people.  It will make your
>life a lot easier, not just with Inutition but with the entire Amiga
>System Kernel, because Intuition's relationship to the system on the
>whole is well-described in this book.
>

I wouldn't "self-congratulate" yourself that much RJ, I think Dan did
read the Intuition manual from reading his message.  I too had some
difficulty with the chapter on requesters.

The manual is pretty good though, I must say - you had a lot of difficult
(and probably new to most people) material to cover, and for the most part
it's not hard to follow.  Some of the programming examples are AWFUL in it
though.  Very sloppy.

FYI - I've cursed and grumbled at Intuition, but overall, it's a very
impressive piece of software.  CONGRATULATIONS.  My two recurring gripes are:

	It's unclear who is in charge of borders at any time.
		This makes rendering into windows a constant battle.
		Yes, I know, there's the wonderful GIMMEZEROZERO
		windows - but they're abysmally slow and are memory
		hogs.

	Requesters go somewhat against the grain of multi-tasking.
		There's no reason why other things must be BLOCKED
		while they're around.  I'm glad this is remedied in
		1.2, although I won't be using 1.2 routines for my
		work.

Question - is there a quick way to update the screen (window) title
without using SetWindowTitle() because I want to use it for status
info which changes a lot, and using SetWindowTitle causes it to flash,
splutter, and be basically very objectionable.  Any ideas would be
appreciated.


	Paul Higginbottom.

Disclaimer: I do not work for Commodore and my opinions are at least my own.

lorne@uokvax.UUCP (06/20/86)

Please excuse this interuption of an interesting transfer of thoughts.
But; alas, I have some questions for someone in the know.

1) Is there a way in the cli to request keyboard input during the execution
of a batch file?  I would like to be able to have the startup-sequence file ask
me if I want to dump the system commands into a ram-disk.  If this is not
offered in v1.1 will that be changed in v1.2?

2) I seem to be having trouble when swapping disks (I only have one drive), in
getting the system to recognize that the new disk is different.  It is a royal
pain having to reboot everytime I change applications.  Is there something I am
missing out on?  (Ex.  I boot on my workbench disk, do some system things, and 
decide to play on Dpaint awhile.  When I pop out workbench and put in the Dpaint
disk the system flashes a requestor on the screen for the workbench disk.)

3) How do I get my preferences onto the Dpaint disk?  I don't think this is 
all that crucial, but I don't like the original arrow pointer.  So I drew my own
(after all, thats what preferences is for right?)  The only problem is that 
Dpaint uses the pointer that I hate; and I want my own!!

If any of these questions are in the manual, please give me page nos. or 
somthing, any help is much appreciated.

 				please respond to
				ihnp4!okstate!uokvax!lorne

                                                Thanx in advance,
						Lorne's brother,
							R. Wilson

*The preceding thoughts are not my own so talk to my brother,                  *
*his name is Bruno and he's out in the alley, (the big guy.)                   *

carolyn@cbmvax.cbm.UUCP (Carolyn Scheppner) (06/26/86)

In article <50200016@uokvax.UUCP> lorne@uokvax.UUCP writes:

>1) Is there a way in the cli to request keyboard input during the execution
>of a batch file?  I would like to be able to have the startup-sequence file ask
>me if I want to dump the system commands into a ram-disk.  If this is not
>offered in v1.1 will that be changed in v1.2?

   Here's something of J. Dow's I downloaded off BIX a while back.
----------------------------------------------------------------------------


==========================
amiga/programs #26, from jdow, 1392 chars, Sun Feb 16 16:30:35 1986
--------------------------
TITLE: yesno.c
I found a need in "execute" files to have operator intervention control
the direction a batch file may take. The yesno.c program gives me a
certain amount of control over this. I made little effort to get elegant
as I could see little savings or benefit.
___________________________
/*
 *
 * yesno.c
 *
 * Version 1.0 (original release)
 *
 * Usage:
 *      yesno "match string" <-c>
 *      yesno prompts for operator input and compares it to the string.
 *      if the -c option is present both strings are converted to caps before
 *      the comparison.
 *
 * Copyright 14-Feb-86  by Joanne Dow   - released for free distribution as
 * long as this copyright notice is retained in the file.
 *
 */


#include "stdio.h"
#include "ctype.h"

#define NO      6       /* > warn level exit code */
#define YES     0       /* No warning exit code   */
#define SIZE    81      /* Size of read buffer      */

main(argc, argv)
char *argv[];
{
int caps;
char chxxx[SIZE], *pch;

if (argc <= 1)
        {
        printf("No arguments\n");
        exit(NO);               /* exit false */
        }
caps = ((argc > 1) && (argv[2][0] == '-') && (argv[2][1]) == 'c');
     
pch = fgets( &chxxx[0], SIZE, stdin);
chxxx[strlen(pch)-1] = '\0';
if (caps)
        {
        while (*pch = toupper(*pch)) pch++;
        printf("\n");
        pch = argv[1];
        while (*pch = toupper(*pch)) pch++;
        pch = &chxxx[0];
        }
if (strcmp(argv[1], pch) == 0) exit(YES);
else exit(NO);
}

----------------------------------------------------------------------------

>2) I seem to be having trouble when swapping disks (I only have one drive), in
>getting the system to recognize that the new disk is different.  It is a royal
>pain having to reboot everytime I change applications.  Is there something I am
>missing out on?  (Ex.  I boot on my workbench disk, do some system things, and
>decide to play on Dpaint awhile.  When I pop out workbench and put in the Dpaint
>disk the system flashes a requestor on the screen for the workbench disk.)

   The system KNOWS the new disk is different.  All of the system paths
(C:, L:, etc) are assigned to the disk you booted with.  If the DPaint
disk had the "assign" command on it, it might be possible to write
a reasonable script to handle reassigning the system paths. But it
probably wouldn't work with DPaint anyway, because they do some
fooling around when they boot.  The program probably would not work
if you simply transferred control to the disk.

>3) How do I get my preferences onto the Dpaint disk?  I don't think this is
>all that crucial, but I don't like the original arrow pointer.  So I drew my own
>(after all, thats what preferences is for right?)  The only problem is that
>Dpaint uses the pointer that I hate; and I want my own!!
>

   I would NOT suggest writing to your DPaint disk.  I have heard many
stories of trashed DPaint disks caused by writing to the disk.
I believe they have some crucial code or data on the disk which can
be wiped out if you save to the disk.  If the disk could be written to,
you could copy your WorkBench devs/system-configuration file to it.
     
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Carolyn Scheppner -- CBM   >>Amiga Technical Support<<
                     UUCP  ...{allegra,caip,ihnp4,seismo}!cbmvax!carolyn
                     PHONE 215-431-9180
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=