olivier@hpgnd.HP.COM (Olivier BORDES) (02/08/90)
>> / hpgnd:comp.sys.amiga.tech / schwager@ux1.cso.uiuc.edu (Mike Schwager) / 7:36 am Jan 30, 1990 / >> Hi, >> More troubles trying to get Risk to work. I've got a string gadget, >> and it seems to only want to display text in color 1, and with a >> background of color 0. I'm using a custom screen with a backdrop >> window, and the gadget is inside a smaller, superbitmap window. >> I've set the pen colors in the superbitmap window to various >> (legitimate) values. I've also messed with the drawing mode, all >> to no avail. My gadget insists on looking ugly. Anyone have any >> ideas? >> >> Jeez, this computer is interesting, but if it keeps taking me this >> long just to get stuff done, it'll be 1995 before I'm finished! >> *sigh* >> >> Thanks for any help. > -Mike Schwager >> ---------- Have you tried JAM2 as drawing mode ? Olivier Bordes olivier@hpgnd.hp.com
cs03513@athena.csus.edu (Jerry Garcia) (02/11/90)
I have a couple of questions about gadgets. First I am using power windows. The program that I am working on has a custom screen, and two borderless windows. Each window has several gadgets. I am using Lattice c. The first question That I have has to do with boolean gadgets and the necessary flags. I started by creating the first window with several string gadgets and one boolean gadget. When the boolean gadget was selected I wanted to save the info and close the window. I accomplished this by setting the following IDCMP flags, GadgComp, Relverfiy, GadgImmediate. By using the source debugger(CPR) I found that selecting these flags caused a message to be sent to the message port with the value of 32. Now I created a second window with several string and one boolean gadget. The boolean gadget was set up the same way. I open the second window first but when I select the boolean gadget nothing goes to the message port. What I need to know is how to get a message to the message port so I can deal with this event. The second question is a little more straight foward. When opening a window with more then one string gadget how do you get the first gadget to be activated so the user just starts entering data, and when he hits return to activate the next gadget? Thank in advance. Jerry
ml@ecerl3.ncsu.edu (02/12/90)
[ This was originally a direct reply, which bounced; I have gone ahead and posted it because maybe it is of sufficient general interest...] In a recent article to UseNet you wrote: ] ] I have a couple of questions about gadgets. First I am using power ]windows. The program that I am working on has a custom screen, and two ]borderless windows. Each window has several gadgets. I am using Lattice ]c. The first question That I have has to do with boolean gadgets and the ]necessary flags. I started by creating the first window with several ]string gadgets and one boolean gadget. When the boolean gadget was ]selected I wanted to save the info and close the window. I accomplished ]this by setting the following IDCMP flags, GadgComp, Relverfiy, ]GadgImmediate. ... ] ... Now I created a second window with several string and one boolean ]gadget. The boolean gadget was set up the same way. I open the second ]window first but when I select the boolean gadget nothing goes to the ]message port. What I need to know is how to get a message to the message ]port so I can deal with this event. Just guessing here, but... Probably although you have created two windows, you have not set them up to share a single IDCMP port, or you haven't set up both windows with the appropriate IDCMP flags (each window has its own set of flags). Therefore, all events in your second window are either (a) going to a different message port, or (b) going nowhere at all because window 2 has no message port. Use something to the effect of: /* Open first window, with an IDCMP port */ NewWinInfo.IDCMPFLags = GADGETUP | GADGETDOWN .... ; Window1 = OpenWindow(&NewWinInfo); /* Open second window. Do NOT create an IDCMP port */ NewWin2Info.IDCMPFlags = 0; Window2 = OpenWindow(&NewWin2Info); /* Copy window 1's message port to window 2 */ Window2->UserPort = Window1->UserPort; /* Now that window 2 has a port, set up its IDCMP flags appropriately. */ ModifyIDCMP(Window2, IDCMP-flags-of-your-choice-anything-except-zero); The things to note are: If a windows UserPort is NULL, and you call ModifyIDCMP on it with nonzero flags (including indirectly in an OpenWindow() call) then the port will be created. If a window's UserPort is not NULL, and you call ModifyIDCMP() on it with flags=0; then the port will be closed. The port is a standard message port (created with CreatePort()) so you can open or close it yourself using CreatePort() and DeletePort(). Just make sure you don't call CloseWindow() with the window's UserPort not set to NULL if you close it yourself using DeletePort(). IE, something like this is fine: Port = CreatePort(...) NewWinInfo.IDCMPFlags = 0; Window1 = OpenWindow(...) Window2 = OpenWindow(...) Window1->UserPOrt = Window2->UserPort = Port; ModifyIDCMP(Window1,...) ModifyIDCMP(Window2,...) while... WaitPort(Port) ... GetMsg(Port)... Window1->UserPort = Window2->UserPort = NULL; CloseWindow(Window1); CloseWindow(Window2); DeletePort(Port); In truth, the above example is not wholly correct. There are some subtleties involved in closing windows with shared message port. I believe CBM has freely distributed a routine called CloseWindowSafely() that you should find, or I can email you something equivalent. It would take too long to go into these subtleties here. If any one has any interest in it, I have a program I wrote a while back for our local users' group which is a sort of "GadgetLab" -- a rather extensive (perhaps overly so :-) demo of doing Gadget Programming, and it does show the use of shared message ports. I sent a copy a while ago to both Fred Fish & the amiga.source newsgroup, but in both cases it seems to have fallen into a black hole. If there's sufficient interest, I suppose I can try again. I figure that with 1.4 looming in the not too distant future, it (gadget program) will probably be obsolete before too long anyways, so I haven't made much effort to distribute it. ] The second question is a little more straight foward. When opening a ]window with more then one string gadget how do you get the first gadget to ]be activated so the user just starts entering data, and when he hits return ]to activate the next gadget? There is an ActivateGadget() function which activates a string gadget. Syntax: success = ActivateGadget(gadget,window,requester) as far as activating a sequence of them is concerned, I suppose the way to do it is call ActivateGadget() on each next gadget in the chain whenever you get the GADGETUP event (hitting the RETURN key) for the N'th gadget in the chain. I haven't tried this though... Hope this helps! -- ==[ ml@eceris.ncsu.edu (128.109.135.109) ]== ==[ ml@eceris.ncsu.edu (128.109.135.109) ]==
stevep@galadriel.bt.co.uk (Steve Paine) (02/13/90)
From article <1990Feb11.214506.20400@ncsuvx.ncsu.edu>, by ml@ecerl3.ncsu.edu: > ] The second question is a little more straight foward. When opening a > ]window with more then one string gadget how do you get the first gadget to > ]be activated so the user just starts entering data, and when he hits return > ]to activate the next gadget? > > There is an ActivateGadget() function which activates a string gadget. > Syntax: Is this ActivateGadget function from 1.3AmigaDos? I cant find it in my (V1.2 i think) Intuition Manual. Steve Paine. P.S. Ive just posted a similar question to the net, sorry about that, I must learn to read then post rather than post then read! Oh well at least it proves that there was interest in the original article anyway.
peter@cbmvax.commodore.com (Peter Cherna) (02/13/90)
In article <1990Feb10.221204.9516@csusac.csus.edu> cs03513@athena.UUCP (Jerry Garcia) writes: > > > I have a couple of questions about gadgets. First I am using power >windows. The program that I am working on has a custom screen, and two >borderless windows. Each window has several gadgets. I am using Lattice >c. The first question That I have has to do with boolean gadgets and the >necessary flags. I started by creating the first window with several >string gadgets and one boolean gadget. When the boolean gadget was >selected I wanted to save the info and close the window. I accomplished >this by setting the following IDCMP flags, GadgComp, Relverfiy, ^^^^^^^^ ^^^^^^^^^ >GadgImmediate. By using the source debugger(CPR) I found that selecting ^^^^^^^^^^^^^ >these flags caused a message to be sent to the message port with the value >of 32. Now I created a second window with several string and one boolean >gadget. The boolean gadget was set up the same way. I open the second >window first but when I select the boolean gadget nothing goes to the >message port. What I need to know is how to get a message to the message >port so I can deal with this event. First, be careful not to confuse flags of different purpose. The IDCMP flags that relate to gadgets are GADGETUP and GADGETDOWN (MOUSEMOVE can also be useful). Gadgets themselves have two flags fields, "Flags", and "Activation". GADGHCOMP is a value for the "Flags" field that tells Intuition how to highlight your gadget, while RELVERIFY and GADGIMMEDIATE are values for the "Activation" field that explain when you want messages sent. The message of value 32 is a GADGETDOWN IntuiMessage. (see intuition.h for the definitions). Normally, each window has its own message port, and you can wait on both simultaneously and wake up when a message arrives at either one. You must use the Wait() function of Exec, and not the WaitPort() function, if you wish to wait on multiple ports. The often-found expression 1 << win->UserPort->mp_SigBit is just extracting the signal bit associated with your window's message port and converting it to a mask. So you might say /* Calculate signal masks for each window: */ awinmask = 1 << awin->UserPort->mp_SigBit; bwinmask = 1 << bwin->UserPort->mp_SigBit; /* Wait on both signals */ signal = Wait(awinmask | bwinmask); if (signal & awinmask) { /* Got something at window a */ while (imsg = GetMsg(awin->UserPort)) { /* Do stuff here, including ReplyMsg() */ } } if (signal & bwinmask) { /* Got something at window b */ while (imsg = GetMsg(bwin->UserPort)) { /* Do stuff here, including ReplyMsg() */ } } Alternatively, you can set up several windows to have the same message port. > The second question is a little more straight foward. When opening a >window with more then one string gadget how do you get the first gadget to >be activated so the user just starts entering data, and when he hits return >to activate the next gadget? Call ActivateGadget() to activate the string gadget. Note that the opening of the window is asynchronous, so if you do OpenWindow(...); ActivateGadget(...); it may not get activated (if the window was not fully open when the ActivateGadget() call was processed. The correct way is to also listen for ACTIVEWINDOW IDCMP messages and then ActivateGadget(). > Thank in advance. > Jerry Peter Cherna, Software Engineer, Commodore-Amiga, Inc. {uunet|rutgers}!cbmvax!peter peter@cbmvax.cbm.commodore.com My opinions do not necessarily represent the opinions of my employer.
p554mve@mpirbn.UUCP (Michael van Elst) (02/18/90)
In article <577@galadriel.bt.co.uk> stevep@galadriel.bt.co.uk (Steve Paine) writes: >> There is an ActivateGadget() function which activates a string gadget. >> Syntax: >Is this ActivateGadget function from 1.3AmigaDos? I cant find it in my (V1.2 i >think) Intuition Manual. There is no V1.2 Intuition Manual. There is an 1.1 Manual and the new redesigned 1.3 Manuals. Activate Gadget was introduced in V1.2. You probably should get the new Manuals. For those who already have the old (1.1) ones, it should be sufficient to buy the RKM Manual:Includes&Autodocs, since most things didn't change and those that are new to 1.2 or 1.3 are understandable from the library summaries in the I&A manual. Michael van Elst uunet!unido!mpirbn!p554mve