Say, if I have a default EDIT common control in my MFC-based dialog window:
I’m looking for a way to add a small “X” (or delete) button inside of it (here’s my Photoshop rendering of what I need):
Is there a way to do it by modifying the default edit control?
3
Answers
Please consider using new class
CMFCEditBrowseCtrl
. It does have methodCMFCEditBrowseCtrl::EnableBrowseButton()
to do exactly what you need.If I wanted more than one button, I would investigate alternatives:
See the
CMFCEditBrowseCtrl
class’ code. Then decide if derive a class from it and extend; or else derive from CEdit, copyCMFCEditBrowseCtrl
code and extend.Case the edit is multi-line, I would investigate the methods CEdit::SetRect and CEdit::SetRectNP. Case it is single-line I would look to CEdit::SetMargins. Then implement normal buttons over the text area of the edit.
Please refer this article for CMFCEditBrowseCtrl class..
https://www.codeproject.com/Articles/35722/MFC-Feature-Pack-CMFCEditBrowseCtrl