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 » ArrayCtrl, HeaderCtrl & GridCtrl » Accessing embedded controls in a gridCtrl
Accessing embedded controls in a gridCtrl [message #22531] Fri, 24 July 2009 15:12 Go to next message
bianconejo is currently offline  bianconejo
Messages: 11
Registered: March 2009
Promising Member
Hello guys !


I defined a GridCtrl with an embedded ProgressIndicator :

GridCtrl a;

a.AddColumn("Titre")
a.AddColumn("Deroulement").Ctrls<ProgressIndicator>();



I can set the first column but I can't find any way to access the ProgressIndicator.

Thanx !
Re: Accessing embedded controls in a gridCtrl [message #22539 is a reply to message #22531] Sat, 25 July 2009 16:24 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3357
Registered: August 2008
Senior Veteran
Hello bianconejo

You can embed a ProgressIndicator into an ArrayCtrl using this: http://www.ultimatepp.org/forum/index.php?t=msg&th=3145& amp;start=0&

With GridCtrl I have embedded well an "Option", but I do not know how to do it with ProgressIndicator.

It seems everybody is on holiday Smile

Best regards
Koldo


Best regards
Iñaki
Re: Accessing embedded controls in a gridCtrl [message #22548 is a reply to message #22531] Sun, 26 July 2009 15:59 Go to previous messageGo to next message
bianconejo is currently offline  bianconejo
Messages: 11
Registered: March 2009
Promising Member
Thanx for your reply Koldo !

sorry for my first post, I've not been very clear:
embedding the control in the grid/array is not a problem, what makes me stall is modifying the embedded control values and accessing to their owned function.

for my example i would like to change the ProgressIndicator actual and total values in order to display a progression within a table.

I tried:

gridDeroulement.GetCtrl(row,column).Set(actual,total);


...but it fails.
Re: Accessing embedded controls in a gridCtrl [message #22557 is a reply to message #22548] Mon, 27 July 2009 00:03 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3357
Registered: August 2008
Senior Veteran
Hello bianconejo

I understood well. In

With GridCtrl I have embedded well an "Option", but I do not know how to do it with ProgressIndicator.


with "embed well" I meant not just to put the control, but really handle it. With

a.AddColumn("Deroulement").Ctrls<ProgressIndicator>();


you put the control inside, but when doing a.Add(20), the corresponding Set to the underlying ProgressControl does a Set(0, 0), so it appears a default bar.

You can also derive a class from ProgressIndicator and in the costructor you can do a SetTotal(100), but again in the corresponding GridCtrl underlaying Set function you get a Set(0, 100), so you get and empty ProgressIndicator.

In opposite, if you use an Option if you do an a.Add(true), GridCtrl does a Set(true) to the underlying Option control, so it works well.

Best regards
Koldo


Best regards
Iñaki
Re: Accessing embedded controls in a gridCtrl [message #22562 is a reply to message #22531] Mon, 27 July 2009 11:33 Go to previous messageGo to next message
bianconejo is currently offline  bianconejo
Messages: 11
Registered: March 2009
Promising Member
Hi Koldo !

Thanx for your replies !

... then i'll drop gridCtrl and use arrayCtrl for this kind of implementation.


Thanx again
Re: Accessing embedded controls in a gridCtrl [message #22565 is a reply to message #22562] Mon, 27 July 2009 16:08 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3357
Registered: August 2008
Senior Veteran
Hello bianconejo

I am sure that it is possible to do it in GridCtrl but it seems everybody is on holidays.

Perhaps in some weeks somebody can give you an answer Smile

Best regards
Koldo


Best regards
Iñaki
Re: Accessing embedded controls in a gridCtrl [message #22568 is a reply to message #22565] Mon, 27 July 2009 17:04 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
I don't actually use GridCtrl and I haven't tested it, but this should work:

struct ProgressValue {
	int actual;	
	int total;
	
	ProgressValue(int _actual, int _total) 
		: actual(_actual), total(_total) {}
	operator Value() const { return RawToValue<ProgressValue>(*this); }
};

struct EmbeddedProgress : public ProgressIndicator
{
	virtual void SetData(const Value& data) {
		if (IsTypeRaw<ProgressValue>(data)) {
			const ProgressValue &pv = ValueTo<ProgressValue>(data);
			ProgressIndicator::Set(pv.actual, pv.total);
		}
		else
			return ProgressIndicator::SetData(data);
	}
};

If you add this ctrl instead then you can update it using:
gridctrl.Set(row, column, ProgressValue(actual, total));

It's a bit of a hack, but not too bad. Or you can just use ArrayCtrl::SetCtrl.

Re: Accessing embedded controls in a gridCtrl [message #22590 is a reply to message #22531] Tue, 28 July 2009 19:00 Go to previous message
bianconejo is currently offline  bianconejo
Messages: 11
Registered: March 2009
Promising Member
Thanx mrjt for your post !!!

I'll try this then feedback.
Previous Topic: WhenCtrlsAction event
Next Topic: ArrayCtrl column width problem
Goto Forum:
  


Current Time: Wed Apr 24 13:43:32 CEST 2024

Total time taken to generate the page: 0.01309 seconds