Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!nuchat!sugar!peter From: peter@sugar.UUCP (Peter da Silva) Newsgroups: comp.sys.amiga Subject: Enhanced gadgets -- how to handle them. Message-ID: <770@sugar.UUCP> Date: Thu, 17-Sep-87 15:10:10 EDT Article-I.D.: sugar.770 Posted: Thu Sep 17 15:10:10 1987 Date-Received: Sat, 19-Sep-87 18:12:31 EDT Organization: Sugar Land UNIX - Houston, TX Lines: 99 I have been thinking for some time of implementing a higher level of functionality around the Amiga windows. The basic tool would be what I call "Extra Gadgets", like the scroll-bar-plus-name-list implemented in the "Standard File" file requestor or the "Instant Application" package I uploaded to the net. I started writing a package that would work rather like: xinit(); /* initialise extra gadgets */ xid = xadd_pane(win, top, left, height, width, n_items, get_item); /* struct Window *win; int top, left, height, width; int n_items; char (*get_item)(xid, index); int xid; int index; int xid; */ xmodify_pane(xid, new_n_items); /* call this when you want to get the list repainted. Say, a new directory has been selected */ xmsg = xprocess(win, msg); /* struct Window *win; struct IntuiMessage *msg; struct XMessage *xmsg; */ xdelete(xid); /* int xid; */ xterm(); You would use it like: xinit(); /* goes in your init code, somewhere near your OpenLibrary()s */ win = OpenWindow(NewWindow);... xid = xadd_pane(win...); /* At this point xadd_pane would link the text selection pane into the list the xgadgets package is building. It would also ModifyIDCMP the window to add the needed IDCMP and mouse event flags the xgadget needs. */ while(msg = (struct IntuiMsg *)GetMsg(win->...)) { if(xmsg = xprocess(msg, win)) { switch(xmsg->XCode) { case TEXTSELECTED: ... break; default: break; } } else { switch(msg->Code) { case RAWKEYS: ... break; ... } } ReplyMsg(msg); } /* finally */ xdelete(xid); CloseWindow(win); ... xterm(); I'd like to put this to the net: 1) Would you find such a set of tools useful? 2) What sort of implementation would you like? This seems pretty convenient, but maybe a more transparent version in which you provide an xGadgetList to XOpenWindow() would be more to your liking. 3) If I do this, would you be interested in creating such gadgets to add to the xlibrary? 4) Do you think xgadgets is too close to X-Windows, and in which case what is a better name? 5) What other xgadgets do you think would be handy? A set of mutually exclusive gadgets? A pop-up? An n-way selector? An improved string gadget (multiline, for example)? And more immediately: Should the text to appear in the pane be provided as a set of strings instead of a function to get the current string? I think this version is probably more versatile, as it allows the strings to be created when needed and imposes no upper limit to the set as an array or even a linked list (maintained in RAM) might. -- -- Peter da Silva `-_-' ...!hoptoad!academ!uhnix1!sugar!peter -- 'U` ^^^^^^^^^^^^^^ Not seismo!soma (blush)