How about this (fragments of my code): //first of all (as example, you need to do it in your way): CMainFrame *pMainFrame=(CMainFrame*)AfxGetMainWnd(); //then change your view (pMainFrame->m_wndSplitter).ReplaceView(RUNTIME_CLASS( CRightView ), CSize(100,100)); //or (pMainFrame->m_wndSplitter).ReplaceView(RUNTIME_CLASS( CColorRight ), CSize(100,100));
Hope, this will help you, bilas.:->
bilas
Posts
-
Switching between two different views in CSplitterWnd -
How to define a letter of CD-ROM?Thank you, Roger. I've just solved my problem in other way. But I'm sure, you had helped me. Aleksey.
-
What is the max length of tree branche?I mean the max length in CTreeView is about 270 any way. It's a pity!:( I need 340 letters!
-
What is the max length of tree branche?It's very important for me to save big strings in CTreeView object. I've set limit in my CTreeView object to 500, but it can display only first 250. How can I change this parameter? Thanks in advance, Aleksey.
-
How to create splashwindow on MFC?I think about this:
BOOL CRightHTMLView::PreCreateWindow(CREATESTRUCT& cs) { MSG message; int i=0; m_nTimer = SetTimer(1, 100, NULL); // Can't set timer here, 'cos window //is not created yet:confused: ASSERT(m_nTimer!=0); if(i==0) { dlg->DoModal(); // Here I call for dialog with image if(::PeekMessage(&message, NULL, 0, 0, PM_REMOVE)) { ::TranslateMessage(&message); ::DispatchMessage(&message); } i = 1; }
Thenvoid CRightHTMLView::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default Sleep(3000); dlg->DestroyWindow(); KillTimer(1); CHtmlView::OnTimer(nIDEvent); }
Did you mean the same? -
How to create splashwindow on MFC?But I can't use Timer in PreCreateWindof function. :)
-
How to create splashwindow on MFC?up. Before the main frame is created I want to display splashwindow for 3 seconds. how to do it?
-
Can I create split windows dynamically?Good time of day! :) Please, help me to solve my little problem I created split window with two views.
BOOL CMainFrame::CreateSplitters(int nRows, int nCols, int m_actRow, int m_actCol, CCreateContext* pContext) { m_bInitSplitter = FALSE; my_RightView = RUNTIME_CLASS( CRightHTMLView ); my_LeftView = RUNTIME_CLASS( CMyTree ); CRect cr; GetClientRect( &cr); /* Than I create two split windows using m_wndSplitter.Create( this, 1, 2, CSize(0,0), pContext ); */ .. //In next line I have "Debug Assertion Failed". if ( !m_wndSplitter.CreateView( 0, 0, my_LeftView, CSize(width/5, cr.Height()), pContext ) || !m_wndSplitter.CreateView( /*0, 1,*/m_actRow, m_actCol, my_RightView, CSize(4*width/5, cr.Height(), pContext )) { ... } //But when I create static split window, it works good. ... }
But I need two create split window dynamically, 'cos later I'll need to destroy it and create another two views (but with gorizontal locating) Please, help me. -
Show dialog window in PreCreateWindow(..) failed :(I want to show dialog window (with image) for 3 seconds befor my project will start. I use Timer with aim to destroy dialog window in 3 seconds
BOOL CRightHTMLView::PreCreateWindow(CREATESTRUCT& cs) { dlg = new CDialog(IDD_ABOUTBOX, this); // dlg is a member variable of CRightHTMLView MSG message; int i=0; m_nTimer = SetTimer(1, 100, NULL); // Here Debug Assertion Failed! ASSERT(m_nTimer!=0); if(i==0) { dlg->DoModal(); if(::PeekMessage(&message, NULL, 0, 0, PM_REMOVE)) { ::TranslateMessage(&message); ::DispatchMessage(&message); } i = 1; } return CHtmlView::PreCreateWindow(cs); } void CRightHTMLView::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default Sleep(3000); dlg->DestroyWindow(); KillTimer(1); CHtmlView::OnTimer(nIDEvent); }
What is wrong in my function(s)? If anybody knows how to display image in other way (not in dialog window), please share here with your ideas. I would appreciate your co-operation. Aleksey. -
How to switch from vertical to gorizontal split windows?I want to switch dynamically from vertical to gorizontal split windows. It's very easy (IMHO). But have little problem. When my program started, I have two vertical split windows:
//In this function I have pointer to CCreateContext structure BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/, CCreateContext* pContext) { CreateSplitters(m_nRows, m_nCols, m_actRow, m_actCol, pContext); return TRUE; } BOOL CMainFrame::CreateSplitters(int nRows, int nCols, int m_actRow, int m_actCol, CCreateContext* pContext) { m_bInitSplitter = FALSE; my_RightView = RUNTIME_CLASS( CRightHTMLView ); my_LeftView = RUNTIME_CLASS( CMyTree ); //here is standart procedure of creating //--------Create 2 splitter views------------- CRect cr; GetClientRect( &cr); //if ( !m_wndSplitter.CreateStatic( this, 1, 2 ) ) if ( !m_wndSplitter.CreateStatic( this, nRows, nCols ) ) { MessageBox( "Error setting up splitter frames!", "Init Error!", MB_OK | MB_ICONERROR ); return FALSE; } int width = cr.Width(); if ( !m_wndSplitter.CreateView( 0, 0, my_LeftView, CSize(width/5, cr.Height()), pContext ) || !m_wndSplitter.CreateView( /*0, 1,*/m_actRow, m_actCol, my_RightView, CSize(4*width/5, cr.Height()), pContext )) { MessageBox( "Error setting up splitter frames!", "Init Error!", MB_OK | MB_ICONERROR ); return FALSE; } m_bInitSplitter = TRUE; return TRUE; }
In in other functions I do not have pointer to CCreateContext structure, that is needed to create splitters. Have can I retrive this pointer in any place of my object? This is very easy but I couldn't do it. -
searching concrete text in *.txt fileAha, I just have found one http://www.codeproject.com/file/CFileFinderEx/FindFiles.zip Thaks, I'm tryiing now. If I face to problem, I'll post immidiatly. Thanks, ravi:-D!
-
searching concrete text in *.txt fileIs there any class that lets to find text in *.txt file? for example, I have txt file that contains: book.txt:
Something in the way she moves Attracts me like no other lover Something in the way she woos me I don't want to leave her now You know I believe her now Somewhere in her smile she knows That I don't need no other lover Something in her style that shows me Don't want to leave her now You know I believe her now You're asking me will my love grow I don't know, I don't know You stick around now it may show I don't know, I don't know Something in the way she knows And all I have to do is think of her Something in the things she shows me Don't want to leave her now You know I believe her now
And there are a lot of similar files. I want to search, for example for text "in her style that". As result I want to retrive filename. Thanks in advance.:) "Strawberry fields forever" -
How about this...I'v just tried. But have no success. I decided to search for text using direct reading from file. Maybe you know, is there any class to organize searching in *.txt file for concrete text? Thank you for answering:)
-
How about this...A lot of people know class CHtmlView. I had found pretty functions FIndText() and FindText2(), written by Marc Richarme (http://www.codeproject.com/miscctrl/CHtmlView\_Search/CHtmlView\_Search\_demo.zip), that allow to find text on loaded(!) web-page. Now I'm making project. One of main its functions is finding text on several(!) pages. I do not know any other way to do it excepting using function FindText2() ( or FindText() ). Actually, it is possible to find text in several web-pages, using, for example, FindText2() for every page separately. But this function can't be applied until web-document isn't loaded. So, I decided to organize cycle. Each page will be loaded in every other cycle. I mean something like this (in abstraction):
for (int i=0; iNavigate2( _urls[i], NULL, NULL ); //To load web-page with address _urls[i] that has type CString; .... //Now I call function OnSearch(), that calls function FindText2(); //then I remember url of every page, on witch the concrete text was found (that is all I need) ... }
My problem is concluded in follow: the FindText2() function in my code called every time before new web-page will be loaded completely. That's why FindText2() works with old page-url, finding text on it :(. Having poor English level, I repeat: FindText2() forestalls loading page. So, I would like to know have can I define when my page is loaded, and then I'll call for FindText2(). Thanks in advance, I tried to explaine my problem very exactly. -
FindText() and FindText2() functions in CHtmlView class for searching on different pages. Is it possible?Hello to all. I use functions FindText() and FindText2() for class CHtmlView to organize searching for text on current page. But I need to search on different pages (I have their URL's). Had anybody faced with this problem before? I'll be very appreciate for every post below. Aleksey. Sorry for my poor English
-
How to get pContext of current windowWhen I need to call my function
CreateSplitters(int nRows, int nCols, int m_actRow, int m_actCol, CCreateContext* pContext)
I need to give parameter CCreateContext* pContext. How can I do it? Thanks in advance, bilas. -
How to define size for CTreeView's branchesYeah, you are rigt. But I need to set cchTextMax every time, when branche is renamed. I'll try again. Anyway, thanks a lot, bilas.
-
How to set a color for windowHow can I set specific color for my window (toolbar)? Thanks a lot in advance, bilas.
-
How to define size for CTreeView's branchesI'v deefined my own font for CTreeView, but have one problem. Not all words displays in tree branches. I mean, when I enter text in tree branche "Some text", in CTreeView it displays as "Some t". So, I want to determine size in chars for tree branche to display all words completely. Thanks in advance, bilas.
-
Fonts for CTreeCtrl. What is not right now?You are right. I simply tried to create font every time. I'll do it another way, now I only want it to work.:^)