Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Context menu in a embedded class?
Context menu in a embedded class? [message #19528] |
Thu, 11 December 2008 19:23 |
kbyte
Messages: 87 Registered: July 2008
|
Member |
|
|
Hi,
I have this code:
Class x:
tabdlg.dbgrid1.AddColumn("ID");
tabdlg.dbgrid1.AddColumn("Date");
tabdlg.dbgrid1.AddColumn("Value");
tabdlg.dbgrid1.AddColumn("Paid");
tabdlg.dbgrid1.ColumnWidths("0 50 50 200");
tabdlg.dbgrid1.WhenLeftDouble = THISBACK(OnAnuidDBClick);
tabdlg is a member of the class x. It is also defined in the .h of the class x like this:
class CTablDlg : public WithPaidLayout<TopWindow> {
typedef CTablDlg CLASSNAME;
public:
CTablDlg();
};
Is it possible to trap the context menu event of this dbgrid as I trap the left dbclick? How?
Thanks
Alex
|
|
|
Re: Context menu in a embedded class? [message #19535 is a reply to message #19528] |
Fri, 12 December 2008 11:26 |
mrjt
Messages: 705 Registered: March 2007 Location: London
|
Contributor |
|
|
It depends on what type of Ctrl dbgrid1 is.
If it's ArrayCtrl then use the WhenBar callback
If it's GridCtrl then I'm not very familiar with it, but WhenMenuBar seems to be what you need.
Searching for 'Bar&' in a Ctrl's header file usually points you at the correct callback if it has one.
For a generic 'simple' Ctrl that doesn't have a callback you can use something like this template:
template <class T>
struct WithBar : public T
{
Callback1<Bar&> WhenBar;
virtual void RightDown(Point p, dword keyflags) { MenuBar::Execute(WhenBar); }
};
[Updated on: Fri, 12 December 2008 11:26] Report message to a moderator
|
|
|
|
|
|
Goto Forum:
Current Time: Mon May 06 05:02:51 CEST 2024
Total time taken to generate the page: 0.03706 seconds
|