Subclassing

Hello,

Im very new to c++ programming so pardon me if this is a dumb question and 
my bad english.
I made a subclass from CListBox. I want to handle all the list controls 
derived from this class on one function, for example, 

void CListBox_SC::OnRButtonUp(UINT nFlags, CPoint point) 
{
.....
}
on this function I want to manage the OnRButtonUp event, and with a switch 
or if statement, select the code to execute. The following does work:

SetCurSel(ItemFromPoint(point, ifp));

but the following comparison is never true, (IDC_LST_TIPO is a resource for 
one of the ListBoxes)

UINT currLst = ItemFromPoint(point, ifp);
if(currLst == IDC_LST_TIPO)

How can I determine which listbox was selected?

Thanks

Fernando
0
fernando (26)
10/31/2004 2:47:01 AM
vc.mfc 33608 articles. 0 followers. Follow

9 Replies
1365 Views

Similar Articles

[PageSpeed] 26

"Fernando" <Fernando@discussions.microsoft.com> wrote in message
news:78232BA2-2095-447C-A0EB-3723710510A9@microsoft.com...
> Hello,
>
> Im very new to c++ programming so pardon me if this is a dumb question and
> my bad english.
> I made a subclass from CListBox. I want to handle all the list controls
> derived from this class on one function, for example,
>
> void CListBox_SC::OnRButtonUp(UINT nFlags, CPoint point)
> {
> ....
> }
> on this function I want to manage the OnRButtonUp event, and with a switch
> or if statement, select the code to execute. The following does work:
>
> SetCurSel(ItemFromPoint(point, ifp));
>
> but the following comparison is never true, (IDC_LST_TIPO is a resource
for
> one of the ListBoxes)
>
> UINT currLst = ItemFromPoint(point, ifp);
> if(currLst == IDC_LST_TIPO)
>
> How can I determine which listbox was selected?

If I understand you correctly, it seems a very odd and impractical thing for
a control to alter its behavior based on the id given it by the user. I'm
inclined to argue against it. Anyway, ItemFromPiont does not return the
control id at all. Presumably this could be obtained using GetDlgCtrlID.
-- 
Jeff Partch [VC++ MVP]


0
jeffp (1712)
10/31/2004 3:04:12 AM
I did it this way so I could have a popup menu with right click mouse, I 
found a code example, is there an easier way to do this?

"Jeff Partch [MVP]" wrote:

> "Fernando" <Fernando@discussions.microsoft.com> wrote in message
> news:78232BA2-2095-447C-A0EB-3723710510A9@microsoft.com...
> > Hello,
> >
> > Im very new to c++ programming so pardon me if this is a dumb question and
> > my bad english.
> > I made a subclass from CListBox. I want to handle all the list controls
> > derived from this class on one function, for example,
> >
> > void CListBox_SC::OnRButtonUp(UINT nFlags, CPoint point)
> > {
> > ....
> > }
> > on this function I want to manage the OnRButtonUp event, and with a switch
> > or if statement, select the code to execute. The following does work:
> >
> > SetCurSel(ItemFromPoint(point, ifp));
> >
> > but the following comparison is never true, (IDC_LST_TIPO is a resource
> for
> > one of the ListBoxes)
> >
> > UINT currLst = ItemFromPoint(point, ifp);
> > if(currLst == IDC_LST_TIPO)
> >
> > How can I determine which listbox was selected?
> 
> If I understand you correctly, it seems a very odd and impractical thing for
> a control to alter its behavior based on the id given it by the user. I'm
> inclined to argue against it. Anyway, ItemFromPiont does not return the
> control id at all. Presumably this could be obtained using GetDlgCtrlID.
> -- 
> Jeff Partch [VC++ MVP]
> 
> 
> 
0
fernando (26)
10/31/2004 3:22:02 AM
So GetDlgCtrlID() returns the current selcted item (the one that is focused)?

thanks,
Fernando

"Scott McPhillips [MVP]" wrote:

> Fernando wrote:
> > Hello,
> > 
> > Im very new to c++ programming so pardon me if this is a dumb question and 
> > my bad english.
> > I made a subclass from CListBox. I want to handle all the list controls 
> > derived from this class on one function, for example, 
> > 
> > void CListBox_SC::OnRButtonUp(UINT nFlags, CPoint point) 
> > {
> > ....
> > }
> > on this function I want to manage the OnRButtonUp event, and with a switch 
> > or if statement, select the code to execute. The following does work:
> > 
> > SetCurSel(ItemFromPoint(point, ifp));
> > 
> > but the following comparison is never true, (IDC_LST_TIPO is a resource for 
> > one of the ListBoxes)
> > 
> > UINT currLst = ItemFromPoint(point, ifp);
> > if(currLst == IDC_LST_TIPO)
> > 
> > How can I determine which listbox was selected?
> > 
> > Thanks
> > 
> > Fernando
> 
> You are a bit confused - ItemFromPoint does not return a control ID. 
> You can determine which listbox was selected by calling GetDlgCtrlID().
> 
> -- 
> Scott McPhillips [VC++ MVP]
> 
> 
0
fernando (26)
10/31/2004 3:23:05 AM
"Fernando" <Fernando@discussions.microsoft.com> wrote in message
news:1772CA67-3284-456F-8294-FA1657778851@microsoft.com...
> I did it this way so I could have a popup menu with right click mouse, I
> found a code example, is there an easier way to do this?

I'm personally partial to using WM_CONTEXTMENU for context menu invocation,
but it isn't anything I'd call easier. It's not clear what you intend to do
differently using the control id, but I'm leaning toward a presumption that
you may not actually need this in your subclass implementation at all. If
that's not the case, could you elaborate? One thing I'll add (mostly as an
FYI) is that you don't necessarily need to subclass at all to handle
WM_CONTEXTMENU for a standard listbox control-- it can be handled in the
parent. One might need to use GetDlgCtrlID in that case.
-- 
Jeff Partch [VC++ MVP]


0
jeffp (1712)
10/31/2004 3:34:48 AM
Thanks for your comments!

GetDlgCtrlID( ) works fine

Fernando

"Fernando" wrote:

> Hello,
> 
> Im very new to c++ programming so pardon me if this is a dumb question and 
> my bad english.
> I made a subclass from CListBox. I want to handle all the list controls 
> derived from this class on one function, for example, 
> 
> void CListBox_SC::OnRButtonUp(UINT nFlags, CPoint point) 
> {
> ....
> }
> on this function I want to manage the OnRButtonUp event, and with a switch 
> or if statement, select the code to execute. The following does work:
> 
> SetCurSel(ItemFromPoint(point, ifp));
> 
> but the following comparison is never true, (IDC_LST_TIPO is a resource for 
> one of the ListBoxes)
> 
> UINT currLst = ItemFromPoint(point, ifp);
> if(currLst == IDC_LST_TIPO)
> 
> How can I determine which listbox was selected?
> 
> Thanks
> 
> Fernando
0
fernando (26)
10/31/2004 4:05:01 AM
Fernando wrote:
> Hello,
> 
> Im very new to c++ programming so pardon me if this is a dumb question and 
> my bad english.
> I made a subclass from CListBox. I want to handle all the list controls 
> derived from this class on one function, for example, 
> 
> void CListBox_SC::OnRButtonUp(UINT nFlags, CPoint point) 
> {
> ....
> }
> on this function I want to manage the OnRButtonUp event, and with a switch 
> or if statement, select the code to execute. The following does work:
> 
> SetCurSel(ItemFromPoint(point, ifp));
> 
> but the following comparison is never true, (IDC_LST_TIPO is a resource for 
> one of the ListBoxes)
> 
> UINT currLst = ItemFromPoint(point, ifp);
> if(currLst == IDC_LST_TIPO)
> 
> How can I determine which listbox was selected?
> 
> Thanks
> 
> Fernando

You are a bit confused - ItemFromPoint does not return a control ID. 
You can determine which listbox was selected by calling GetDlgCtrlID().

-- 
Scott McPhillips [VC++ MVP]

0
Scott
10/31/2004 4:08:56 AM
Fernando wrote:
> So GetDlgCtrlID() returns the current selcted item (the one that is focused)?
> 
> thanks,
> Fernando
> 

Not at all. If you have several of your subclassed list box objects, 
only the one that is clicked on receives the click message. 
GetDlgCtrlID()returns the ID of the object that is executing the message 
handler.  Kind of like "Who am I?"

-- 
Scott McPhillips [VC++ MVP]

0
Scott
10/31/2004 2:04:10 PM
I'm going to have to disagree with you on this one. It would appear to be a 
highly practical solution. One class handles multiple list controls and 
responds in a manner that is appropriate for the particular list control.

So, as I understand it, the class is responding to the user's right button 
click. One would think that GetDlgCtrlID() would return the ID of the window 
for which the code is currently executing.
===
Richard Lewis Haggard

"Jeff Partch [MVP]" <jeffp@mvps.org> wrote in message 
news:uBA6KZvvEHA.2568@TK2MSFTNGP11.phx.gbl...
> "Fernando" <Fernando@discussions.microsoft.com> wrote in message
> news:78232BA2-2095-447C-A0EB-3723710510A9@microsoft.com...
>> Hello,
>>
>> Im very new to c++ programming so pardon me if this is a dumb question 
>> and
>> my bad english.
>> I made a subclass from CListBox. I want to handle all the list controls
>> derived from this class on one function, for example,
>>
>> void CListBox_SC::OnRButtonUp(UINT nFlags, CPoint point)
>> {
>> ....
>> }
>> on this function I want to manage the OnRButtonUp event, and with a 
>> switch
>> or if statement, select the code to execute. The following does work:
>>
>> SetCurSel(ItemFromPoint(point, ifp));
>>
>> but the following comparison is never true, (IDC_LST_TIPO is a resource
> for
>> one of the ListBoxes)
>>
>> UINT currLst = ItemFromPoint(point, ifp);
>> if(currLst == IDC_LST_TIPO)
>>
>> How can I determine which listbox was selected?
>
> If I understand you correctly, it seems a very odd and impractical thing 
> for
> a control to alter its behavior based on the id given it by the user. I'm
> inclined to argue against it. Anyway, ItemFromPiont does not return the
> control id at all. Presumably this could be obtained using GetDlgCtrlID.
> -- 
> Jeff Partch [VC++ MVP]
>
> 


0
Richard
11/5/2004 5:56:40 PM
"Richard Lewis Haggard" <HaggardAtWorldDotStdDotCom> wrote in message
news:O2EeUD2wEHA.3276@TK2MSFTNGP15.phx.gbl...
> "Jeff Partch [MVP]" <jeffp@mvps.org> wrote in message
> > If I understand you correctly, it seems a very odd and impractical thing
> > for
> > a control to alter its behavior based on the id given it by the user.
I'm
> > inclined to argue against it. Anyway, ItemFromPiont does not return the
> > control id at all. Presumably this could be obtained using GetDlgCtrlID.
>
> I'm going to have to disagree with you on this one. It would appear to be
a
> highly practical solution. One class handles multiple list controls and
> responds in a manner that is appropriate for the particular list control.
>
> So, as I understand it, the class is responding to the user's right button
> click. One would think that GetDlgCtrlID() would return the ID of the
window
> for which the code is currently executing.

Well, here's my thinking...

Id's are so the parent can discern individual controls during event
notifications. How does the control itself know in advance what id the user
is going to give it or have any control over it? You'd have to document that
if you give this subclass implementation this magic id it'll do this and
that magic id it'll do that and whatnot. Can you think of a single published
control the works this way? These sorts of internal behavioral changes are
what styles are for.

:)

-- 
Jeff Partch [VC++ MVP]


0
jeffp (1712)
11/5/2004 6:37:26 PM
Reply:

Similar Artilces:

Subclassing
Hello, Im very new to c++ programming so pardon me if this is a dumb question and my bad english. I made a subclass from CListBox. I want to handle all the list controls derived from this class on one function, for example, void CListBox_SC::OnRButtonUp(UINT nFlags, CPoint point) { ..... } on this function I want to manage the OnRButtonUp event, and with a switch or if statement, select the code to execute. The following does work: SetCurSel(ItemFromPoint(point, ifp)); but the following comparison is never true, (IDC_LST_TIPO is a resource for one of the ListBoxes) UINT currLst = It...

Custom Drawing CEdit : Subclassing
Hello experts, My objective is simple, but I'm not entirely sure what needs tweaking. I am using MSVC 6, and I would like to subclass the CEdit box so that it appears as the color-picker editbox of a PropertyGrid. There is a color box followed by three values. Like this: [###] 255; 192; 192 Where ### is just a color box representation of the value. So thus far, I've made a masked CEdit box, where I can edit the numbers (or click a button that visually sets the numbers from a different window), and I'm happy with that - but what I would like to do next is to subclass the dra...

Help with subclassing a RichEditCtrl
Hi folks, I could use some help. As a side project I am trying to write a DLL that will extend the functionality of an existing application that I do not have source code for, i.e., some autocompletion functionality, word lookup, etc. In the actual DLL, I am going to have to inject it into the existing app and then use FindWindow or something like that to subclass the existing RichEditCtrl. I need to be able to process the WM_CHAR and WM_KEYDOWN messages only. I started out by creating my own sample project using a RichEditCtrl in my project to code my object. I've now moved everythin...

WM_CREATE for a subclass
Hi All, I am fairly new to C++, although I have developed OO windows applications in the past using CTD and Power Builder. I am developeing an edit class based on a CEdit. I am trying to trap the WM_CREATE message to modify the style of the window (i.e. to make is multiline). For some reason the control does not appear to be getting the WM_CREATE message ( or at least it is not implementing the handler I have for it). At present I create an edit control on a form and the Subclass the edit. This appears to work as my user defined menu is used and my color modifications appear as requir...

Subclassing CWinThread
I created a subclass of CWinThread - no big deal! Now, what I would like to do is use that subclass as a base class for a couple of other, more specialized classes. How can I do this? If I create a subclass as a generic C++ class, then I'm running into the assertion, "Invalid Address specified to RtlValidateHeap( 00940000, 0042DBA0 )" when I post the quit message to the thread. I assume this might have something to do with the virtual/non-virtual constructor combination of the MFC class and the generic C++ class. Any thoughts? Create more subclasses of CWinThread, then ...

Subclassing TreeView
I created a class derived from a TreeView (ShellTree) that displays the Shell directory structure . I changed the LeftView class so that it is derived from my ShellTree class, and everything works as expected, except I cannot add any TreeView specific message handlers to my LeftView class any more eg. NM_DBLCLICK. Basically in a nutshell what i want to do is display the directory name (which is stored in a variable in the ShellTree class) when the LeftView is Double clicked Check out http://www.codeproject.com/treectrl/enumdeskclones.asp Which isn't perfect.. but is a good star...

Subclassing a subclass of CDialog, for cross-platform compilation
Hi people, I've been working on porting an app from PC to Mac. What I'm trying to do, is separate out the PC specific components into it's own subclass. So there are the PC specific functions like PCAppDlg::OnBtnClicked1, and mac specific functions like MacAppDlg::BlaBlaBla. Of course the Mac subclass doesn't compile on the PC, and the same the other way around. I've had to write my own CDialog wrapper for Mac but that's another story. Now anyhow, this leads me to a question. How to subclass a subclass? Specifically, how does the message maps work? Will there be any p...

Xml Serializing subclass problem
Hi guys. I've come across a problem when I tried to serialize a class into xml, only to discover that the parent class's XML Serialization properties weren't included in the output xml. Actually, the class I'm serializing is two steps down in the inheritance ladder. It's got a parent class which also has a parent class :( All those classes in the hierarchy are Xml Serializable, and I'd think that it should be obvious that all attributes/properties of the parents should be serialized for any given subclass, no ? Here's the two classes, subclass first, parent class...

Subclassing problem???
Hi there, I've got: LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ switch(uMsg){ case WM_NCACTIVATE: if((BOOL)wParam==FALSE){ DefWindowProc(hwnd, uMsg, wParam, lParam); CreateText(hwnd); return TRUE; } case WM_NCPAINT: DefWindowProc(hwnd, uMsg, wParam, lParam); CreateText(hwnd); break; } DefWindowProc(hwnd, uMsg, wParam, lParam); } void CreateText(HWND hwnd){ HDC hDC = GetWindowDC(hwnd); int x,y; RECT rc1,rc2; GetWindowRect(hwnd, (LPRECT)&rc2 ); x = GetSystemMetrics(SM_CXSIZE) + GetSystemMetrics(SM_CXBORDE...

subclassing CStatic
Hi, I have subclassed a few CStatic ctrls so i can quickly change their font, BG and FG colors etc... I have also handled the CFormView's CtlColor message and painted the form white and text blue. The problem that im having is the subclassed objects are painting themselves the colors i specify, then the CFormView::OnCtlColor is painting them again. This isnt too much of a problem as i can simply exclude the subclassed items from the painting using: HBRUSH CSmartMXEditLangView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { // create white brush: m_DlgBrush.DeleteObject(); ...

VC
I need a way to come up with a simple (free) combobox activeX control I can use in a third party development tool. I tried just subclassing ComboBoxEx using the ActiveX control wizard in VC6. It clearly creates the control, but it doesn't seem to be created with the properties and methods (like AddItem/New) and when I plop on a VB6 form it doesn't look like a combobox. Granted I am newbie working way over my head, by why would the ActiveX control wizard ask me which control to inherit from if it isn't going to give me _roughly_ the same functionality? Can anyone point me in a di...

subclassing CComboBox
compiler: VC++ 6.0 SP 6, running XP Pro SP 2. I subclassed CComboBox into CMyComboBox, then setup up event handlers for several of the reflected events -- one being CBN_CLOSEUP reflected event. I have an object of type CMyComboBox in an MFC program, which also needs to catch the CBN_CLOSEUP event. I used ClassWizard to create all event handlers. Problem: The event handler in CMyComboBox works ok, but the handler in the application program never gets called. Is there a way around this problem? I tried posting a message to the parent window but that didn't seem to work either (pare...

Moving subclasses to different classes
I'm having trouble figuring out how to move subclasses to different classes (to re-assign budget categories to differnt umbrella budget areas). I see a "MOVE" button at the bottom of the list of Classes but can't figure out how to make it active. Anyone know the secret to moving classes without deleting them, recreating them under a new high level class, and re-assigning the transactions? Thanks in Advance!! Never mind -- you just delete the class and ask it to reassign things to a new subclass bucket. PRODUCT WISHLIST: Have the "MOVE" button active...

Subclassing AfxControlBar80su
I have a CDialogBar derived class which has a bitmap background texture. The parent's wndclass is AfxControlBar80su which still displays in gray. I'd like to give it the same background as the dialog bar and I thought it could be done by subclassing and handling the appropriate messages. But how can that be done? TIA, Hans Subclass CDialogBar and override OnPaint would be my first guess as to how to do it. The AfxControlBar80su is probably not relevant here. joe On Mon, 30 Jul 2007 01:16:15 +0200, Hans-J. Ude <news@hajue-ude.de> wrote: >I have a CDialogBar derived c...

subclassing a CTreeCtrl
All, I'm trying to subclass a CTreeCtrl control with a CHeaderCtrl derived class to obtain the result as in (http://users.pandora.be/bart.de.lathouwer/Untitled-1.jpg) I would subclass the CTreeCtrl derived class to be able to draw 'over' both the header and CTreeCtrl surface. When I subclass my CTreeCtrl derived class it reports that it is already attached. My Ctrl's live in a CWnd derived class. Question: What is the correct way to subclass my CTreeCtrl with my HeaderClass to be able to draw "over" both classes? If not possible what is an alternative? (apart from ...

Subclass question
Hi, I am writing an app in which I have a dialog bar (IDD_DLGBAR) at the top of the MDI frame window besides the standard toolbar. The dialog bar contains several controls. One of them is a combo box with id IDC_SEARCHBOX. I also created a class CSearchBox (derived from CComboBox) to process keyboard messages. My question is how do I link the combo box in the dialog bar with CSearchBox class so I can capture keyboard events (i.e., PreTranslateMessage)? Thanks in advance. >Hi, I am writing an app in which I have a dialog bar (IDD_DLGBAR) at the top >of the MDI frame window beside...

Subclass Help
During the desing of my app, I realized that I would need to have a combobox with a set of pre-defined values (collected from a database). This combobox will be used in many dialogs and for that, I decided to derive my own class. I want the combobox to be populated when created, but I can't figure out how to make it work with DDX. If I "create" it manually, I can do this in "OnCreate," but I'm attaching to a dialog. I don't know what gets called when DDX does the attaching. Any ideas? Thanks in advanced. Eddie. "Eddie Pazz" <drpazz@hotmail...

SHBrowseForFolder Subclassing.
I would like to change the name of the "cancel" button. Is that possible with Subclassing, Superclassing, etc.? ....Bruce Maybe this article can help you: http://www.codeproject.com/dialog/browse_for_folder_dialog.asp -- Mav Rossi "Bruce Arnold" <b_a_r_n_o_l_d@b_l_a_s_t.n_e_t> ha scritto nel messaggio news:cka5tv4rf6mq086b1nf6t6gom5rgds0a33@4ax.com... > I would like to change the name of the "cancel" button. Is that > possible with Subclassing, Superclassing, etc.? > ...Bruce > > And this too: http://www.codeproject.com/dialog/browse...

Re: Subclassing
Hi All I wish to create my own control for subclassing. The control will essentially contain some simple text and some minor graphics. No real control functionality is required. The question is should I derive this new control from an existing control, say CButton, or directly from CWnd? Thanks in advance LarryM wrote: > Hi All > > I wish to create my own control for subclassing. The control will > essentially > contain some simple text and some minor graphics. No real control > functionality is required. > > The question is should I derive this new control...

Subclassing controls
Hi! I'm trying to create a custom control with custom NC area, but there's an odd problem: When I create the control using .Create(...), its all fine, but when I subclass the control, the NC messages are never sent! Anyone knows why this happens?? Tnx... >I'm trying to create a custom control with custom NC area, but there's an >odd problem: >When I create the control using .Create(...), its all fine, >but when I subclass the control, the NC messages are never sent! Which WM_NC* messages in particular? Presumably the WM_NCCREATE message won't be caught...

questions of subclassing
hi all I derieved a button class called cmybutton, I want to replace all button in my application with cmybutton so I use subclass but the question is, if the button is created by my resource templates, it works, but failed in other resource templates such as Message Boxs' buttons. That is, if I use AfxmessageBox to display a dialog box, the buttons in the dialog didn't display it seems the subclassing doesn't work what can I do many thanks That's because you cannot subclass messagebox buttons. Subclassing in MFC works only because it is a fiction maintained by MFC ...

Subclassed CEdit needs OnClose
I have a subclassed CEdit control. I need to GetWindowText() just before the CEdit is destroyed, but can't figure out where to do this. I've tried OnDestroy() (doesn't get called), my destructor (the m_hWnd is no longer valid), OnClose() (doesn't get called), etc. Thanks, Steve Could you grab the text in a OnKillFocus() handler? That way you'd get a message when they move off of the control as well as when it is destroyed. Just a thought. Tom "Steve" <junk@bruff.com> wrote in message news:97327c0.0309251221.35c93d02@posting.google.com... > I have...

questionn about subclass.
In a Dialog. Define these 2 member: CButton m_btnOld; CMyButton m_btnMy; Add these code in OnInitDialog: CRect rectBtn(300,10,350,40); m_btnOld.Create(_T("asdfas"),WS_CHILD|WS_VISIBLE,rectBtn,this,3000); m_btnMy.SubclassDlgItem(3000,this); I got a assert when it run to " m_btnMy.SubclassDlgItem(3000,this);" the assert is: ASSERT(FromHandlePermanent(hWndNew) == NULL); is this method right? if not, how shall I do? thanks a lot! "rokia" <rokiadd@yahoo.com.cn.discuss> wrote in message news:%23iJRUSWbEHA.3524@TK2MSFTNGP12.phx.gbl... > In a...

Subclass CPropertySheet Wizard Buttons?
I am using the Roundbutton class found on CodeGuru (derives from CButton). http://www.codeguru.com/Cpp/controls/buttonctrl/non-rectangularbuttons/article.php/c2067 I am developing an application with a Wizard (CPropertySheet). Is it possible to subclass the Next,Back, and Finish buttons so that I can give them a custom look? I'd like to utilize the above CButton class if possible. Jim Jones There seem to be quite a few examples here http://www.codeguru.com/Cpp/controls/propertysheet/ in particular http://www.codeguru.com/Cpp/controls/propertysheet/article.php/c597/ Also...

subclass a Maskedbox
Hello I want to subclass a maskedbox and use it in a class that instantiates a MSHFlexgrid. See the code below. I keep having an error in the last line of the code: type mismatch. Does anybody know what's wrong? Thanks private strMbName as string private with events fg as MSHFlexgrid private with events Mb as maskedbox sub test strMbName = "mbFgEdit1" Call Licenses.Add("MSMASK.MaskEdBox") fg.Parent.Controls.Add "MSMask.MaskEdBox", strMbName, fg.Container Set Mb = fg.Parent.Controls(strMbName) end sub C...