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 » edit data in arrayctrl [GOOD EXAMPLES...]
edit data in arrayctrl [GOOD EXAMPLES...] [message #1879] Fri, 24 March 2006 19:30 Go to next message
barpas is currently offline  barpas
Messages: 13
Registered: March 2006
Location: Poland
Promising Member
maybe i'm an idiot but i thing i know the reason of UPP low popularity:

maybe i'm an idiot but for two hours im looking how make array control editable - (eg goEditing in builder)
looking reading and .... nothing

i use:

teren.lista.SetEditable();

and

teren.lista.AddColumn("x1",1).Edit(es1);

and testing very very other ideas

and NOTHING

maybe i'm an idiot but there is more idiots on the world
why we can't use UPP???

help my with this problem please ...

ps in my first step by builder i spend 10 seconds to find go editin options - it is very important for begginers to not loosing time ...

[Updated on: Sun, 09 April 2006 04:31] by Moderator

Report message to a moderator

Re: edit data in arrayctrl [message #1882 is a reply to message #1879] Fri, 24 March 2006 20:25 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
Yes, life is difficult here... Smile You have to look at the sources. It took me 10 min this time... Not perfect, but maybe as a starting point for you.
#include <CtrlLib/CtrlLib.h>

class App : public TopWindow {
	ArrayCtrl array;
	EditField arr_edit;
public:
    typedef App CLASSNAME;
	void ArrayEdit();
    App();
};


void App::ArrayEdit() {
	array.ColumnAt(0).Edit(arr_edit);
	}


App::App() {
    Add(array.SizePos());

		array.AddColumnAt(0,"Column0",50);
		array.AddColumnAt(1,"Column1",50);

		array.Add("1textfor0","1textfor1");
		array.Add("2textfor0","2textfor1");
		
	array.WhenLeftDouble = THISBACK(ArrayEdit); //double click to edit
		
    Sizeable().Zoomable();
    Title("ArrayEdit");
}


GUI_APP_MAIN
{
    App().Run();
}
Re: edit data in arrayctrl [message #1883 is a reply to message #1882] Fri, 24 March 2006 21:15 Go to previous messageGo to next message
barpas is currently offline  barpas
Messages: 13
Registered: March 2006
Location: Poland
Promising Member
THANK YOU FOR HELP!!!

but when i tray to use it i have another problem:

i tray it that way:

teren.lista.ColumnAt(teren.lista.GetClickColumn()).Edit(arr_ edit);

1. it working but only one time - when i change data and pres enter and then clicking another cell it wonts to edit cell i clicked first time ...

2. when i change data and not press enter and then click another cell i see nothng in first cell ... after that i can nothing to do with it ...

3. the same is when i click some cell eg. 4 times

4. sometimes when i'm clossing application i crashes with information:

assertion failed .... dynamic_cast<const RichValueRep *>(p)

help my again ?
Re: edit data in arrayctrl [message #1884 is a reply to message #1883] Fri, 24 March 2006 21:43 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
barpas wrote on Fri, 24 March 2006 20:15

THANK YOU FOR HELP!!!

but when i tray to use it i have another problem:

i tray it that way:

teren.lista.ColumnAt(teren.lista.GetClickColumn()).Edit(arr_ edit);

1. it working but only one time - when i change data and pres enter and then clicking another cell it wonts to edit cell i clicked first time ...

2. when i change data and not press enter and then click another cell i see nothng in first cell ... after that i can nothing to do with it ...

3. the same is when i click some cell eg. 4 times

4. sometimes when i'm clossing application i crashes with information:

assertion failed .... dynamic_cast<const RichValueRep *>(p)

help my again ?


For people willing to help is easier just to copy and test your piece than imagine how it must work.
Please post the whole code here.
Re: edit data in arrayctrl [message #1885 is a reply to message #1884] Fri, 24 March 2006 21:55 Go to previous messageGo to next message
barpas is currently offline  barpas
Messages: 13
Registered: March 2006
Location: Poland
Promising Member
here is it Smile


ps. meybe You can answer me why it is not textured too...
  • Attachment: robot.zip
    (Size: 4.56KB, Downloaded 1797 times)
Re: edit data in arrayctrl [message #1890 is a reply to message #1885] Fri, 24 March 2006 23:14 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Quote:


class robot : public WithrobotLayout<TopWindow> {
public:
.....
EditDouble x1, y1, x2, y2;
.....
};

robot::robot()
{
......
teren.lista.AddColumn("x1",0).Edit(x1);
teren.lista.AddColumn("y1",0).Edit(y1);
teren.lista.AddColumn("x2",0).Edit(x2);
teren.lista.AddColumn("y2",0).Edit(y2);
teren.lista.Appending().Removing();
......
}



...I am not sure whether Appending/Removing applies here...

(ArrayEdit is not needed here).

You can also get "direct" editing (with Ctrls always visible) by

teren.lista.AddColumn("x1",0).Ctrls<EditDouble>();

Mirek
Re: edit data in arrayctrl [message #1895 is a reply to message #1890] Sat, 25 March 2006 00:12 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
OK, something I should have done a long time ago, a good reference examples demonstrating different ways of editing cells in ArrayCtrl:

#include <CtrlLib/CtrlLib.h>

#define LAYOUTFILE <ArrayCtrlEdits/ArrayCtrlEdits.lay>
#include <CtrlCore/lay.h>

struct App : public WithAppLayout<TopWindow> {
	EditDouble editdbl;
	
	typedef App CLASSNAME;
	App();
};

struct SqrNumberConvert : Convert {
	virtual Value Format(const Value& q) const {
		return IsNull(q) ? (double)Null : (double)q * (double)q;
	}
};

void EditDblMinMaxFactory(One<Ctrl>& ctrl)
{
	ctrl.Create<EditDouble>().MinMax(0, 1);
}

App::App()
{
	CtrlLayout(*this);
	list.AddColumn("Number").Edit(editdbl);
	list.AddColumnAt(0, "Number^2").SetConvert(Single<SqrNumberConvert>());
	list.AddColumn("Text").Ctrls<EditString>();
	list.AddColumn("Limited number").Ctrls(EditDblMinMaxFactory);
	list.AddCtrl(editor);
	list.AddCtrl(option);
	list.Appending().Removing();
	list.SetLineCy(EditField::GetStdHeight());
	list.ColumnWidths("49 63 74 96");
}

GUI_APP_MAIN
{
	App().Run();
}

ArrayCtrlEdits.lay:

LAYOUT(AppLayout, 416, 132)
	ITEM(ArrayCtrl, list, LeftPosZ(4, 300).TopPosZ(4, 124))
	ITEM(EditInt, editor, LeftPosZ(308, 104).TopPosZ(4, 19))
	ITEM(Option, option, SetLabel(t_("Option")).LeftPosZ(308, 104).TopPosZ(28, 15))
END_LAYOUT



Mire
Re: edit data in arrayctrl [message #1896 is a reply to message #1890] Sat, 25 March 2006 00:14 Go to previous messageGo to next message
barpas is currently offline  barpas
Messages: 13
Registered: March 2006
Location: Poland
Promising Member
thanks awfully!

teren.lista.AddColumn("x1",0).Ctrls<EditDouble>();

it is that what i need Smile

i tray this metod before im writting:

teren.lista.AddColumn("x1",0).Edit(x1);

but i use:

EditString x1; (i find something like that on forum)

and it was my mistake... but now evrything works ok THANK YOU again Smile




I wont to say something abaut UPP popularity:

In my opinion UPP worth to by farmous all over the world and should be used by many many people - there is a lot wonderful thigs in it (eg. containers, serialize mechanism etc..)


but there is colossal work to do - it must be more intuitional (simple to use) by people who are using delphi builder etc.
especially in "using widget" aspect builder is more more confortable to use ...

if that work won't be made that people will be discourage
fast ... it's a pity!

more people, more links, more aplications, more ideas ...
remember that all beginers are potential expert in future - so dont forget abaut as Wink

upp worth it !!!


sory my english
Yours faithfuly
Bartek Smile


ps if is there any person who wonts to make polish version of upp site (i'm to stiupid to do it alone), i can give good, unlimited hosting and help (in my possibility)

[Updated on: Sat, 25 March 2006 00:45]

Report message to a moderator

Re: edit data in arrayctrl [message #1897 is a reply to message #1896] Sat, 25 March 2006 00:27 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
barpas wrote on Fri, 24 March 2006 18:14


In my opinion UPP worth to by farmous all over the world and should be used by many many people - there is a lot wonderful thigs in it (eg. compactors, serialize mechanism etc..)

but there is colossal work to do - it must be more intuitional (simple to use) by people who are using delphi builder etc.
if it won't that people will be discourage
fast ... it's a pity!

more people, more links, more aplications, more ideas ...



Yes. OTOH, we need to gather resources for that colossal work now - it mostly involves creating experienced U++ programmers via forum tutoring that will spread the U++ fame, bring more people to use it , find bugs, write tutorials and start the chain reaction...

U++ was and IS developed as tool to solve the problem. We (I mean original U++ developers) always cared more about experienced programmers and daily use for developing of very complex apps than about C++ beginners. We are trying to make it more accessible, but there is limited amount of time we can dedicate on that...

Mirek
Previous Topic: ArrayCtrl scroll position [BUG] [FIXED]
Next Topic: detecting clicked row in ArrayCtrl [FIXED...]
Goto Forum:
  


Current Time: Sat May 04 21:52:21 CEST 2024

Total time taken to generate the page: 0.03478 seconds