home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!paladin.american.edu!darwin.sura.net!mips!sdd.hp.com!cs.utexas.edu!uwm.edu!ogicse!decwrl!oracle!pyramid!infmx!sdavid
- From: sdavid@.informix.com (David Sherrick)
- Newsgroups: comp.windows.open-look
- Subject: Deleting list items in OLIT 2.0
- Message-ID: <1992Aug20.000616.2647@informix.com>
- Date: 20 Aug 92 00:06:16 GMT
- Article-I.D.: informix.1992Aug20.000616.2647
- Sender: news@informix.com (Usenet News)
- Organization: Informix Software, Inc.
- Lines: 97
- Originator: sdavid@jupiter
-
-
- I am having a problem with deleting items from a scrolling list in
- OLIT 2.0 (on Sun 4/470). I have included sample code below that
- demonstrates the problem. Deleting items from the scrolling list
- works fine except when I delete the last item in the scrolling list. When
- I delete the last item in the scrolling list I get warnings:
- OPEN LOOK Toolkit Warning in application "test1":
- Scrollbar - Bad sliderMin resource value, set to default
- OPEN LOOK Toolkit Warning in application "test1":
- Scrollbar - Bad proportionLength resource value, set to default
-
- Furthermore, if I the item I am deleting is currently selected I
- will get a core dump when trying to select items from another
- scrolling list. Any help would be greatly appreciated.
-
- Thanks,
- David Sherrick
-
- #include <X11/Intrinsic.h>
- #include <X11/StringDefs.h>
- #include <X11/Shell.h>
- #include <Xol/OpenLook.h>
- #include <Xol/OblongButt.h>
- #include <Xol/Form.h>
- #include <Xol/ScrollingL.h>
-
- Widget sendList;
-
- OlListToken (*add_item)();
- OlListToken (*add_item2)();
- void (*delete_item2)();
-
- OlListToken mytoken;
- OlListItem userlist[] =
- {
- {OL_STRING, "One", NULL, 0, 0}
- };
-
- void RemoveCallback(widget, clientData, callData)
- Widget widget;
- caddr_t clientData, callData;
- {
- OlListItem *item;
-
- item = OlListItemPointer(mytoken);
- (*delete_item2)(sendList, mytoken);
- }
-
- int main(argc, argv)
- int argc;
- char **argv;
- {
- Widget toplevel, form, userList, removeButton;
- Arg args[20];
- int i, n;
-
- toplevel = OlInitialize("top","Top", NULL, 0, &argc, argv);
- form = XtCreateManagedWidget("form",
- formWidgetClass, toplevel, NULL, 0);
-
- n = 0;
- XtSetArg(args[n], XtNyAddHeight, (XtArgVal) TRUE); n++;
- XtSetArg(args[n], XtNviewHeight, (XtArgVal) 7); n++;
- userList = XtCreateManagedWidget("userlist",
- scrollingListWidgetClass, form, args, n);
- n = 0;
- XtSetArg(args[n], XtNapplAddItem, (XtArgVal) &add_item); n++;
- XtGetValues(userList, args, n);
-
- (*add_item) (userList, NULL, NULL, userlist[0]);
-
- n = 0;
- XtSetArg(args[n], XtNxRefWidget, userList); n++;
- XtSetArg(args[n], XtNlabel, "Remove"); n++;
- XtSetArg(args[n], XtNxAddWidth, (XtArgVal) TRUE); n++;
- removeButton = XtCreateManagedWidget("button",
- oblongButtonWidgetClass, form, args, n);
-
- n = 0;
- XtSetArg(args[n], XtNxRefWidget, removeButton); n++;
- XtSetArg(args[n], XtNxAddWidth, (XtArgVal) TRUE); n++;
- XtSetArg(args[n], XtNviewHeight, (XtArgVal) 7); n++;
- sendList = XtCreateManagedWidget("sendlist",
- scrollingListWidgetClass, form, args, n);
- n = 0;
- XtSetArg(args[n], XtNapplAddItem, (XtArgVal) &add_item2); n++;
- XtSetArg(args[n], XtNapplDeleteItem, (XtArgVal) &delete_item2); n++;
- XtGetValues(sendList, args, n);
-
- mytoken = (*add_item2) (sendList, NULL, NULL, userlist[0]);
-
- /* Widget Callbacks */
- XtAddCallback(removeButton, XtNselect, RemoveCallback, NULL);
-
- XtRealizeWidget(toplevel);
- XtMainLoop();
- }
-