Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » Embed editfields in ArrayCtrl
Embed editfields in ArrayCtrl [message #24264] |
Fri, 08 January 2010 00:30  |
mdelfede
Messages: 1308 Registered: September 2007
|
Ultimate Contributor |
|
|
Embedding Editfields in ArrayCtrl offers nice editing and filtering capabilities, and the function
offers a fast way to do it but.... it has also a couple of caveats :
1 - Embedded fields get frames, which is ugly inside the array
2 - Embedded fields grab ArrayCtrl rightclick context menu
This simple template solves both :
template<class E> class Embedded : public E
{
protected:
void RightDown(Point p, dword keyflags)
{
Ctrl *c = this;
ArrayCtrl *a;
while( (c = c->GetParent()) != NULL && ((a = dynamic_cast<ArrayCtrl *>(c)) == NULL))
;
if(a)
{
Rect cRect = E::GetScreenRect();
Rect aRect = a->GetScreenRect();
p.y += cRect.top - aRect.top - a->HeaderObject().GetHeight();
p.x += cRect.left - aRect.left;
a->RightDown(p, keyflags);
}
}
public:
typedef Embedded<E> CLASSNAME;
Embedded<E>() { E::ClearFrames(); }
};
It's usage is simple, just define your ctrl as, for example :
typedef Embedded<EditDouble> EditDoubleEmbedded;
Then use as a normal editfield in arrayctrl.
The field will get no frames and forward context menu clicks to its ArrayCtrl container.
Ciao
Max
|
|
|
 |
|
Embed editfields in ArrayCtrl
By: mdelfede on Fri, 08 January 2010 00:30
|
 |
|
Re: Embed editfields in ArrayCtrl
By: mirek on Fri, 08 January 2010 13:45
|
 |
|
Re: Embed editfields in ArrayCtrl
By: mirek on Fri, 08 January 2010 13:57
|
 |
|
Re: Embed editfields in ArrayCtrl
By: mrjt on Fri, 08 January 2010 14:49
|
 |
|
Re: Embed editfields in ArrayCtrl
By: mirek on Fri, 08 January 2010 15:28
|
 |
|
Re: Embed editfields in ArrayCtrl
By: mrjt on Fri, 08 January 2010 15:56
|
 |
|
Re: Embed editfields in ArrayCtrl
By: mirek on Fri, 08 January 2010 15:33
|
 |
|
Re: Embed editfields in ArrayCtrl
By: mdelfede on Fri, 08 January 2010 18:40
|
 |
|
Re: Embed editfields in ArrayCtrl
By: mdelfede on Fri, 08 January 2010 18:39
|
 |
|
Re: Embed editfields in ArrayCtrl
By: mirek on Sat, 09 January 2010 00:44
|
 |
|
Re: Embed editfields in ArrayCtrl
By: mirek on Sat, 09 January 2010 00:47
|
 |
|
Re: Embed editfields in ArrayCtrl
By: mdelfede on Sat, 09 January 2010 09:38
|
 |
|
Re: Embed editfields in ArrayCtrl
By: mirek on Sat, 09 January 2010 12:47
|
Goto Forum:
Current Time: Wed Apr 30 04:53:22 CEST 2025
Total time taken to generate the page: 0.02285 seconds
|