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 General Discussion » CExtResizableDialog & CRichEdit Collapse All
Subject Author Date
pascal bosquet Sep 1, 2006 - 12:55 AM

Hello there,

i’m still newbie to mfc, so sorry if it’s too obvious but i can not succeed to display a CRichEdit in a CExtResizableDialog which is embeded in a CExtControlBar. I create the rich text in the WM_CREATE as following. Off course i added     AfxInitRichEdit(); in the app class InitInstance. but still my richedit doesn’t show off. I don’t have "document" "view" architecture. besides my main project, i did a test with a richedit replacing the CView and all was working fine, so i wonder what’s i’m doing wrong :s.

thanks in advance

pascal

int CFrmMsgLog::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CExtResizableDialog::OnCreate(lpCreateStruct) == -1)
        return -1;
    
    // create a RichEdit window to occupy the client area of the frame
    if (!m_RichEdit.Create(WS_CHILD | WS_VISIBLE | ES_AUTOVSCROLL | ES_AUTOHSCROLL |
        ES_AUTOHSCROLL | ES_MULTILINE | WS_HSCROLL | WS_VSCROLL,
        CRect(0,0,0,0), this, AFX_IDW_PANE_FIRST))
    {
        TRACE0("Failed to create RichEdit window\n");
        return -1;
    }
}

and here’s how i load the excontrolbar
    m_wndLogBar.SetInitDesiredSizeVertical(CSize( 320, 240 ));
    m_wndLogBar.SetInitDesiredSizeHorizontal(CSize( 320, 240 ));

    if(    !    m_wndLogBar.Create(
            "Messages logs", // _T("Optional control bar caption"),
            this,
            IDR_LOGBAR
            )
        )
    {
        TRACE0("Failed to create m_wndTileBankBar\n");
        return -1;        // fail to create
    }
    
    if(!m_frmLogMsg.Create(IDD_MSGLOG,&m_wndLogBar))
    {
        TRACE0("Failed to create m_wndResizableBarDlg\n");
        return -1;        // fail to create
    }

Suhai Gyorgy Sep 1, 2006 - 2:02 AM

Problem probably lies in creation in RichEdit. You are using AFX_IDW_PANE_FIRST as control identifier, but this identifier is reserved for the first view of the MainFrame, if I remember right.
Actually if you want the richedit to occupy all of the controlbar, you don’t have to use a CExtResizableDialog to do that. You just need to create the richedit in MainFrame’s OnCreate, as child of the controlbar. ProfStudio has similar to that:

In MainFrm.h:

CExtControlBar m_wndCommandWindowBar;
CExtWFF < CEdit > m_wndCommandWindowChild;


In OnCreate:
	if(	!m_wndCommandWindowBar.Create(
				_T("Command Window"),
				this,
				ID_VIEW_BAR_COMMAND_WINDOW
				)
		|| !m_wndCommandWindowChild.Create(
				WS_CHILD|WS_VISIBLE|WS_HSCROLL|WS_VSCROLL
					|ES_MULTILINE|ES_LEFT|ES_NOHIDESEL|ES_WANTRETURN
					|ES_AUTOHSCROLL|ES_AUTOVSCROLL
				,
				CRect( 0,0,0,0 ),
				&m_wndCommandWindowBar,
				UINT(IDC_STATIC)
				)
		|| !( (new CProfStudioThinFrame)->
				CreateDynamicThinFrame(
					&m_wndCommandWindowChild
					)
			)
		)
	{
		TRACE0("Failed to create ID_VIEW_BAR_COMMAND_WINDOW\n");
		return -1;      // fail to create
	}

Suhai Gyorgy Sep 1, 2006 - 2:05 AM

Sorry, pushed the wrong button:)
I think you can use CRichEdit the same way. The CProfStudioThinFrame class in the code creates a thin frame around the RichEdit inside the controlbar. If you don’t need that, just skip that part.
I hope that helps.