XmContainer Widget Scrollbars - HELP!

XmContainer Widget Scrollbars - HELP!

Post by jrsuga » Sat, 20 Dec 2003 05:47:50


am really at my wit's end on this problem and feel like I have tried
everything. Do any of you guys have a suggestion for me to try? I
know there's a lot of expertise in this group.

I have a container widget that I populate with icons. I really want
the container widget to create each new icon on a visible portion of
the container before attempting to create them outside of the viewable
area, thereby adding scrollbars. For example, if my container comes
up with room to display 3 rows and 9 columns of icons, it would be
nice if the first 27 icons I created took up the visible 3 rows and 9
columns. Instead, the container seems to limit the icons to only 2
rows and creates a horizontal scrollbar on my 19th icon (2 rows x 9
columns) and leaves the lower part of my container blank. I never get
a vertical scrollbar as the container seems to have made up its mind
it is only allowed to have 2 rows.

It would also be nice if when I resized the container widget, the
icons did whatever wrapping was needed to fit the size of the screen
if there was room available. My container widget seems to pay no mind
to resizing with the exception of getting rid of the horizontal
scrollbar if I widen it enough.

I am truly baffled by this. I'm sure it's something wrong I'm doing
but I can't figure out what.

Thanks for your help!
Julie


Below is the widget hierarchy of the relevant widgets:

XmMainWindow->XmPanedWindow->XmForm->XmScrolledWindow->XmContainer->Icon
Gadgets

Here's how each of these are created:

Creating the main window:

ac = 0;
XtSetArg(args[ac], XmNx, 102); ac++;
XtSetArg(args[ac], XmNy, 69); ac++;
XtSetArg(args[ac], XmNheight, 693); ac++;
mainWindow = XmCreateMainWindow(parent, (char *)"mainWindow",
args, ac);


Creating the XmPanedWindow (child of the main window):
ac = 0;
XtSetArg(args[ac], XmNspacing, 20); ac++;
XtSetArg(args[ac], XmNheight, 662); ac++;
panedWindow = XmCreatePanedWindow(mainWindow, (char
*)"panedWindow", args, ac);


Creating the XmForm Widget (child of the panedWindow widget):
ac = 0;
XtSetArg(args[ac], XmNresizePolicy, XmRESIZE_GROW); ac++;
XtSetArg(args[ac], XmNpaneMinimum, 220); ac++;
XtSetArg(args[ac], XmNallowResize, True); ac++;
ocwForm = XmCreateForm(panedWindow, (char *)"ocwForm", args, ac);


Creating the XmScrolledWindow Widget (child of the form):

ac = 0;
XtSetArg(args[ac], XmNscrollingPolicy, XmAUTOMATIC); ac++;
XtSetArg(args[ac], XmNtraversalOn, False); ac++;
XtSetArg(args[ac], XmNscrollBarDisplayPolicy, XmAS_NEEDED); ac++;
XtSetArg(args[ac], XmNscrolledWindowChildType, XmSCROLL_VERT);
ac++;
XtSetArg(args[ac], XmNx, 5); ac++;
XtSetArg(args[ac], XmNy, 17); ac++;
ocwScrolledWindow = XmCreateScrolledWindow(ocwForm, (char
*)"ocwScrolledWindow", args, ac);



Creating the XmContainer Widget (child of the scrolling window):

ac = 0;
XtSetArg(args[ac], XmNlayoutDirection,
XmLEFT_TO_RIGHT_TOP_TO_BOTTOM); ac++;
XtSetArg(args[ac], XmNspatialStyle, XmCELLS); ac++;
XtSetArg(args[ac], XmNspatialIncludeModel, XmFIRST_FIT);
ac++;
XtSetArg(args[ac], XmNspatialResizeModel, XmGROW_MAJOR);
ac++;
XtSetArg(args[ac], XmNspatialSnapModel, XmSNAP_TO_GRID);
ac++;

icon_container = (Widget)XmCreateContainer(parent,
"icon_container", args, ac);

XtVaSetValues(icon_cont
 
 
 

1. Scrollbar Widget Error (This may help)

2. two questions -- hiding widgets and scrollbars

Hi, I'm kind of new to Perl TK and have a couple of questions.

I have a grid of a large number of widgets in a scrolled box. There are
previous and next buttons below the scrolled area, which redefine the
values of the widgets each time they're clicked (using configure()).
This allows me to work with a large amount of data without having
memory problems (rather than having tens of thousands of widgets, which
causes problems).

Sometimes though some of the widgets (Radiobuttons, Labels and Entry
boxes) are not used. Is there any way I can make them disappear
completely, temporarily? I don't want to destroy them and have to
recreate them the next time they're needed, but neither do I want them
cluttering up the screen and taking up space. I've tried using
configure() to make them all the same color as the background, which
kind of works, but doesn't hide the radio buttons, and still takes up
space. Any ideas on this?

The other question is, when users scroll to the bottom of the scrolled
list and click the Next or Previous buttons, the next/previous list
starts out in the same position (the bottom or wherever) as the last
one. Is there any way to force a scrolled list to return to the top?
I'm using Scrolled and not Scrollbar by the way.

Bonus question: how do I set a 'Scrolled' widget so that clicking in
the gray area (not on the slider) jumps the list more than one element?

thanks for any help you can give.

Scott

3. Problem with scrollbar cooperating with text widget

4. Icon Widget, Container, and scrollbar problem

5. Problem of widget in canvas with scrollbar

6. Ruby/Tk: how to get Scrollbar to stay scrolled on non-scroll widget?

7. tkinter modifying multiple widgets with one scrollbar

8. Browser scrollbar and Flash scrollbar ? I need help!

9. Scrollbar problem with spreadsheet widget

10. widget blinks when using scrollbar

11. Scroll - what|where exactly wire widget and scrollbar?

12. text widget must follow end of text only if associated scrollbar is at bottom

13. Getting a scrolled widget's scrollbar from within an object

14. Getting rid of scrollbars in Scrolled widget

15. horizontal scrollbar doesn't work in right justified text widget