Click here to Skip to main content
15,887,241 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Restricting rights to delete a dynamic array ? Pin
doug255-Jan-10 16:44
doug255-Jan-10 16:44 
GeneralRe: Restricting rights to delete a dynamic array ? Pin
Moak5-Jan-10 23:16
Moak5-Jan-10 23:16 
GeneralRe: Restricting rights to delete a dynamic array ? Pin
doug256-Jan-10 3:43
doug256-Jan-10 3:43 
GeneralRe: Restricting rights to delete a dynamic array ? Pin
Moak6-Jan-10 12:51
Moak6-Jan-10 12:51 
GeneralRe: Restricting rights to delete a dynamic array ? [modified] Pin
doug256-Jan-10 16:14
doug256-Jan-10 16:14 
GeneralRe: Restricting rights to delete a dynamic array ? Pin
Moak7-Jan-10 1:03
Moak7-Jan-10 1:03 
GeneralRe: Restricting rights to delete a dynamic array ? Pin
doug257-Jan-10 11:38
doug257-Jan-10 11:38 
Questioncommunication between objects Pin
Alex80gbg1-Jan-10 8:44
Alex80gbg1-Jan-10 8:44 
Hi everyone! Hope you all had a great New Years Eve!!

In my adio mixer GUI, I have a group of GUI objects each containing a level slider. They are instances of the class "ChannelStrip". Each channel strip also contains "group buttons" that are supposed to link channels together so that a change of the slider position on one channel will also apply to all the other in the same group.

In order to accomplish this I tried to create a class "ChannelGroup" which the ChannelStrip class inherited from. The idea was to put a function "sliderGroupEdit" and pointers to all the ChannelStrips in the ChannelGroup class and call sliderGroupEdit from callbacks for the sliders.

I never got it to work. It seems as if the problem has something to do with the base class using its child class. Both need the other to be defined to be defined!

My questions are:

1) Is this a good way to plan the program or am I making things unnecessarily complicated?

2) Is it even possible for a parent class to have its children as member variables?

3) Is it a good idea to put everything in .h-files like I do?

4) Is there a standard solution to the problem of making objects of the same class communicate?


As you probably guessed I am a beginner and I would be very thankful for any help! Maybe I should also add that I am using the Juce class library.

Have a great day!



ChannelGroup.h :

class ChannelGroup  : public Component // Component is a base class for my GUI
{
   private:
	int nrOfChannels;
	ChannelStrip * pChStripArray;
   ...
   public:
        ...
	ChannelGroup(int nrOfChs) 
	{		
	    nrOfChannels  = nrOfChs;
            pChStripArray = new ChannelStrip[nrOfChannels];
            ...
	}

        void sliderGroupEdit(int groupNr, double dBLevel ) 
	{                                                 
	   for (int k=0; k<nrOfChannels; k++)
	   {
		// IF member of group:
		   pChStripArray[k].levelSlider->setValue(dBLevel);
	    }
	}

}




ChannelStrip.h :

...
class ChannelStrip : public ChannelGroup
{
   ...
   void sliderValueChanged(Slider *slider) // slider callback
   {
      ...
      ChannelGroup::sliderGroupEdit( groupNr, dBLevel ); // Call group edit function
   }
};

AnswerRe: communication between objects Pin
Rozis2-Jan-10 8:17
Rozis2-Jan-10 8:17 
GeneralRe: communication between objects Pin
Alex80gbg2-Jan-10 11:52
Alex80gbg2-Jan-10 11:52 
QuestionLNK2019 for XmlLite Pin
A&Ms1-Jan-10 8:30
A&Ms1-Jan-10 8:30 
AnswerRe: LNK2019 for XmlLite Pin
A&Ms1-Jan-10 11:14
A&Ms1-Jan-10 11:14 
GeneralRe: LNK2019 for XmlLite Pin
conrad Braam3-Jan-10 4:04
conrad Braam3-Jan-10 4:04 
QuestionPort 7078 and 7077 blocked in Vista Pin
Larry Mills Sr1-Jan-10 6:00
Larry Mills Sr1-Jan-10 6:00 
QuestionNeed help with member function pointer Pin
anbluemoon31-Dec-09 19:18
anbluemoon31-Dec-09 19:18 
AnswerRe: Need help with member function pointer Pin
KingsGambit31-Dec-09 19:44
KingsGambit31-Dec-09 19:44 
GeneralRe: Need help with member function pointer Pin
anbluemoon31-Dec-09 21:14
anbluemoon31-Dec-09 21:14 
AnswerRe: Need help with member function pointer Pin
N a v a n e e t h1-Jan-10 3:53
N a v a n e e t h1-Jan-10 3:53 
QuestionHow to use CreateProcess win 32 api function Pin
NIR WINTER31-Dec-09 12:29
NIR WINTER31-Dec-09 12:29 
AnswerRe: How to use CreateProcess win 32 api function Pin
Garth J Lancaster31-Dec-09 13:07
professionalGarth J Lancaster31-Dec-09 13:07 
AnswerRe: How to use CreateProcess win 32 api function Pin
Chuck O'Toole31-Dec-09 15:15
Chuck O'Toole31-Dec-09 15:15 
AnswerRe: How to use CreateProcess win 32 api function Pin
Rozis1-Jan-10 4:58
Rozis1-Jan-10 4:58 
AnswerRe: How to use CreateProcess win 32 api function Pin
«_Superman_»1-Jan-10 14:43
professional«_Superman_»1-Jan-10 14:43 
QuestionImplementing Windows Pin
MrMcIntyre31-Dec-09 10:19
MrMcIntyre31-Dec-09 10:19 
QuestionRe: Implementing Windows Pin
CPallini31-Dec-09 10:23
mveCPallini31-Dec-09 10:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.