|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Visual C++ 2005 Designer
Quote:
I might just have to go with panels. Only think I don't like about them is that hey are not as easy as form windows to arrange and close and open as you wish. Any other suggestions? |
|
#2
|
||||
|
||||
|
Re: Visual C++ 2005 Designer
I think what you are trying to do is call a method that is a member of the Parent class from a MDI child form of class Child. If that is not what you are trying to do then disregard the rest of this post, and I'm confused.
If you are trying call a method that is on the MDI parent form, then this has nothing to do with inheritance, other than that both classes must inherit from the System.Windows.Forms.Form class. Note that the Form class has a property called MdiParent that is a reference to the instance of the Form that is the MDI container. Now, to access methods that are members of the MDI parent, you have to cast that property as whatever class it really is. From what you posted, it would be: Code:
Parent^ myParent = dynamic_cast<Parent^>(this->MdiParent); Code:
myParent->SomeMethod(); |
|
#3
|
||||
|
||||
|
Re: Visual C++ 2005 Designer
Thanks.
I put this in Quote:
Quote:
![]() Last edited by 6600gt : 20-12-2006 at 16:01. |
|
#4
|
||||
|
||||
|
Re: Visual C++ 2005 Designer
After reading through this (and your post from September about a similar type of issue), it's not readily apparent how your MDI project is set up. My first MDI project in VC++ took a lot of hours of hair pulling and coffee until I could readily pass information around. If you would like, PM me and you can zip up & email me your project to look at. I'm assuming you've been using the free VC++ available from Microsoft's website? |
|
#5
|
||||
|
||||
|
Re: Visual C++ 2005 Designer
Quote:
Quote:
Last edited by 6600gt : 21-12-2006 at 15:50. |
|
#6
|
||||
|
||||
|
Re: Visual C++ 2005 Designer
Quote:
), and the function definitions should go in the cpp files.The long answer is best left to some research into good programming practices, you can always start with the ubiquitous Wikipedia (http://en.wikipedia.org/wiki/Header_file) to get more information. -Eric |
|
#7
|
||||
|
||||
|
Re: Visual C++ 2005 Designer
Thanks for all the help.
Now I have a new problem and I can't find any useful information on it. Main^ main = dynamic_cast<Main^>(this->MdiParent); for(count = 0; count < 10; count++) { number = main->serialPort1->BytesToRead; //Error } Quote:
Searching on the internet hasn't explained it much. |
|
#8
|
|||
|
|||
|
Re: Visual C++ 2005 Designer
May I ask what type of project you are working on?
|
|
#9
|
||||
|
||||
|
Re: Visual C++ 2005 Designer
It's a secret...
No, not really. To my knowledge there is no real debugging system for the RC other than the printf statements. This program will allow you to watch 10 values(16 bit) at any given time. Each column has a list to choose form. There will be a preset of pwms, analogs, digital I/O, OI port values, etc. But there will also be some extra values, ex. X1, which when programed into the RC allows you watch any variable (16 bit or less). Ex: x_1 = some_count = .......; Then you select the X1 in any column and you start seeing a printf style stream of values. Helpful when you are debugging a whole function. You can assign each variable in your function to a x_1 through x_x and watch all their values simultaneously. The PIC is simulating an RC. (Don't have access to an RC one right now) If I can get around to it(probably won't), the program might actually be able to control the robot using this: (Its not done, not even close...) Last edited by 6600gt : 30-12-2006 at 05:37. |
|
#10
|
||||
|
||||
|
Re: Visual C++ 2005 Designer
Quote:
|
|
#11
|
|||
|
|||
|
Re: Visual C++ 2005 Designer
I dont know VC++ but heres my ideas. Do a try catch and see if that give you an error code that means something more.
|
|
#12
|
||||
|
||||
|
Re: Visual C++ 2005 Designer
Quote:
Can someone explain what it means when such an exception is thrown? Thanks |
|
#13
|
|||||
|
|||||
|
Re: Visual C++ 2005 Designer
Quote:
Something isn't initialized and there is a NULL Pointer and you are trying to assign a NULL pointer to a data slot. . Looking in this instance my guess is there isn't Serial Communications between the PIC and the computer, and that serialPort1 is probably NULL ?? My suggestion would be when you get a problem like this is set a breakpoint couple lines before the error and then run till it gets the breakpoint and do System Watches on the important variables and use the Step Over and Step Into to go step by step through the for loop. . . If something is null it normally comes up as something in red text or a value that you know isn't correct in the watch window. |
|
#14
|
|||
|
|||
|
Re: Visual C++ 2005 Designer
Your problem comes when "child" calls "parent"
In c++ once you have included a file once, you can't do it again without causing build errors. You create a continual loop with including parent and chile again and again. If you want to go into inheritance issues and calling parent functions you can, there is an easier way. Create another file called "parenta" and copy over all of the code from "parent" Then slightly change all of the function and class names to avoid build errors, and your almost done. Change "child" to call "parenta" instead of "parent" and problem solved. "parent" should include "child" which should include "parenta" Hopefully that solves your problem ![]() |
|
#15
|
||||
|
||||
|
Re: Visual C++ 2005 Designer
Quote:
Thanks, anyway, but I think I got the original problem one fixed. The dynamic cast thing seems to be working. This program is already taking much longer than excepted...quite frustrating. Again, thanks...I really need to get going on this thing. Ok here is my function in DataView.cpp: Quote:
I don't get it: I am just calling something else form the main after the ReadByte(), but I get an Null exception. Any Ideas? Last edited by 6600gt : 30-12-2006 at 20:06. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Visual C++ 2005 Forms | 6600gt | Programming | 7 | 20-09-2006 00:05 |
| LEGO digital designer | tiffany34990 | Chit-Chat | 2 | 08-10-2005 07:13 |
| Bridge Designer | Cyberguy34000 | Chit-Chat | 4 | 13-08-2005 21:07 |
| Graphic Designer / Animator | Jay5780 | Career | 1 | 05-06-2001 20:05 |