|
DUH!
I knew it was something simple...
Kitty5
|
|
|
|
|
Ok, I've figured out how to get the dialog boxes to exchange data.
Now I'm trying to figure out how when you have one dialog box open how you can open another one while the 1st box is still open and functioning.
Right now when I have a dialog box open I can only work in the one box and can't click on anything outside it (i.e. clicking on the toolbar to open another dialog box or getting the about box to come up isn't working...)
I guess I'm looking for making these dialog boxes work like child forms in an MDI MFC App.
Thanks,
Kitty5
-- modified at 9:17 Friday 21st July, 2006
|
|
|
|
|
kitty5 wrote: void manual::OnManual()
{
manual manualDlg;
manualDlg.DoModal();
}
Is this right? I've never seen a dialog's method bring up another instance of itself.
Why do you not have two CEdit member variables in manual , one for each of the edit controls?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: kitty5 wrote:
void manual::OnManual()
{
manual manualDlg;
manualDlg.DoModal();
}
Is this right? I've never seen a dialog's method bring up another instance of itself.
I copied exactly what the MFC App wizard did for the AboutBox that it provides.
DavidCrow wrote: Why do you not have two CEdit member variables in manual, one for each of the edit controls?
Yes, one for each edit control... Actually, I changed the "Variable Type" to CString and the "Category" to Value (This was all done when you right click on the edit box and click on "Add Variable".
Did I do something wrong?
Kitty5
|
|
|
|
|
kitty5 wrote: I copied exactly what the MFC App wizard did for the AboutBox that it provides.
Unlikely. That code would most likely resemble:
void CMyDialog::OnManual()
{
CAboutDlg about;
about.DoModal();
} Note how the two dialog objects are different.
kitty5 wrote: Yes, one for each edit control... Actually, I changed the "Variable Type" to CString and the "Category" to Value (This was all done when you right click on the edit box and click on "Add Variable".
Did I do something wrong?
I personally do not use CString for edit controls. That's what CEdit was designed for. Use its SetWindowText() method, rather than UpdateData() , and you'll have far less problems.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
I am using Visual C++ 2005 to write code a win32 console application.
There was an error message about the power function when I compiled the code. It is: error c2668: 'pow' :ambiguous call to overloaded function.
The statement is:
tempDistance += pow((data[selectedInstance][k]-data[j][k]),2);
I used various headers like: cmath and math.h
but the error message remained the same.
What is the cause of the error? I've checked the syntax and it seems correct.
-- modified at 13:30 Wednesday 19th July, 2006
|
|
|
|
|
KaKa` wrote: There was an error message about the power function when I compiled the code. It is: error c2668: 'pow' :ambiguous call to overloaded function.
Apparently there's more than one pow() function. Which one do you want to use?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
how is defined the data matrix (what type) ?
i think it contains values other than int , that's why the compiler doesn't know which function to call (pow(int, int) or pow(double, double) ?? ).
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
I'm thinking that it could have something to do with your data types... are all your variables "int", or are you mixing types?
Patrick
|
|
|
|
|
If you couldn't figure out the problem, why don't you write your own pow() function? It's simple...
|
|
|
|
|
cppcook wrote: If you couldn't figure out the problem, why don't you write your own pow() function? It's simple...
Simple for integer exponents ... not so simple for decimal exponents.
As for the original post, my guess is that you are mixing types (that is, raising a double by an integer power). While there is nothing wrong with that, pow is usually defined:
From MSDN:
double pow(
double x,
double y
);
double pow(
double x,
int y
);
double pow(
int x,
int y
);
float pow(
float x,
float y
);
float pow(
float x,
int y
);
long double pow(
long double x,
long double y
);
long double pow(
long double x,
int y
);
float powf(
float x,
float y
);
Try explicitly casting your types:
double base = 3.0;
int power = 5;
int result = pow(base, (double)power);
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Is a result of implicit casts being available. Explicitly case each parameter to the datatype to use that matches one of the pow formal parameter lists.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
If you know nothing about function overloading just cast both parameters to (double) and it will compile.
tempDistance += pow(((double)data[selectedInstance][k]-data[j][k]),2.0);
|
|
|
|
|
Thanks all for the replies.......i used the simple way and cast both parameters to double and it can work now.
|
|
|
|
|
Hi everyone,
I have an Edit box in a dialog with multiline property and four scroll bar properties checked. A text file is read into the edit box. The file is tab spaced structured data file (40 rows, but with thousands of columns). The problem is the edit box will break the row in the original file into several rows and display it. This makes the data looks unstructured and disordered. I know this is because the row is too long so the Edit box wraps words automatically. But can we avoid this?
thanks,
gavin
|
|
|
|
|
Does the WS_HSCROLL style help?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thanks David,
I checked all the four scroll properties, Horizontal scroll, Auto Hscroll, Vertical Scroll, Auto Vscroll. But it didn't help.
Gavin
|
|
|
|
|
Does your text happen to have any embedded CR OR LF characters in it? I just tried this by entering a long line of text into a narrow edit control and it scrolled vertically until I hit Enter.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Yes. The text file has newline characters in it. The edit box will jump to a new line after a limited length of characters even if it doesn't meet a CR or LF character. While this is not what I want. thanks anyway.
gavin
|
|
|
|
|
|
Looking at this syntax, I can't quite see what the end result should be. What does this function return?
long comm_fm_node_id(comm_fm_dev_t *dev, long group) {
return (group == 0) ? MCAST_nodeid : -1;
}
Patrick
|
|
|
|
|
if(group == 0)
return MCAST_nodeid;
else
return -1;
|
|
|
|
|
it means :
long comm_fm_node_id(comm_fm_dev_t *dev, long group) {
if (group == 0) {
return MCAST_nodeid;
}
else {
return -1;
}
}
but i really don't see what dev is passed to the function if it doesn't use it, and i suspect MCAST_nodeid to be a global variable...
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
Dev isn't used because it's only a partial implementation... I'm trying to finish the implementation...
Thanks for your help.
Patrick
|
|
|
|
|
pgav wrote: long comm_fm_node_id(comm_fm_dev_t *dev, long group) {
return (group == 0) ? MCAST_nodeid : -1;
}
By the way, be VERY judicious when using the ternary operator (which is what the expression ? result_if_true : result_if_false is called). Most of the time, it is far more clear to write:
if (expression)
{
return SomeValue;
}
else
{
return SomeOtherValue;
}
I can't tell you how many bugs I've run into because people tried to get fancy with the ternary operator and do things like:
return expression1 ? expression2 ? expression4 ? 1 : 0 : 3 : expression3 ? 2 : 4;
If you run into something like that, you should hunt down the person who wrote it, take them out behind your office, and ... well, you get the idea.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|