|
Your version...
void Bread::setValues(double fat,double carb,int calor,double fiber)
{
dblFat = fat;
dblCarb = carb;
intCalor = calor;
dblFiber = fiber;
}
My old version...
void Bread::setValues(double fat,double carb,int calor,double fiber)
{
double
tmpfat = fat,
tmpcrb = carb,
tmpfbr = fiber;
int
tmpclr = calor;
}
... Sad is the day when a man realizes that he is an idiot!
Thank you so much for helping me to get this working. My program should be completed on time.
Travis
|
|
|
|
|
Hi Travis,
I'm happy to help, and I'm glad your code is working now.
One final suggestion if I may.
Its a little unusual in C++ to create a class object and then set it's values. Normally you would use a constructor to either assign values when the object is created, or set values to a sensible default. That way, whenever the object is used, it's member variables are guaranteed to have assigned values, and the problem you experienced would never arise.
In your case, your code could look something like this.
class Bread
{
public:
Bread(double fat,double carb,int calor,double fiber,
std::string filename);
void setValues(double fat,double carb,int calor,double
fiber);
std::string strFileName;
double dblFat;
double dblCarb;
double dblFiber;
int intCalor;
};
Bread.cpp might look something like this....
Bread::Bread(double fat,double carb,int calor,double
fiber,std::string filename)
{
dblFat = fat;
dblCarb = carb;
intCalor = calor;
dblFiber = fiber;
strFileName = filename;
}
int main()
{
Bread breadobject(1.1, 11.4, 60, 0.9, "White Slice");
dataOut(breadobject.strFileName, breadobject.intCalor,
2.2, 0.0, breadobject.dblFat, breadobject.dblCarb,
breadobject.dblFiber, 0.0, 0.0, 0.0, 0.0);
return 0;
}
Its your code of course, and this approach might not suite your purposes. Its all up to you.
Cheers
Dave
|
|
|
|
|
This may sound simple for you, but can anayone tell me how to insert a dialog box in an MDI app. I want the dialog box with several options to appear and float in front of the MDI!
|
|
|
|
|
Your question is not very clear. Do you want to insert dialogbox over an open MDI window. If yes, then create a new dialog in resources and set its type to child and invoke it at whatever event you want.
Otherwise, if you want to have a dialog appeared at some event. Just DoModal it.
It would be better if you elaborate your question a little.
"Aerodynamically, the bumble bee shouldn't be able to fly, but the
bumble bee doesn't know it so it goes on flying anyway." - Mary Kay Ash
My Articles
|
|
|
|
|
If I understand you correctly, you need to create a modeless dialog.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Hi,
I want to enable all the hot keys in my MFC application (in menu items, dialogs etc) after launching the application without pressing the ALT key. Is this possible, if yes how and where do I write the code.
eg. MS-Word shows the hot keys for menus when launched without pressing the ALT key.
At present the hot keys in my application are enabled only after I hit the ALT key.
Thanks,
PRJ
|
|
|
|
|
I think you should look for accelarators instead of Hotkeys .
i.e. you think ,you want your application to repond to Ctrl+s key combination for saving like it in MSWord .
is i am right??
"I Think this Will Help"
[Vote One Here,.....]
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
Right_Clk_Desktop->Properties->Appearance->Effects.
Uncheck ->"Hide underlined letters for Keyboarduntill Alt Key Pressed"
suhredayan There is no spoon.
|
|
|
|
|
Here is the scenario. I'm wondering why it won't work and how to fix it. Ms Visual C++.net. Create dialog based MFC Application called MyProject. Add function called MyFunction declared at top of ProjectDlg.cpp as follows:
int MyFunction(int num1, int num2);
Add defintion to bottom of ProjectDlg.cpp file:
int MyFunction(int a, int b)
{
UpDateData(TRUE);
return a+b;
}
Use as follows inside a button:
sum = MyFunction(int num1, int num2);
This doesn't work. I get the following message:
error C3861: 'UpDateData': identifier not found, even with argument-dependent lookup
Is there some way I should declare or define MyFunction in order that it can use the UpdateData function within my function?
|
|
|
|
|
a simple way is make MyFunction() a member function of your CProjectDlg class.
suhredayan There is no spoon.
|
|
|
|
|
Thank you for the response. Here's what I did.
in the MyprojectDlg.h file I put the following:
class CMyProjectDlg : public CDialog
{
int CMyProjectDlg::MyFunction(int num1, int num2);
}
Alas, same error message:
error C3861: 'UpDateData': identifier not found, even with argument-dependent lookup
(this error occurs on the line using UpdateData() within MyFunction() but not when I use it outside of MyFunction)
Is this not the correct way to make MyFunction() a member of the MyProjectDlg class or is there some other problem, perhaps with the function definition? I would greatly appreciate any further help.
ss
|
|
|
|
|
SeanSheehan wrote:
error C3861: 'UpDateData': identifier not found, even with argument-dependent lookup
it is CWnd::UpdateData()
Not UpDateData()
Jetli
conclusion means Coming to wrong Decision with confidence
|
|
|
|
|
As per the suggestion I changed MyFunction() definition to:
int MyFunction(int a, int b)<br />
{ <br />
CWnd::UpDateData(TRUE);<br />
return a+b;<br />
}
However I now get two error messages:
error C2039: 'UpDateData' : is not a member of 'CWnd'
error C3861: 'UpDateData': identifier not found, even with argument-dependent lookup
|
|
|
|
|
SeanSheehan wrote:
class CMyProjectDlg : public CDialog
{
int CMyProjectDlg::MyFunction(int num1, int num2);
}
Change as follows:
class CMyProjectDlg : public CDialog
{
int MyFunction(int num1, int num2);
}
And in ur cpp file the definition should look like this:
int CMyProjectDlg::MyFunction(int num1, int num2)
{
..
..
..
}
suhredayan There is no spoon.
|
|
|
|
|
Made the suggested changes to both the delclaration and definition. The declaration is now:
class CMyProjectDlg : public CDialog<br />
{<br />
int MyFunction(int num1, int num2);<br />
}
in MyProjectDlg.h, and the definition is now:
int CMyProjectDlg::MyFunction(int a, int b)<br />
{ <br />
UpDateData(TRUE);<br />
return a+b;<br />
}
in MyProjectDlg.cpp, yet the same error message persists:
error C3861: 'UpDateData': identifier not found, even with argument-dependent lookup
Maybe this is not such a simple problem.
ss
|
|
|
|
|
SeanSheehan wrote:
UpDateData(TRUE);
Change to UpdateData(TRUE);
suhredayan There is no spoon.
|
|
|
|
|
Thats what i have told earlier with but he doesn't get the Simplest thing.
Jetli
Constant Thing In World Is Change.
|
|
|
|
|
Jetli Jerry wrote:
he doesn't get the Simplest thing.
I still remember those days of
suhredayan There is no spoon.
|
|
|
|
|
He's probably not observing the change in case.
Artificial intelligence is no match for natural
stupidity.
|
|
|
|
|
I'm sorry about the stupid question,but it's UpdateData() and
not UpDateData(),isn't it??????????
Eli
|
|
|
|
|
It is possible to add document/view architecture support to an ActiveX controls?
I have to develop an ActiveX control similar to drawcli sample stand alone application included in MSDN 2000.
if anyone has idea about this, please reply.
|
|
|
|
|
Hello all,
I'm having issues right now trying to start a new project. It involves connecting to remote mySQL databases and I'm running into compile issues with mysql.h and libmysql.dll.
The issue is that I'm not sure if I need ALL of mySQL installed onto this test machine or if there's a way to just get what I need to do the programming.
Thanks.
Lost in documentation.
--
David Coley
http://www.codecipher.com
|
|
|
|
|
i can not find regsvr32.exe on the win XP, where is it?
is there no regsvr32.exe on XP? how to register COM?
includeh10
|
|
|
|
|
It's in the C:\WINDOWS\system32
Igor.
|
|
|
|
|
did you see it there?
i can't find it, why?
includeh10
|
|
|
|