Home » Community » Newbie corner » Difficulty with Class declaration
Re: Difficulty with Class declaration [message #26131 is a reply to message #26100] |
Sun, 04 April 2010 17:43 |
brokndodge
Messages: 8 Registered: March 2010 Location: in front of my computer
|
Promising Member |
|
|
IT COMPILES!!! I've spent a lot of time over the last several days reading every article Google yielded on c++ member functions and pointers. I still don't understand references and pointers, but I looked at me code last night and the solution just came to me. That's the way I learn I guess. I just need some time to absorb what I have read.
Anyway, I was reading thru the UDMS class, getting ready to just put everything into one huge file under one class, when I got to UDMS::ProspectDetailTab. It dawned on me that I wouldn't be able to point to Popups::member. I would need to point to a UDMS::member, then call Popups::member from there.
Came up with this solution:
main.h:
#ifndef main_main_h
#define main_main_h
#incluce <CtrlLib/CtrlLib.h>
using namespace upp;
#include "Popups.h" //has to come after "using namespace upp"
struct UDMS : TopWindow
{
private:
// a bunch of declarations
void CallToPopupsClass(); // new wrapper function
public:
typedef UDMS CLASSNAME;
UDMS();
Popups pop;
};
#endif
main.cpp
#include "main.h"
// a lot of code that will eventually be moved
// to another function
void CallToPopupsClass(); // new wrapper function
{ pop.QNHelpPopup();
return;
};
void ProspectDetailTab();
{ detail.QNHelpButton.WhenAction = THISBACK(CallToPopupsClass);
};
Thanks, cbpporter, for your insight. I've removed all references to UDMS from Popups. The circular dependency was preventing me from getting to the real problem: what I was trying to do just can't directly be done in c++. I'm working on figuring out a more dynamic way to call Popups class. Haven't gotten that far yet. Probably end up with a more dynamic inline function for my wrapper. I don't want 30 wrappers to Popups::members in main.cpp.
I think I understand what pointers and references are, but I'm having trouble with the when, where and why.
Next issue: try as I might, I'm having trouble with \n in a String. The newline sequence seems to be completely ignored. It's not showing up in the code, but it's also not resulting in a newline. I also tried crating my own popup window for this task with the same result.
String helpTxt= " CCI - Customer Called IN \n"
" RMC - Returned my Call \n"
" NA - No Answer \n"
"DC1,2,3,w - Phone 1,2,3,work Disconnected \n"
"LM1,2,3,w - Left Message on phone 1,2,3,work \n"
"APPT - Set Appointment \(open appointment popup\) \n"
" AC - Appointment Confirmed \n"
" NS - Didn't Show for Appointment \n"
"KEPT - Kept Appointment \n"
" NN - Enter New Note \n"
"Find - Open Find Prospect Popup";
//qnhelp.DoneButton.WhenAction = THISBACK(CallToStub); */
PromptOK(helpTxt);
The above code results in:
Quote: |
CCI - Customer Called IN RMC - Returned my Call NA - No Answer DC1,2,3,w - Phone 1,2,3,work Disconnected LM1,2,3,w - Left Message on phone 1,2,3,work APPT - Set Appointment (open appointment popup) AC - Appointment Confirmed NS - Didn't Show for Appointment KEPT - Kept Appointment NN - Enter New Note Find - Open Find Prospect Popup
|
Should look like:
Quote: |
CCI - Customer Called IN
RMC - Returned my Call
NA - No Answer DC1,2,3,w -
Phone 1,2,3,work Disconnected
LM1,2,3,w - Left Message on phone 1,2,3,work
APPT - Set Appointment (open appointment popup)
AC - Appointment Confirmed
NS - Didn't Show for Appointment
KEPT - Kept Appointment
NN - Enter New Note
Find - Open Find Prospect Popup
|
Where di I go wrong?
|
|
|
Goto Forum:
Current Time: Fri Jun 07 08:03:48 CEST 2024
Total time taken to generate the page: 0.02173 seconds
|