CEdit - Programmer

This is a discussion on CEdit - Programmer ; Hi NG As I mentioned in an earlier mail I have 3 different pictures "pictures used as buttons" in top of my program, which are used to change the look of the bottom of my program. If picture 1 is ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: CEdit

  1. CEdit

    Hi NG

    As I mentioned in an earlier mail I have 3 different pictures "pictures used
    as buttons" in top of my program, which are used to change the look of the
    bottom of my program. If picture 1 is clicked 4 boxes "CEdit boxes" and 2
    new buttons are showed in the bottom of my program. If button 2 is clicked
    only text will be showed in the bottom and so on.

    My question is:

    Where do I need to place the boxes and buttons the should be showed when
    picture 1 is clicked? If I place it in my constructor then they will be
    showed as well when I click picture 2, which they should not.

    Do I need only to create the window of my program in the constructor and
    then the buttons and text boxes in OnPaitnt?

    Thanks
    AHR



  2. Re: CEdit

    AHR wrote:

    > Hi NG
    >
    > As I mentioned in an earlier mail I have 3 different pictures "pictures used
    > as buttons" in top of my program, which are used to change the look of the
    > bottom of my program. If picture 1 is clicked 4 boxes "CEdit boxes" and 2
    > new buttons are showed in the bottom of my program. If button 2 is clicked
    > only text will be showed in the bottom and so on.
    >
    > My question is:
    >
    > Where do I need to place the boxes and buttons the should be showed when
    > picture 1 is clicked? If I place it in my constructor then they will be
    > showed as well when I click picture 2, which they should not.
    >
    > Do I need only to create the window of my program in the constructor and
    > then the buttons and text boxes in OnPaitnt?
    >
    > Thanks
    > AHR
    >
    >


    There is a messy way that is easy, and a nice way that is a bit harder.

    The messy easy way is, in the resource editor, put all the controls for
    all three displays on your main dialog or formview. Then in your code
    you use ShowWindow to make some controls visible, some controls
    invisible at each click.

    The nicer way is to create three modeless dialogs in the resource
    editor. Turn off the titlebar and border styles. This gives you three
    "panels" that can be displayed. You create all three dialogs. You will
    have to position them using MoveWindow to place them exactly on your
    "bottom". Then use ShowWindow to make one of them visible at each click.

    You asked where to do these things. Not constructor and not OnPaint.
    If you are making a dialog-based application use OnInitDialog. For a
    doc/view application use OnInitialUpdate. These are used to initialize
    the window and its controls before it first appears.

    --
    Scott McPhillips [VC++ MVP]


  3. Re: CEdit

    > There is a messy way that is easy, and a nice way that is a bit harder.

    I like the messy one, i am a newb )

    > The messy easy way is, in the resource editor, put all the controls for
    > all three displays on your main dialog or formview. Then in your code
    > you use ShowWindow to make some controls visible, some controls
    > invisible at each click.


    I do not use menues and dialogs. But can I create a CEdit box in the
    constructor and make it visible for picture 1 and invisible for picture 2? I
    use this code in the constructor:

    //**** ****
    edtDato.Create(WS_CHILD | WS_VISIBLE | WS_BORDER,
    CRect(CPoint(375,60),CSize(55,25)), this, 0);
    //**** ****

    How do I make it invisible "it's not WS_INVISIBLE"?

    Thanks for your help

    Regards
    AHR



  4. Re: CEdit

    > //**** ****
    > edtDato.Create(WS_CHILD | WS_VISIBLE | WS_BORDER,
    > CRect(CPoint(375,60),CSize(55,25)), this, 0);
    > //**** ****
    >
    > How do I make it invisible "it's not WS_INVISIBLE"?
    >


    Know that I make it invisible in the constructor like this:

    edtDato.Create(WS_CHILD | WS_BORDER,
    CRect(CPoint(375,60),CSize(55,25)), this, 0);

    But how do I change it in my code to visible again? Do I call edtDato with
    new parameters?

    AHR



  5. Re: CEdit

    AHR wrote:
    >>There is a messy way that is easy, and a nice way that is a bit harder.

    >
    >
    > I like the messy one, i am a newb )
    >
    >
    >>The messy easy way is, in the resource editor, put all the controls for
    >>all three displays on your main dialog or formview. Then in your code
    >>you use ShowWindow to make some controls visible, some controls
    >>invisible at each click.

    >
    >
    > I do not use menues and dialogs. But can I create a CEdit box in the
    > constructor and make it visible for picture 1 and invisible for picture 2? I
    > use this code in the constructor:
    >
    > //**** ****
    > edtDato.Create(WS_CHILD | WS_VISIBLE | WS_BORDER,
    > CRect(CPoint(375,60),CSize(55,25)), this, 0);
    > //**** ****
    >
    > How do I make it invisible "it's not WS_INVISIBLE"?
    >
    > Thanks for your help
    >
    > Regards
    > AHR


    The answer to both of these questions were in my earlier reply. Use
    edtDato.ShowWindow() to hide or show the edit control. Do not create
    controls in the constructor: Create them in OnInitDialog.

    --
    Scott McPhillips [VC++ MVP]


  6. Re: CEdit

    > The answer to both of these questions were in my earlier reply. Use
    > edtDato.ShowWindow() to hide or show the edit control. Do not create
    > controls in the constructor: Create them in OnInitDialog.
    >
    > --
    > Scott McPhillips [VC++ MVP]


    Thanks Scott )

    I used the ShowWindow with a TRUE and FALSE value and it worked. Now I only
    need to put the controls from my constructor into the OnInitDialog.

    AHR



+ Reply to Thread