VC++ dynamically add/remove CEdit borders 
Author Message
 VC++ dynamically add/remove CEdit borders

VC++ V6.0 with latest updates from MS website
CEdit controls created with resource editor.
App created as a dialog-only.

I need to dynamically highlight / un-highlight CEdit controls, preferrably
by adding / removing the borders.
I have tried CWnd::ModifyStyle and ModifyStyleEx with no effect.

Please tell me how to add remove borders to/from a CEdit control without
re-creating it.

thanks much

Chuck



Wed, 09 Oct 2002 03:00:00 GMT  
 VC++ dynamically add/remove CEdit borders


Quote:
> VC++ V6.0 with latest updates from MS website
> CEdit controls created with resource editor.
> App created as a dialog-only.

> I need to dynamically highlight / un-highlight CEdit controls,
preferrably
> by adding / removing the borders.
> I have tried CWnd::ModifyStyle and ModifyStyleEx with no effect.

> Please tell me how to add remove borders to/from a CEdit control
without
> re-creating it.

Look at this (taken from Remarks to SetWindowLong):

Certain window data is cached, so changes you make using SetWindowLong
will not take effect until you call the SetWindowPos function.
Specifically, if you change any of the frame styles, you must call
SetWindowPos with the SWP_FRAMECHANGED flag for the cache to be
updated properly.

End quote
--
With best wishes,
    Igor Tandetnik



Wed, 09 Oct 2002 03:00:00 GMT  
 VC++ dynamically add/remove CEdit borders

Quote:
>I need to dynamically highlight / un-highlight CEdit controls, preferrably
>by adding / removing the borders.
>I have tried CWnd::ModifyStyle and ModifyStyleEx with no effect.

>Please tell me how to add remove borders to/from a CEdit control without
>re-creating it.

Chuck,

Make sure you specify SWP_DRAWFRAME when you use ModifyStyle:

CEdit * pEd = static_cast<CEdit *>(GetDlgItem( IDC_EDIT1 ) );    
pEd->ModifyStyleEx( WS_EX_CLIENTEDGE, 0, SWP_DRAWFRAME );

It depends what styles you're trying to change - many controls allow
you to change their style at run-time, but don't take any notice of
the changes - they only take effect when the control is created.

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
My address is altered to discourage junk mail.
Please post responses to the newsgroup thread,
there's no need for follow-up email copies.



Thu, 10 Oct 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Web Browser Control - Add Border - Remove Right Click Functionality

2. How to remove dynamically added control?

3. Dynamically Add/Remove Property Page

4. Remove border in CHTMLView

5. Removing border from a static control

6. Remove Border when in Full Screen Mode

7. how to remove WebBrowser control border??

8. remove border of window

9. remove dialog frames border at creation/runtime

10. Removing CFormControl's border

11. Remove Border from CFormView Applucation

12. SDI application border, can I remove it?

 

 
Powered by phpBB® Forum Software