|
Mohammadj wrote: like multiply divide on the same button or Fahrenheit To Celsius and vice versa on the same button
The one you showed displays different texts not what I want
You seem to be contradicting yourself. "Multiply" and "Divide" are different, as are "Fahrenheit" and "Celsius."
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
As you can see the button have 2 hover states
What I intent to do
if the user clicked on the left half the button perform division or Fahrenheit to Celsius if the user clicked on the right half the button perform multiplication or Celcius to Fahrenheit
The button perform 2 operations depending which half you click
TY
|
|
|
|
|
Mohammadj wrote: The button perform 2 operations depending which half you click
Which is exactly what the article I pointed you to does, although it has 8 "sides."
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
it just displays different text loll
i want the button to perform 2 actions
|
|
|
|
|
Are you that inept that you cannot figure out that if the code is currently figuring out which one of eight sides of a button is being clicked and performing a single action (e.g., updating a listbox), it could easily be changed to perform eight separate actions instead?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
|
I want code snippets to add!#?
|
|
|
|
|
i need the the code to add
|
|
|
|
|
it is complicated
it uses user definded messeges etc !~
ty
|
|
|
|
|
Mohammadj wrote: it is complicated
Only because you're making it that way.
Mohammadj wrote: it uses user definded messeges etc !~
And what is that supposed to mean? Are we not going to be able to read your code as a result? I provided you with code that does 90%, if not more, of what you require. Just how hard is it to come up with the balance?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi
Can you provide with code needed for it
Reflected message etc user defined message etc
any code necessary and needed to make it work??
|
|
|
|
|
Mohammadj wrote: Can you provide with code needed for it
It's all right here.
Mohammadj wrote: any code necessary and needed to make it work??
As a programmer, that's your job.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
|
Mohammadj wrote: I,am new can you add the code to http://www.4shared.com/file/105379147/23d04050/dualactionmfcbutton.html[^]
No I can't. Good luck.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
helo
Here is the code i made it did not work loll
Sorry
It compiled but it did not work loll
Here is the code i wrote in
void C_Double_Task::OnClicked()
{
DWORD dwpos = GetMessagePos() ;
CPoint pt ;
pt.x = LOWORD(dwpos );
pt.y = HIWORD(dwpos) ;
CRect client_rectangle ;
GetClientRect( client_rectangle) ;
CString strA , strB ;
double db_a ,db_b ;
GetParent()->GetDlgItemText(IDC_NUM1,strA) ;
GetParent()->GetDlgItemText(IDC_NUM2,strB) ;
db_a = atof(strA);
db_b= atof(strB);
double result ;
result = db_b + db_a ;
CRect leftRect ;
leftRect = client_rectangle ;
leftRect.right = client_rectangle .left +client_rectangle.Width()/2;
if(leftRect.PtInRect(pt))
result = db_b - db_a ;
CString Str_result ;
Str_result.Format("%3.2f",result);
GetParent()->SendMessage(UDM_REGION_CLICKED, result);
}
and
LRESULT CHashiDlg::OnRegionClicked( WPARAM wParam, LPARAM lparan12 )
{
CString resl ;
resl.Format("%3.3",wParam);
SetDlgItemText( IDC_RESULT , resl) ;
return (0);
}
|
|
|
|
|
What doesn't work? Does OnClicked() get called? Does OnRegionClicked() receive the message? Is the value of result correct? What does wParam contain?
[edit]
I just made a few changes to that article I pointed you to and it worked fine.
[/edit]
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi
I made this on OnClicked ( the derived custom button)
void C_Double_Task::OnClicked()
{
DWORD dwpos = GetMessagePos() ;
CPoint pt ;
pt.x = LOWORD(dwpos );
pt.y = HIWORD(dwpos) ;
CRect client_rectangle ;
GetClientRect( client_rectangle) ;
CRect leftRect ;
leftRect = client_rectangle ;
leftRect.right = client_rectangle .left +client_rectangle.Width()/2;
IsRight = TRUE ;
if(leftRect.PtInRect(pt))
IsRight = FALSE ;
GetParent()->SendMessage(UDM_REGION_CLICKED, 12);
}
all what do is to set flag if on the right half or left half
LRESULT CHashiDlg::OnRegionClicked( WPARAM wParam, LPARAM lparan12 )
{
UpdateData();
double num1 , num2 , result ;
num1 = atof(m_strNum1);
num2 = atof( m_strNum2);
result = num1 + num2 ;
if (m_two_actions_botn.OnRight() )
result = num1 - num2 ;
m_str_Result.Format("%3.2" ,result);
UpdateData(FALSE);
return (0);
The OnRegionClicked check the flag throught fubction onRight and perform addition or subtraction depending on the value of IsRight ''
it also did not succeed loll
|
|
|
|
|
Did you even bother to read and understand the code in the article I pointed you to 10 days ago? The changes I made to it (to have a two-sided button rather than an eight-sided button) took no more than three minutes.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi there guys!
I wrote a BigNum class with two operations (addition and subtraction) and it consists of an array of integers. But lets suppose I read two numbers, with the following digit separation:
120 43 353 54 345
54 345 455 34 344
This is in base ten. Adding them together I get:
174 388 808 88 689
Which, obviously, is wrong. I used the standard addition algorithm, and it seems correct, so my question is: after "manipulating" the values, how can I print them correctly in base 10? Or do I need to keep a byte string with the digits and start from there?
Best regards
Fratelli
|
|
|
|
|
How you will read big num & fill it in array of int?
AndreFratelli wrote: I used the standard addition algorithm
Please past code over here.
Do not trust a computer...
Always check what computer is doing
regards,
Divyang Mithaiwala
Software Engineer
|
|
|
|
|
Your "digit separation" does not make sense to me.
Looks like you forgot the carry (even though you say you used the standard addition algorithm)
Converting to base 10 is easy, but not trivial (you can not convert every integer to base 10 and then concat them, I hope you didn't even think of that as a possibility)
|
|
|
|
|
AndreFratelli wrote: ...with the following digit separation:
120 43 353 54 345
54 345 455 34 344
Is it normal to have some groups of 2 and others of 3?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
AndreFratelli wrote: 120 43 353 54 345
54 345 455 34 344
You digit separation doesn't make sense. Do your operations make sense, instead?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi
Unable to install platform SDK on Vista Operating System.
Each time a information bar is populated when i click on Default.htm file .
Is there any other way to Install Plateform SDK . I have used many hit and trial methods .
|
|
|
|
|
pandit84 wrote: Each time a information bar is populated when i click on Default.htm file .
Did you choose the "Run as administrator" while running the setup? What error do you get?
|
|
|
|