Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » CExtEdit painted strangely Collapse All
Subject Author Date
Suhai Gyorgy Aug 15, 2006 - 4:56 AM

Dear Support,

I’ve made a CExtResizableDialog with some CExtEdit controls on it. I modally show this dialog from a command item of my SDI based application.

I have some problems with the CExtEdit controls’ painting. Let’s say: one of the controls is in focus and I open another window fullscreen over it. After minimizing this second window, my CExtResizableDialog gets the focus again, the caret is blinking in the edit control, as before, but that control is not white inside, but painted over with the dialog’s background color. Only when I move the mouse over the control (and by that forcing it to repaint), it gets back to normal again. Also, one of the edit controls are multiline and the scrollbar of it gets painted over with the background color the same way as the focused control.

I tried inserting this dialog class into your SimpleGrid sample, but it’s acting the same way there as well.

Here’s the code:

in .h:

class CStrangeEditDlg : public CExtResizableDialog
{
	DECLARE_DYNAMIC(CStrangeEditDlg)

public:
	CStrangeEditDlg(CWnd* pParent = NULL);   // standard constructor
	virtual ~CStrangeEditDlg();

// Dialog Data
	enum { IDD = IDD_STRANGE_EDIT_DLG };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	CExtGroupBox ctrlGroupBox;
	CExtLabel        stcTitle;
	CExtEdit          ctrlTitle;
	CExtLabel        stcUserName;
	CExtEdit          ctrlUserName;
	CExtLabel        stcNotes;
	CExtEdit          ctrlNotes;
};

in .cpp:
CStrangeEditDlg::CStrangeEditDlg(CWnd* pParent)
	: CExtResizableDialog(CStrangeEditDlg::IDD, pParent)
{
}

CStrangeEditDlg::~CStrangeEditDlg()
{
}

void CStrangeEditDlg::DoDataExchange(CDataExchange* pDX)
{
	CExtResizableDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_PF_GROUP_ALL, ctrlGroupBox);
	DDX_Control(pDX, IDC_PF_TITLE_STC, stcTitle);
	DDX_Control(pDX, IDC_PF_TITLE_EDIT, ctrlTitle);
	DDX_Control(pDX, IDC_PF_USERNAME_STC, stcUserName);
	DDX_Control(pDX, IDC_PF_USERNAME_EDIT, ctrlUserName);
	DDX_Control(pDX, IDC_PF_NOTES_STC, stcNotes);
	DDX_Control(pDX, IDC_PF_NOTES_EDIT, ctrlNotes);
}

in .rc:
IDD_STRANGE_EDIT_DLG DIALOGEX 0, 0, 260, 188
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | 
    WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU
CAPTION "Strange Edit"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
    GROUPBOX        "",IDC_PF_GROUP_ALL,7,3,246,159
    LTEXT           "Title",IDC_PF_TITLE_STC,14,14,70,12,SS_CENTERIMAGE
    EDITTEXT        IDC_PF_TITLE_EDIT,90,14,156,12,ES_AUTOHSCROLL
    LTEXT           "Username",IDC_PF_USERNAME_STC,14,32,70,12,SS_CENTERIMAGE
    EDITTEXT        IDC_PF_USERNAME_EDIT,90,32,156,12,ES_AUTOHSCROLL
    LTEXT           "Notes",IDC_PF_NOTES_STC,14,86,70,12,SS_CENTERIMAGE
    EDITTEXT        IDC_PF_NOTES_EDIT,90,86,156,70,ES_MULTILINE | 
                    ES_AUTOVSCROLL | WS_VSCROLL
    DEFPUSHBUTTON   "OK",IDOK,76,168,50,14,BS_CENTER
    PUSHBUTTON      "Cancel",IDCANCEL,134,168,50,14,BS_CENTER
END

I tried removing WS_CLIPCHILDREN and WS_CLIPSIBLINGS styles from the dialog resource, but still no luck.
What am I missing?

Best regards,
Chris.

Suhai Gyorgy Aug 15, 2006 - 5:07 AM

Screenshots:

When everything is fine.
After placing another window over it, it’s ruined.

Chris.

Technical Support Aug 15, 2006 - 6:53 AM

You should not remove the WS_CLIPSIBLINGS | WS_CLIPCHILDREN window style from your dialog. You should open the IDD_STRANGE_EDIT_DLG dialog and change the tab order of its elements (Ctrl+D). The IDC_PF_GROUP_ALL group box should have the highest order number.

Suhai Gyorgy Aug 15, 2006 - 7:31 AM

I remembered that tab order is essential when using CExtGroupBox, but I thought it had to have the lowest order number. Sorry, it was my fault.

Best regards:
Chris.