|
I wan to make a simple calculator with 3 edit box 2 of them to insert the values and the other for the result. Mi problem is that when i insert the numbers and make the operation the storage the values and in the next operation i can't change it.This is what i wrote.Thanks for your help.
void CPractica6Dlg::OnMultiply()
{
UpdateData(TRUE);
m_result=m_numA*m_numB;
}
void CPractica6Dlg::OnCalculate()
{
UpdateData(FALSE);
}
|
|
|
|
|
My suggestion would be to nix the calls to UpdateData() . Then create three CEdit member variables, one for each edit control. Now in the OnMultiply() method:
void CPractica6Dlg::OnMultiply()
{
CString strA,
strB,
strC;
m_editA.GetWindowText(strA);
m_editB.GetWindowText(strB);
strC.Format("%d", atoi(strA) * atoi(strB));
m_editC.SetWindowText(strC);
}
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Will it work?
void CPractica6Dlg::OnMultiply()
{
UpdateData(TRUE);
m_result=m_numA*m_numB;
UpdateData(FALSE);
}
http://www.priyank.in/
|
|
|
|
|
No it doesn't work i have the same problem.
|
|
|
|
|
|
I dont know what you mean?
Sorry i'm a little bit new with visual c++.
is this what are you talking about?
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPractica6Dlg)
DDX_Text(pDX, IDC_NUMA, m_numA);
DDX_Text(pDX, IDC_NUMB, m_numB);
DDX_Text(pDX, IDC_RESUL, m_result);
//}}AFX_DATA_MAP
|
|
|
|
|
Situation out of control. Cease Fire!. But check the values of m_numA, m_numB & m_result by displaying in a message box jsut before the multiplication and just after the multiplication.
http://www.priyank.in/
|
|
|
|
|
Values
m_a=1
m_b=2
pick radiobuton +
pick solution
m_result=3
then I change values
m_a=3
m_b=4
radiobuton + activated
pick solution
m_result=3 and m_a and m_b changed to
m_a=1
m_b=2
but if i do this it works
m_a=3
m_b=4
radiobuton + activated but i pick it another time
pick solution
m_result=7
|
|
|
|
|
|
This is the problem with UpdateData() . If not used 100% correctly, it causes more problems than it solves.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I discover that if i push twice in the radio button it works. i thinks that is because when you change the radio button it dont reload the new values so if you pick twice in the same radio button satrt to work.
Any ideas to solve this???
|
|
|
|
|
How you r reading the values of the radio button, and which event you have trapped, is it double click.
http://www.priyank.in/
|
|
|
|
|
Is it possible to create an Event within a Service (running under LocalSystem), and then signal that same event from another process (i.e. a normal process)?
I tried setting the security descriptor for the event to enable 'all access' to 'everyone', but it doesn't seem to work - GetLastError returns '5: access is denied'.
Is it the case that the event object is exclusively reserved for the service?
|
|
|
|
|
1. Yes, you can.
2. Perhaps you created the security data incorrectly.
3. No - we do this all the time.
|
|
|
|
|
|
Create a named event. then any process can open that event and signal or detect it.
|
|
|
|
|
get the CEdit text, append what you to it, then refill you CEdit...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
What's wrong with toxcct's reply?
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
includeh10 wrote:
is it possible to append text to a normal CEdit?
Of course. The easiest way is to use SetWindowText() . But since you have a hangup with it, you'll need to use ReplaceSel() . To keep the insertion point at the "end" of the control, use SetSel() .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi,
I am using the below two line to execute an crystal report file from VC++. I can't able to see my report(Report is not displayed). i also specified the destination to window in the crystal control properties.
m_CrystalReport.SetWindowTitle("Trucks Loaded Report");
m_CrystalReport.PrintReport();
How can it invoked in other ways.. Urgent
Give me a touch... Regards,
Shanmuga Sundar.V
|
|
|
|
|
Hi,
Is there any API which gives the current downloading speed?
Thanks,
Vini
|
|
|
|
|
how to change background color of CRichEditCtrl?
includeh10
|
|
|
|
|
|
For other controls, the correct way would be with OnCtlColor() . However, I do not see a CTLCOLOR_xxx value for rich-edit controls.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
does CRichEditCtrl::SetBackgroundColor work ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|