Home » U++ Library support » U++ Widgets - General questions or Mixed problems » ArrayCtrl with labels / layouts inside ?
|
|
|
Re: ArrayCtrl with labels / layouts inside ? [message #12888 is a reply to message #12887] |
Sun, 25 November 2007 22:07 |
jiaif
Messages: 17 Registered: November 2007 Location: France
|
Promising Member |
|
|
Thanks for you answer.
Sorry, i'm searching and i dont find how to do what i want.
I posted a picture who looks like what i want to do.
if you can give me just a piece of code, a little example, i'll be very very happy
Or maybe a tuto where i can find how to create my own widget ?
What class to derivate ?
here is my second layout :
LAYOUT(myLayout, 196, 52)
ITEM(Label, lbl_name, LeftPosZ(4, 132).TopPosZ(4, 20))
ITEM(Label, lbl_surname, LeftPosZ(4, 132).TopPosZ(28, 20))
ITEM(Label, lbl_country, LeftPosZ(144, 48).TopPosZ(4, 44))
END_LAYOUT
myArray.AddColumn("test"). ... ?
thanks
Jf
-
Attachment: thing.png
(Size: 20.59KB, Downloaded 370 times)
|
|
|
Re: ArrayCtrl with labels / layouts inside ? [message #12889 is a reply to message #12888] |
Mon, 26 November 2007 09:07 |
|
mirek
Messages: 14112 Registered: November 2005
|
Ultimate Member |
|
|
jiaif wrote on Sun, 25 November 2007 16:07 | Thanks for you answer.
Sorry, i'm searching and i dont find how to do what i want.
I posted a picture who looks like what i want to do.
if you can give me just a piece of code, a little example, i'll be very very happy
Or maybe a tuto where i can find how to create my own widget ?
What class to derivate ?
here is my second layout :
LAYOUT(myLayout, 196, 52)
ITEM(Label, lbl_name, LeftPosZ(4, 132).TopPosZ(4, 20))
ITEM(Label, lbl_surname, LeftPosZ(4, 132).TopPosZ(28, 20))
ITEM(Label, lbl_country, LeftPosZ(144, 48).TopPosZ(4, 44))
END_LAYOUT
myArray.AddColumn("test"). ... ?
thanks
Jf
|
Actually, for the purpose I can see on screenshot, rather use Display.
Widgets are good if you want to change things. For static stuff, Display is better.
Mirek
|
|
|
|
Re: ArrayCtrl with labels / layouts inside ? [message #12891 is a reply to message #12890] |
Mon, 26 November 2007 18:06 |
Oblivion
Messages: 1136 Registered: August 2007
|
Senior Contributor |
|
|
If I understood you right, try using myArray.SetCtrl()
Below is the modified code of Arrayctrl reference example.
ArrayCtrlExample::ArrayCtrlExample()
{
CtrlLayoutExit(*this, "ArrayCtrl example");
array.AddColumn("integer").Sorting();
array.AddIndex(ID1);
array.AddColumn(ID2, "combined").Add(ID1).AddIndex(ID3).SetConvert(Single<MyConvert>());
array.AddColumn("editable").Edit(myedit).Sorting();
array.AddColumn("with display").SetDisplay(Single<MyDisplay>());
array.AddCtrl(editor);
array.AddRowNumColumn("rownum");
array.WhenLeftDouble = THISBACK(DoubleClick);
array.ColumnWidths("51 120 60 102 62");
for(int i = 0; i < 20; i++)
array.Add(i, AsString(i * 10), GetSysDate(), i * 3, rand() % 1000,
Color(byte(i * 77), byte(i * 200), byte(i * 135)), FormatIntRoman(i));
//==========================================================
bt.SetLabel("Test"); // bt should be declared in the interface
array.SetCtrl(2, 2, bt);
//==========================================================
}
Just overwrite the original code, and declare "Button bt" before compiling, and see what it does.
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Mon, 26 November 2007 18:10] Report message to a moderator
|
|
|
Re: ArrayCtrl with labels / layouts inside ? [message #12892 is a reply to message #12891] |
Mon, 26 November 2007 18:32 |
jiaif
Messages: 17 Registered: November 2007 Location: France
|
Promising Member |
|
|
i'm sorry but :
error: no matching function for call to ‘Upp::ArrayCtrl::SetCtrl(int, int, Upp::Button&)’
note: candidates are: Upp::Ctrl& Upp::ArrayCtrl::SetCtrl(int, int, Upp::Ctrl*)
when i try to do :
Button b;
b.SetLabel("test");
myArray.AddColumn("test").Ctrls<Button>();
myArray.SetCtrl(0,0,b);
I don't understand what means the documentation about this method. I think it's not what i need. but i maybe i'm wrong ?
If you could give me a shorter and simple example it would be very cool
[Updated on: Mon, 26 November 2007 18:33] Report message to a moderator
|
|
|
|
|
Re: ArrayCtrl with labels / layouts inside ? [message #12896 is a reply to message #12894] |
Mon, 26 November 2007 20:07 |
Oblivion
Messages: 1136 Registered: August 2007
|
Senior Contributor |
|
|
Interesting. Which version of U++ do you use?
As of Upp 711b, there should be a:
SetCtrl(int iž int colž Ctrl& ctrlž bool value = true)
You can use this instead.
Ps: If you allocate Button from the stack (e.g. Button bt), try not to "declare" it inside the same method.
And, as far as I know, you have to "Add" something before you can "append" or "set" a ctrl seperately in an ArrayCtrl.
Eg,
Button *bt = new Button();
bt->SetLabel("Test");
myArray.AddColumn("Column1");
myArray.Add("");
myArray.SetCtrl(0, 0, bt);
Or/And
Button *bt = new Button();
bt->SetLabel("Test");
myArray.AddColumn("Column1");
myArray.AddColumn("Column2");
myArray.Add("This is a text");
myArray.SetCtrl(0, 1, bt);
should work.
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
|
|
|
|
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Sun Nov 10 20:20:43 CET 2024
Total time taken to generate the page: 0.01369 seconds
|