wws@rruxc.uucp (Still Searching) (05/24/91)
Hello: I need some advice and suggestions on a design. In addition to asking for help, I'm brainstorming on-line. Answers to some problems may become obvious as I write. So please forgive anything that looks ridiculously obvious; it didn't when I started this! I'm designing a window that needs to contain a scrolling list of alarms that are generated by various software modules when problems are detected. The main problem is selecting widgets that will satisfy all of the requirements I need to implement in a scrolled window of heterogeneous data. The window may be popped up and remain visible to display data as it's received. The list should scroll up when a new entry is added beyond the bottom border of the window. Users must be able to select entries, which are then highlighted, and then select an operation to release those entries from the list. They must also be able to enter a search pattern which can be used to locate entries containing the pattern. I'm having trouble choosing a set of widgets to satisfy all of the requirements. The current structure of the window is as follows: a FormDialog, activated from buttons or menus on other windows, which contains ------------------------------------------------------ | A Scrolled Window with a Bulletin Board workWindow | ------------------------------------------------------ --------------- a separator gadget --------------- (followed by 5 push-buttons) [QUIT] [LONG] [RELEASE] [RELEASE-ALL] [SEARCH] A scrolling text or list widget seems totally inappropriate because of the dynamic, real-time nature of the data. Plus, I need to have color-coded boxes next to each item to indicate severity. Each item in the scrolling list looks something like this: ------ Tue May 21 23:38:53 EDT 1991 000001 | *C | Text Describing The Nature Of The Problem. ------ All of the data comes from a linked list that I maintain. As entries are added to the linked list, I create widgets, add callbacks, and attach them to a bulletin board in the scrolled window. The box on the left contains a severity code and is colored Red or Yellow depending on the contents. This is easy with push-buttons. The data on the right contains a Date-Time Stamp and entry sequence number, followed by the description of the problem. The "LONG" button is supposed to allow the user to toggle between the short and long descriptions of the problem. I may have to resize all entries so that the long descriptions fit. That's no big deal, and horizontal scrolling helps. The "RELEASE*" buttons are for removing entries from the scrolling window after they've been selected with the mouse. I don't know whether or not a List Widget is a good choice because each item is two lines. Currently, I'm building each item in a buffer with sprintf and an embedded "\n", then building an XmString with XmStringCreateLtoR. The XmString is placed in the text portion of a push-button widget. So far, I've implemented each entry as a pair of Push-Button widgets which are attached to a Bulletin Board, which is the "workWindow" widget of the scrolling window. This looks nice because I've set the shadowThickness of the buttons on the right to 0 so that it looks like a nice list of text. This implementation makes it easy to identify the entry the user selects via a push-button callback which receives the appropriate pointer in the linked list which I maintain internally. Highlighting of selected entries can be done by switching the background and foreground colors in the callback. However, it is difficult to remove the selected entries from the display without redrawing the entire thing and re-doing all the callbacks. This causes a performance penalty and doesn't look nice while it's happening. A list widget seems appropriate for the text, and I could create the XmStrings just as I do now to make each item look like two separate lines. I guess it's easy to delete items from a list widget (never used one)? But the colored boxes on the left complicate the situation. I don't think I could attach them to a list or text widget. And since the Scrolled Window may only have one widget as the work window, I don't see how I could attach the boxes to one kind of widget and place the text in another kind of widget. Any advice and suggestions are welcome. In addition, I have the following questions: - How do I control the scrolling when data is added to the bottom of the list? I need to make the list scroll up without dragging the scrollbar with the mouse. This is to keep the most recent entries visible. I suppose there must be some XtScroll() function somewhere. (I've been away from the office for days and I don't have a decent reference library at home). - I know I can apply search patterns to the data that I maintain in a linked list, but how do I map the item matched in the linked list to the entry in the scrolled window? It's easy to map widgets to the linked list because the list pointers can be passed to the callback. Searching is easier in a text widget. But I'm not just dealing with text; those darn colored boxes - they're pretty, but a nuisance. Have I chosen the most appropriate widgets for this problem? Is there some better way? Do I need to "roll my own?" Thank you, Wayne Scott ---------------------------------------------- wws@bcr.cc.bellcore.com I'm just a soul whose intentions are good, Oh Lord, please don't let me be misunderstood.