Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » ArrayCtrl cell consisting of edit and helper button
Re: ArrayCtrl cell consisting of edit and helper button [message #3074 is a reply to message #2633] |
Sat, 06 May 2006 01:31   |
 |
forlano
Messages: 1213 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
luzr wrote on Wed, 19 April 2006 14:31 | BTW, consider using layout....
|
Hello,
I've modified a bit the Aris' example above using the layout as Mirek suggested to create an embedded two-control made by an editint followed by a label. What is entered in the edit is immediately replicated in the label. Here it is:
#include <CtrlLib/CtrlLib.h>
#define LAYOUTFILE <edithelp/a.lay>
#include <CtrlCore/lay.h>
//--------------------- begin class -----------------
class EditLabel : public WithEditLabel<TopWindow> {
public:
typedef EditLabel CLASSNAME;
void WriteLabel();
EditLabel();
};
void EditLabel::WriteLabel()
{ lbl.SetLabel( AsString(~edit) );
//SetFocus();
}
EditLabel::EditLabel()
{ CtrlLayout(*this, "");
edit <<= THISBACK(WriteLabel);
}
void Extra2(One<Ctrl>& ctrl)
{ ctrl.Create<EditLabel>();
}
//--------------------- end class -------------------
GUI_APP_MAIN
{
TopWindow w;
ArrayCtrl arr;
arr.AddColumn("col1",20);
arr.AddColumn("col2",20).Ctrls(Extra2);
arr.SetLineCy(20);
arr.Add("aaa");
arr.Add("bbb");
arr.SizePos();
w.Add(arr);
w.Run();
}
LAYOUT(EditLabel, 96, 19)
ITEM(EditInt, edit, LeftPosZ(2, 32).TopPosZ(1, 17))
ITEM(Label, lbl, SetFrame(ThinInsetFrame()).LeftPosZ(36, 60).TopPosZ(1, 17))
END_LAYOUT
Now the horintal alignement is improved drastically and there is no problem with size > 15 that can be tuned as one like.
Moreover appear the annoying problem of the cursor of the array that does not follow the click on the embedded control. To overcome it I've added
SetFocus();
connected to edit.WhenAction but then come two new unwanted side effects:
1) WhenAction was already used to pass the value to the label at the right. So while one type in the editint it continue to focus when should not be necessary (in principle).
2) Instead happens that after the first SetFocus() the cursor of the array is syncronised with the embedded control but the focus escape from editint and finish somewhere else in the row and one cannot continue the edit of the field!
Any idea to overcame the problem?
Luigi
|
|
|
 |
|
ArrayCtrl cell consisting of edit and helper button
|
 |
|
Re: ArrayCtrl cell consisting of edit and helper button
By: fudadmin on Wed, 19 April 2006 06:56
|
 |
|
Re: ArrayCtrl cell consisting of edit and helper button
|
 |
|
Re: ArrayCtrl cell consisting of edit and helper button
By: fudadmin on Wed, 19 April 2006 07:38
|
 |
|
Re: ArrayCtrl cell consisting of edit and helper button
By: fudadmin on Wed, 19 April 2006 07:53
|
 |
|
Re: ArrayCtrl cell consisting of edit and helper button
By: mirek on Wed, 19 April 2006 14:31
|
 |
|
Re: ArrayCtrl cell consisting of edit and helper button
By: forlano on Sat, 06 May 2006 01:31
|
 |
|
Re: ArrayCtrl cell consisting of edit and helper button
|
 |
|
Re: ArrayCtrl cell consisting of edit and helper button
By: forlano on Sat, 06 May 2006 02:13
|
 |
|
Re: ArrayCtrl cell consisting of edit and helper button
|
 |
|
Re: ArrayCtrl cell consisting of edit and helper button
|
 |
|
Re: ArrayCtrl cell consisting of edit and helper button
By: forlano on Sat, 06 May 2006 10:38
|
 |
|
Re: ArrayCtrl cell consisting of edit and helper button
By: forlano on Sat, 06 May 2006 10:44
|
 |
|
Re: ArrayCtrl cell consisting of edit and helper button
|
 |
|
Re: ArrayCtrl cell consisting of edit and helper button
By: mirek on Sun, 07 May 2006 19:50
|
 |
|
Re: ArrayCtrl cell consisting of edit and helper button
|
 |
|
Re: ArrayCtrl cell consisting of edit and helper button
By: fudadmin on Wed, 19 April 2006 18:19
|
 |
|
Re: ArrayCtrl cell consisting of edit and helper button
By: mirek on Wed, 19 April 2006 18:35
|
Goto Forum:
Current Time: Sat Aug 02 20:53:47 CEST 2025
Total time taken to generate the page: 0.07987 seconds
|