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.
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.
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
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
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
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?
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