Masked edit control
spillman!bworthen@uunet.uu.net Wednesday, October 16, 1996 Environment: VC++ 4.2, Win NT 4.0 I had a question regarding Microsoft's Masked Edit OLE control that ships with VC++ 4.2. I'll outline what I am trying to do and then I'll present my question. I need to have a control that provides all the funtionality of the OLE masked edit from Microsoft, plus some other functionality (such as padding, doing some special validity checking, etc.). So, I started by inserting the OLE control from the Component Gallery into my test project. This created the proxy class "CMsmask" (along with a couple of other classes). I read somewhere that, rather than hacking up the proxy class, it is safer to create my own class, that inherits from CMsmask, and add to this class the extra funtionality that I need. So, I created my own class that inherits from CMsmask (in the normal C++ way), and I kept this class to a bare minimum (a constructor, destructor, etc.). Now, after having done all this, I went to my dialog's "OnInitDialog" method. In this method I created my own control within the dialog using the following code: BOOL COletestDlg::OnInitDialog() { ....... ....... m_myMaskEdit = new CMyMaskEdit; // Inherits from CMsmask m_myMaskEdit->Create(........); // Set various properties for the control: ....... m_myMaskEdit->SetFontBold(FALSE); // TRUE or FALSE m_myMaskEdit->SetAppearance(1); // 0 = Flat, 1 = 3D m_myMaskEdit->SetMask(_T("###-##-####")); ....... ....... } The problem that I'm having is that my control does not have the 3D look that it should when I call "SetAppearance" with a parameter of 1. The control still has the flat look. Now for my question. My question is three-fold: 1) Am I going about solving my problem in the correct manner? In other words, is it okay to create my own class, that inherits from an OLE control proxy class, to add my own functionality, etc.? Is there a better way? 2) Can anyone see any limitations to this plan? In other words, will there be any limitations to setting up my own message handlers and data exchange, etc. for my control? For example, detecting when the focus is leaving my control so that I can do some validity checking (along with other things) at that point? 3) Why can't I get the 3D look for my control using SetAppearance? Any help would be greatly appreciated!! Send any replies to either this group or to the following e-mail address: bworthen@spillman.com Thanks, Brad bworthen@spillman.com
Sanjay Chouksey -- sanjay@mediaway.com Friday, October 18, 1996 Hi, You are not setting the border. 3D looks go to the border !! :) Sanjay > BOOL COletestDlg::OnInitDialog() > { > ....... > ....... > m_myMaskEdit = new CMyMaskEdit; // Inherits from CMsmask > > m_myMaskEdit->Create(........); > > // Set various properties for the control: > ....... > m_myMaskEdit->SetFontBold(FALSE); // TRUE or FALSE > m_myMaskEdit->SetAppearance(1); // 0 = Flat, 1 = 3D > m_myMaskEdit->SetMask(_T("###-##-####")); > //$$$$$$$$$$$ here $$$$$$$$$$$$$$$$$$$ > m_myMaskEdit->SetBorder(1)); // 1= single, 0=none > //$$$$$$$$$$$ there $$$$$$$$$$$$$$$$$$$ > ....... > ....... > } > > The problem that I'm having is that my control does not have the > 3D look that it should when I call "SetAppearance" with a parameter > of 1. The control still has the flat look.
| Вернуться в корень Архива |