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 » TabCtrl » Tabctrl and RightDown.
Tabctrl and RightDown. [message #37810] Wed, 14 November 2012 15:32 Go to next message
witriol is currently offline  witriol
Messages: 8
Registered: November 2012
Promising Member
First!
I'm sorry my English is poor.

I have a problem with RightDown(and similar Leftdown).

This is the class definition:

class Gun : public WithGunLayout<TopWindow> 
{
.....;
Withkep_lay <ParentCtrl> mj;
.....;
}

I use this layoutfile in a TabCtrl:

Gun::Gun()
{
.....
CtrlLayout(mj);
summa_vievver.Add(mj,"Image");//suma_vievver is a TabCtrl in the Gun.lay.
.....
}



Should I put a picture of mj.
Right click choose the interesting part but right click does not work. This is logical RightDown of mj overdefine/overwrite Gun::RigtDown. How to do call the right click function of mj?.

Thank you for help.

[Updated on: Wed, 14 November 2012 15:33]

Report message to a moderator

Re: Tabctrl and RightDown. [message #37811 is a reply to message #37810] Wed, 14 November 2012 15:50 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3373
Registered: August 2008
Senior Veteran
Hello witriol

Welcome to the forum Cool.

Personally I would do this:

class Gun : public WithGunLayout<TopWindow> 
{
.....;
Withkep_lay <StaticRect> mj;  
.....;
}

Gun::Gun()
{
.....
CtrlLayout(mj);
summa_vievver.Add(mj.SizePos(),"Image"); // So mj will fill all suma_vievver available area when resizing
.....
}


Quote:

Right click choose the interesting part but right click does not work. This is logical RightDown of mj overdefine/overwrite Gun::RigtDown. How to do call the right click function of mj?.


Do you mean that you want to call a function when the user right-clicks when hovering over mj?


Best regards
Iñaki
Re: Tabctrl and RightDown. [message #37812 is a reply to message #37811] Wed, 14 November 2012 16:41 Go to previous messageGo to next message
witriol is currently offline  witriol
Messages: 8
Registered: November 2012
Promising Member
If the user clicks on the MJ, I ​​would like to know the x and y coordinates where you clicked.
Re: Tabctrl and RightDown. [message #37815 is a reply to message #37812] Wed, 14 November 2012 21:11 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3373
Registered: August 2008
Senior Veteran
Hello Witriol

That is easy. Instead of calling directly

Withkep_lay <StaticRect> mj;


you can create explicitly the class adding the mouse handler

class Kep_lay : public Withkep_lay<StaticRect> {
public:
	typedef Kep_lay CLASSNAME;

	virtual void RightDown(Point p, dword keyFlags) {
		Exclamation(Format("Clicked on %d:%d", p.x, p.y));
	}
};


and including Kep_lay mj; inside Gun class.


Best regards
Iñaki
Re: Tabctrl and RightDown. [message #37823 is a reply to message #37815] Thu, 15 November 2012 12:28 Go to previous messageGo to next message
witriol is currently offline  witriol
Messages: 8
Registered: November 2012
Promising Member
Thanks, but is not the Gun::RightDown function. I want to run Gun::RightDown, when the user click on the mj. This function uses x, and y coordinates.

[Updated on: Thu, 15 November 2012 12:28]

Report message to a moderator

Re: Tabctrl and RightDown. [message #37824 is a reply to message #37823] Thu, 15 November 2012 16:07 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3373
Registered: August 2008
Senior Veteran
Hello Witriol

Do you mean that when moving the mouse over mj, if the user right clicks the mouse a function has to be called in Gun with the coordinates?


Best regards
Iñaki
Re: Tabctrl and RightDown. [message #37834 is a reply to message #37824] Fri, 16 November 2012 09:57 Go to previous messageGo to next message
witriol is currently offline  witriol
Messages: 8
Registered: November 2012
Promising Member
If the user use right cilck over mj, I would like to use the Gun::RightDown, not the mj::rightdown.
Re: Tabctrl and RightDown. [message #37835 is a reply to message #37834] Fri, 16 November 2012 13:40 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3373
Registered: August 2008
Senior Veteran
Hello Witriol

A simple way would be to add a reference to Gun in Kep_lay class constructor and call Gun::RightDown handler from Kep_lay::RightDown handler.


Best regards
Iñaki
Re: Tabctrl and RightDown. [message #37854 is a reply to message #37835] Sun, 18 November 2012 16:59 Go to previous messageGo to next message
witriol is currently offline  witriol
Messages: 8
Registered: November 2012
Promising Member
I definied this class.

class Kep_lay : public Withkep_lay<ParentCtrl> {
public:
	typedef Kep_lay CLASSNAME;

	virtual void RightDown(Point p, dword keyFlags) ;
};    				 


And included in the Gun class:
class Gun : public WithGunLayout<TopWindow> {	
....
public:
....	
	Kep_lay mj;
....


And I wrote the function:
void Kep_lay::RightDown(Point p, dword keyFlags)
{
....
Exclamation("OK");
....
}

It's work. BUT!

How do I call, Gun::RightDon (or other Gun::I_definied)?
I tried like atomic thread callback, but not work.
Re: Tabctrl and RightDown. [message #37855 is a reply to message #37854] Sun, 18 November 2012 21:59 Go to previous message
koldo is currently offline  koldo
Messages: 3373
Registered: August 2008
Senior Veteran
Hello Witriol

Perhaps it is not the nicest way to do it but you may do something like this:

class Gun : public WithGunLayout<TopWindow> {	
....
public:
....	
	Gun() {
		mj.Init(this);
	}
	Kep_lay mj;
	void RightMouseHandler(Point p, dword keyFlags) {
		// Do it.
	}
....
};

class Kep_lay : public Withkep_lay<StaticRect> {
public:
	typedef Kep_lay CLASSNAME;

	void Init(Gun *_parent) {parent = _parent;}
	virtual void RightDown(Point p, dword keyFlags) {
		parent->RightMouseHandler(p, keyFlags);
private:
	Gun *parent;
};



Best regards
Iñaki
Previous Topic: Why not drop ParentCtrl pane and add Ctrls directly to TabBarCtrl?
Next Topic: TabBar min tab count
Goto Forum:
  


Current Time: Thu Jun 20 02:23:06 CEST 2024

Total time taken to generate the page: 0.01878 seconds