peter@sugar.UUCP (Peter da Silva) (09/17/87)
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)
nj@ndmath.UUCP (Narciso Jaramillo) (09/18/87)
In article <770@sugar.UUCP>, peter@sugar.UUCP (Peter da Silva) says: > > 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)? > How about movable (i.e. Workbench-icon-like) gadgets? I've been toying with the idea of writing some for a program I've been thinking about (I'm basically a novice to Amiga programming, unless you count slow recursive-move reversi programs :-))...people have been suggesting using BObs for this purpose. I thought they already had mutually exclusive gadgets?...I guess not. Assuming they don't have, is there any other way to do the following sort of thing: hit one and "select" it, then hit another, selecting the second and deselecting the first. I guess that's mutual exclusion, isn't it. Or another thing: have a movable gadget and then an array of boxes, each of which is a gadget, so the user can 1) move the pointer over the movable icon, 2) press down the button, causing the box around the icon to highlight in some way, 3) drag the mouse, and as the mouse moves over different box gadgets, cause each of them to be selected (and the previous box deselected) in turn, 4) release the button, causing the icon to center itself in the current box, leaving the box so selected highlighted. Does that make sense? (Not, I might add, that I think it would have any practical application. It would just look good. :-)) There's probably an obvious way of doing this I'm not thinking about...