is it possible?

This is a discussion on is it possible? within the Windows Programming forums, part of the Platform Specific Boards category; Dear All, i have a dialog, four edit boxes on it, called R,S,Q1,Q2, I want to design when checking R<S,Q2 ...

  1. #1
    Registered User
    Join Date
    Oct 2003
    Posts
    38

    is it possible?

    Dear All,
    i have a dialog, four edit boxes on it, called R,S,Q1,Q2, I want to design when checking R<S,Q2 edit box is disable while Q1 still keeps able for user to enter value, when R>S,Q1 is disable while Q2 is enable, how to do that? Thank you.

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,855
    MFC or not?

    Look at the EN_CHANGE msg under the WM_COMMAND switch for the edit (or in MFC the OnEnChangeEDITNAME() )

    When the text in one changes then decide which edit will be disabled (ie S>R or R>S)
    and EnableWindow() // will be greyed depending on TRUE or FALSE
    ShowWindow() //will disappear if SW_HIDE or appear SW_SHOW

    I would hide both the edits Q1 and Q2.
    Wait until the user enters the two values. Then make the choice which to show.
    If the user changes the S or R then hide both, make the choice and show one.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    Registered User
    Join Date
    Oct 2003
    Posts
    38
    thank you, my idea was the same before, but i don't know how to
    do that, my program will check R>S or S>R when i click ok, but before i click, it doesn't know it should show Q1 or Q2, so i abort,
    one more thing, if i set Q1,Q2 as value, not control, it cannot use EnableWindow() function, if i set them as control, how can i get the values?
    Thank you

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,855
    Is this MFC?
    Is this MFC?
    Is this MFC?

    >> if i set them as control, how can i get the values?

    MFC
    GetWindowText()

    WIN32
    GetWindowText()
    GetDlgItemInt()
    GetDlgItemText()

    >>if i set Q1,Q2 as value, not control,

    use both. A value and a control.




    Is this MFC?
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  5. #5
    Registered User
    Join Date
    Oct 2003
    Posts
    38
    thank you,
    yes it is MFC,but how to set them both value and control? they just can be set as either value or control at one time, are they?

  6. #6
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,855
    This is for MSVC.NET v2003

    In the resource view;
    Open the dialog
    Add a class for this dialog by right clicking and selecting 'Add Class'
    ie CMyDialog

    select the control
    right click and select 'Add Variable'
    ie m_editMyEdit

    Select the edit
    double click (this should add a handler in the CMyDialog Class files)



    in the class view;
    select the class (CMyDialog)
    right click and select 'Add Variable'
    ie m_iMyEditValue

    In the handler set the value when the edits text changes.
    ie CString Text = m_editMyEdit.GetWindowText();
    m_iMyEditValue=atoi(Text);
    //now set the other edits as required

    Write a handler (member function) to set the other edits when the text changes.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21