Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » public Ctrl in my class - param in constructor problem
icon10.gif  public Ctrl in my class - param in constructor problem [message #29948] Wed, 01 December 2010 11:37 Go to next message
arkady_c is currently offline  arkady_c
Messages: 14
Registered: December 2010
Location: Polska
Promising Member
Howk

I heaw problem in public Ctrl

serwis_ide.h
class SYSTEM_LAY : public WithsystemLayout<TopWindow> {	
	public:	
	ChartBOA chartsystem; //my class!!!
typedef	SYSTEM_LAY CLASSNAME;
	SYSTEM_LAY(){
		chartsystem(7);//this is problem?
		Add(chartsystem.LeftPos(0, 800).TopPos(0, 550));
		//chartsystem.SetMaxSerii(7);//this is OK}

//chartsystem.SetMaxSerii(7);//this is OK
but I want in constructor set param my chart, NATURALLY if this no conceivably I USE metod SetMaxSerii Rolling Eyes
D:\JOWISZ\serwis_ide\/serwis_ide.h: In constructor 'SYSTEM_LAY::SYSTEM_LAY()':
D:\JOWISZ\serwis_ide\/serwis_ide.h:40: error: no match for call to '(ChartBOA) (int)'

class boa : public WithboaLayout<TopWindow> {
	
	SYSTEM_LAY systemL;
...
boa::boa()
{
	CtrlLayout(*this, "SERWIS");
	CtrlLayout(systemL);
...
class ChartBOA : public Ctrl
{
private:
int MaxSerii;
...
public:
	typedef ChartBOA CLASSNAME;
	virtual void Paint (Draw& w);
	void SET_Serie();
			
	ChartBOA(int maxserii=16);
	void SetMaxSerii(int amaxserii){MaxSerii = amaxserii;}
...
ChartBOA::ChartBOA(int maxserii) : MaxSerii(maxserii)


I do not know if I have used well class Ctrl -inheritance-




2a7aff6be3f76940495be32258777636
Re: public Ctrl in my class - param in constructor problem [message #29951 is a reply to message #29948] Wed, 01 December 2010 12:33 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi,

You have a slight problem in your C++ syntax. It should be constructor():var(init_value),another_var(init){ constructor body; }. That is in your case:

class SYSTEM_LAY : public WithsystemLayout<TopWindow> {	
	public:	
	ChartBOA chartsystem;
typedef	SYSTEM_LAY CLASSNAME;
	SYSTEM_LAY():chartsystem(7){
		Add(chartsystem.LeftPos(0, 800).TopPos(0, 550));
	}

Also, in the last code snippet, the constructor definition misses the function body (maybe you just forgot to copy it, but I mention it to be sure Wink ), there must be one even if it is empty:
ChartBOA::ChartBOA(int maxserii) : MaxSerii(maxserii){}


Otherwise it seems OK.

Best regards,
Honza
Re: public Ctrl in my class - param in constructor problem [message #29955 is a reply to message #29948] Wed, 01 December 2010 13:30 Go to previous messageGo to next message
arkady_c is currently offline  arkady_c
Messages: 14
Registered: December 2010
Location: Polska
Promising Member
Now it works. Thank you very much. I do not know English so I speak vaguely sorry for that.
I knew that this must be simple Confused Not really know all the properties of c + +.
The body of the class is, of course, so I do not know yet where does this create a constructor but I'll find out.

index.php?t=getfile&id=2949&private=0

Best regards,
Arkady
  • Attachment: wykres1.jpg
    (Size: 37.00KB, Downloaded 501 times)


2a7aff6be3f76940495be32258777636
Re: public Ctrl in my class - param in constructor problem [message #29958 is a reply to message #29955] Wed, 01 December 2010 14:36 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

I was glad to help Wink By the way: The picture looks like you are doing something that can be easily done using Scatter control from bazaar. It might save you a lot of time and work...

Honza
Re: public Ctrl in my class - param in constructor problem [message #30295 is a reply to message #29948] Wed, 22 December 2010 12:39 Go to previous messageGo to next message
arkady_c is currently offline  arkady_c
Messages: 14
Registered: December 2010
Location: Polska
Promising Member
Howk ALL!
I was not,I absorb Scatter Very Happy
I added a few lines and it is OK(Format time HH:MM:SS // MM:SS)
and void FitToData(bool Y = false,bool X = true); Very Happy

index.php?t=getfile&id=2999&private=0

I have another problem with the index in the constructor.
It compiles but will not fire.

class OptionOB : public Option
{
private:
	zmienna * zm;
	
public:
	virtual void  PerformAction();
	//OptionOB& 
	void SetAddr(zmienna * azm);
	OptionOB& Set(int b);

	OptionOB();
	virtual ~OptionOB();
};
//-----------------
class OptionFDay : public CtrlFrame
{
private:
	zmienna * zm;
	
public:
	virtual void FrameLayout(Rect& r);
	virtual void FrameAddSize(Size& sz);
	virtual void FrameAdd(Ctrl& parent);
//	void SetSetZ(); 
	OptionOB ob[24];
	
	OptionFDay(zmienna& azm)
	{
		zm = &azm;
		for(int i=0;i<24;i++){
		ob[i].SetAddr(zm);
		//ob[i].SetData(*zm->vari);//this is problem?
		}
	}
};
//------------
class FrameOb : public ParentCtrl
{
public:
	OptionFDay ni,po;
typedef FrameOb CLASSNAME;
	FrameOb(zmienna& ani, zmienna& apo) : ni(ani), po(apo)
	{
		AddFrame(ni);	AddFrame(po);	
	}
};

I tried to load the class OptionFDay (Option:: Set (Option:: setDate)) parameter ratio, also tried in the body OptionOB: Set

I suspect not initialized pointer? (did not have time for unknown reasons to me)
ob: Set (1) - Works

void OptionOB::SetAddr(zmienna * azm)
{
	zm = azm;
	option = *zm->vari;//
	//Set(zm->vi);
}


class zmienna{
private:
	int adres;
	int vi;
			
public:	
	void	init_i(int aadres, int avar);
int	*	vari;
zmienna();
~zmienna(){;} 
};
zmienna::zmienna(){
	adres = 0;
	vi = 0;
	vari = &vi;
}
//-------------------------------
void zmienna::init_i(int aadres, int avar){
	adres = aadres;
	vi = avar;
}


Best regards,
Arkady
  • Attachment: wykres1.jpg
    (Size: 67.20KB, Downloaded 486 times)


2a7aff6be3f76940495be32258777636

[Updated on: Thu, 23 December 2010 14:28]

Report message to a moderator

Re: public Ctrl in my class - param in constructor problem [message #30298 is a reply to message #29948] Wed, 22 December 2010 13:15 Go to previous messageGo to next message
arkady_c is currently offline  arkady_c
Messages: 14
Registered: December 2010
Location: Polska
Promising Member
I'll add that I try this:
void FrameOb::SetSetZ()
{
	for(int i=0; i<24; i++)
		ni.ob[i].Set(1);;//this is OK
		//*ni.ob[i].zm->vari);//this not OK
}

fires that features the key after you start the application and she disappears


2a7aff6be3f76940495be32258777636
Re: public Ctrl in my class - param in constructor problem [message #30305 is a reply to message #29948] Thu, 23 December 2010 14:22 Go to previous message
arkady_c is currently offline  arkady_c
Messages: 14
Registered: December 2010
Location: Polska
Promising Member
I resigned from the parameters in constructor
class OptionOB, class OptionFDay, class FrameOb
and I used the function to set the addresses.
void FrameOb::SetDataAddr(zmienna & ani,...

Now I can change a bit in the class zmienna
in my class OptiopOB When I click Smile

void  OptionOB::PerformAction() {
	if(option == 1){
		*zm->vari = 1234; /:-D
		//zm->SetVar(1234);
		option = 0;
	}else{
		option = 1;
	}
	UpdateAction();
	RefreshPush();
}

Why can not the parameters in the constructor Confused


2a7aff6be3f76940495be32258777636
Previous Topic: GetDefaultPrinter Call does not compile
Next Topic: Label box has no disabled look
Goto Forum:
  


Current Time: Sat Jun 15 04:09:07 CEST 2024

Total time taken to generate the page: 0.02339 seconds