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 » Community » Newbie corner » Accessing controls in layout within ArrayCtrl
Accessing controls in layout within ArrayCtrl [message #35030] Fri, 30 December 2011 13:24 Go to next message
unknown is currently offline  unknown
Messages: 2
Registered: December 2011
Junior Member
Hello all, I hope you can help me get a grip on the following problem.

I have created an ArrayCtrl where every line has a small layout defined in the .lay file. It consists of a number of different options, dropdowns and text fields. They get added fine and I can type texts and select options. The only problem I am having is:

How to access single controls of an ArrayCtrl entry?

Let's say I have a text box on the third row of the ArrayCtrl, how would I add a text to it later on in my code?

I hope I managed to explain what I would like to do, if anyone needs more information I will be happy to supply. Thanks in advance.

[Updated on: Fri, 30 December 2011 13:28]

Report message to a moderator

Re: Accessing controls in layout within ArrayCtrl [message #35031 is a reply to message #35030] Fri, 30 December 2011 14:02 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Welcome unknown

I am not an ArrayCtrl expert, but I would do this:

- Imagine your small layout is of class MyRow to be included in ArrayCtrl arr
- In the class where ArrayCtrl arr is included, I would add an Array<MyRow> myRows
- Every time you add a row in your ArrayCtrl arr with arr.Add(data1, data2, ...), you should have to do a arr.SetCtrl(row, col, myRows.Add().SizePos());
- To access a particular data in a row, just do myRows[i].data = "My data";

Is it right?



Best regards
IƱaki
Re: Accessing controls in layout within ArrayCtrl [message #35036 is a reply to message #35030] Sun, 01 January 2012 10:37 Go to previous messageGo to next message
Sender Ghost is currently offline  Sender Ghost
Messages: 301
Registered: November 2008
Senior Member
Hello.

unknown wrote on Fri, 30 December 2011 13:24

How to access single controls of an ArrayCtrl entry?


It depends on how you create ArrayCtrl column(s). In the following case:
ArrayCtrl list;
// ...
list.AddColumn("Composite").Ctrls<CompositeCtrl>();
list.SetLineCy(CompositeCtrl::GetLayoutSize().cy);

unknown wrote on Fri, 30 December 2011 13:24

Let's say I have a text box on the third row of the ArrayCtrl, how would I add a text to it later on in my code?


// CompositeCtrl at third row and second column
CompositeCtrl *ctrl = static_cast<CompositeCtrl *>(list.GetCtrl(2, 1));

if (ctrl)
	ctrl->text <<= "Some text";


The full example you could find in the attachments.
Re: Accessing controls in layout within ArrayCtrl [message #35098 is a reply to message #35030] Wed, 11 January 2012 11:37 Go to previous message
unknown is currently offline  unknown
Messages: 2
Registered: December 2011
Junior Member
Thank you kindly for both of your replies. It looks like SenderGhost's solution will be easy to implement for me in the current situation.

I guess I should think about finally learning some 'real' C++ and U++ so I can solve this kind of situations for myself. Until I do I might have more of these simple questions, but it seems this forum is very kind to newbies Smile
Previous Topic: U++ App for linux
Next Topic: First time with upp
Goto Forum:
  


Current Time: Thu Mar 28 19:18:51 CET 2024

Total time taken to generate the page: 0.01866 seconds