CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Panels

  1. #1
    Join Date
    Dec 2008
    Posts
    87

    Panels

    At the moment in my program I have a menu bar and a variety of toolbars which all work perfectly fine. The program already has one panel which holds all the toolbars in but I now need to include another panel. This new panel will hold components in it and the background colour will be white.

    However I just can't seem to find a way to make this new panel work with the program. The panel will either completely hide the toolbar panel and the window will be all white (except for the menu) or the new panel won't show at all and only the toolbar panel will be visible. I have managed to get the panel showing by using width and height however I need the panel to stretch across the whole window.

    Basically I need to find a way to make the new panel start underneath the previous panel and stretch the entire window. Any help would be much appreciated and I am willing to post code if you need it

  2. #2
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: Panels

    Which LayoutManager are you using? The default LM probably won't do what you want. If your white panel should occupy all the frame that isn't taken by the toolbar panel, the easiest LM is probably BorderLayout. The white panel can be centre and the toolbar panel can PageStart/North or PageEnd/South.

    Programming is like sex: one mistake and you’re providing support for a lifetime...
    Michael Sinz
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  3. #3
    Join Date
    Dec 2008
    Posts
    87

    Re: Panels

    Yep BorderLayout is what I'm trying to use for the white panel but when I set it to centre it disappears completely. The toolbar panel is actually set to FlowLayout as I can position the different toolbars horizontally across the frame. The toolbar panel is set to FlowLayout.LEFT

  4. #4
    Join Date
    Dec 2008
    Posts
    87

    Re: Panels

    After a while of trying to get this to work I have managed to do it. Thankyou for your post as ultimately that helped fix the problem. I had assigned a BorderLayou position for the new panel but forgot to do that for the other one.

  5. #5
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: Panels

    Yes, there is a difference between the layout within a panel and the layout the panel sits in...

    If you're not failing every now and again, it's a sign you're not doing anything very innovative...
    W. Allen
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured