Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » Embed editfields in ArrayCtrl
Re: Embed editfields in ArrayCtrl [message #24271 is a reply to message #24264] |
Fri, 08 January 2010 13:45   |
 |
mirek
Messages: 14256 Registered: November 2005
|
Ultimate Member |
|
|
mdelfede wrote on Thu, 07 January 2010 18:30 | 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
|
Actually, as long as you override RightDown, there is no need to make the menu indirectly. Remember, the problem we had was because there was a call to SetFocus after the menu handling...
No RightDown, no SetFocus...
Mirek
|
|
|
 |
|
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 14:46:09 CEST 2025
Total time taken to generate the page: 0.06580 seconds
|