Variables and functions in user defined functions
-
When creating a dialog based MFC application in VC++.net how does one utilize control variables and other function like UpdateData() inside a user defined function?
-
When creating a dialog based MFC application in VC++.net how does one utilize control variables and other function like UpdateData() inside a user defined function?
-
When creating a dialog based MFC application in VC++.net how does one utilize control variables and other function like UpdateData() inside a user defined function?
i don't understand either, but why should it be different to call a these functions in a user defined function from a non one ??? of course, you cannot call everything (
UpdateData()
is MFC specific), but you call it the same way...
TOXCCT >>> GEII power
[toxcct][VisualCalc] -
So I wrote my own function which is called when I click a button. I defined and declared it in the main source file. I also associated some variables with some edit boxes through the setup wizard. When I try to use these edit box variables within the body of my function I get a linker error. The same happens when I try to use UpdateData() in my function. The only way I've found to use the variables in my function is to declare them at the top of the file - but then there are other errors because they are not defined where the rest of the code expects to find them - in the public section of the header file. I'm sure this is something really simple to fix but in my limited experience I just haven't yet come across a solution.
-
So I wrote my own function which is called when I click a button. I defined and declared it in the main source file. I also associated some variables with some edit boxes through the setup wizard. When I try to use these edit box variables within the body of my function I get a linker error. The same happens when I try to use UpdateData() in my function. The only way I've found to use the variables in my function is to declare them at the top of the file - but then there are other errors because they are not defined where the rest of the code expects to find them - in the public section of the header file. I'm sure this is something really simple to fix but in my limited experience I just haven't yet come across a solution.
Well definately you should not declare those variables, they should be declared (and inserted into sourcecode) when you create them by wizard. I dont use VC.NET, just a classical VC 6, but it works this way: I have main dialog, it is a class, it has two sourcefiles, header classfile.h and code classfile.cpp. When I insert a button and add a function to it it creates a function (OnButton1 for example) which is member of the dialog class (it is defined in header and function code outline is inserted into cpp file). If i create a edit box and associate a variable to it its definition is added to header file. (are you sure you added it ? because if you add it and then click 'cancel' button, then changes are lost, you have to click 'Ok' button in the wizard). So now we have a function which is member of dialog class and a variables which are members of the dialog class. So they should see each other and they should be able to access each other... if this does not help then please post a build log or project files, where we can see what is the error.