CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 1999
    Posts
    3

    Expanded view of frame



    Hi,


    I have to make a dynamic expandable Frame. Means by default only one portion of

    the Frame has to be visible and depending on the action in that portion the rest

    part of the frame should be visible. e.g. after clicking one button on the

    visible frame.


    Can somebody help me regarding this.


    Thanks


    ..praks

  2. #2
    Join Date
    Mar 1999
    Posts
    9

    Re: Expanded view of frame



    Hi praks,


    I have 2 suggestions for ur problems:


    1. Disable all components that u wish to hide and then say on click of a button

    make them visible(setVisible(true)).This might be tedious if u have more number

    of components in ur container.


    2.Divide ur froam into suitable panels and only enable a single panel when the

    the window opens up.Later,the panels could be enabled based on soem events


    if u have better solutions,pl let me know


    bset wishes

    thiru

  3. #3
    Join Date
    Mar 1999
    Posts
    37

    Re: Expanded view of frame



    I just did exactly the same thing yesterday! Here's how it works for me:


    - instantiate and load all the components in a frame

    - the ones that shouldn't be displayed initially must be set like this:


    component.setPreferredSize(new Dimension(0, 0));

    component.setMaximumSize(new Dimension(0, 0));

    component.setMinimumSize(new Dimension(0, 0));


    - when the button is clicked (or, on any other suitable event), do this:


    private void showEverythingAndResize(){

    component.setPreferredSize(new Dimension(60, 25));

    component.setMaximumSize(new Dimension(65, 25));

    component.setMinimumSize(new Dimension(50, 25));

    Rectangle r=f.getBounds();

    r.setSize(r.width+1, r.height);

    frame.setBounds(r);

    }


    Alex

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