15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


How to intialize data fields in a class derived from CFo

Deepak Saxena -- Deepak_Saxena@ccm.ch.intel.com
Friday, July 26, 1996

[Mini-digest: 3 responses]

SetActiveView() sets the focus to the view you send it.  So maybe 
overding the WM_SETFOCUS handler and checking to see if the view has 
already been intialized or not should work.

Deepak


______________________________ Reply Separator _________________________________
Subject: How to intialize data fields in a class derived from CFormVi
Author:  owner-mfc-l@netcom.com at SMTPGATE
Date:    7/26/96 1:44 PM


Environment:MSVC 4.1,Win95

I have created a SDI application.It may have different views during
program execution but only one of them exists at any point of time.
I am using CFrameWnd::CreateView(...) to create the views.
//Code snippet
CView* prevView=GetActiveView();
prevView->DestroyWindow();
CWnd* curView=NULL;

CCreateContext localCCreateContext;
localCCreateContext.m_pCurrentFrame=this;

localCCreateContext.m_pNewViewClass=RUNTIME_CLASS(CQueryView);
//
if (!(curView=CreateView(&localCCreateContext)))
{
    TRACE0("Failed to create new view\n");
    return ;
}

// activate the input view
   RecalcLayout();

   SetActiveView((CView*)curView);

All the views are subclasses of CView or CFormView.But the
views which are derived from CFormView contains combo,listbox and
listcontrols which need to be initialized by filling them with
required items.I cannot initialize them in OnInitialUpdate as this
is only a one-time initialization method that gets called only
once.Where can I do the initialization?

Thanks in advance

-------------------------------------------------------------------
Anujit Sarkar(e-mail address:anujit@vedika.ernet.in)
-------------------------------------------------------------------
Resi: 102 Southern Avenue        Office:Vedika International
      'Sarobar' 7  N.E.                 21 Lansdowne Court
      Calcutta -700029                  5B Sarat Bose Road
      INDIA                             Calcutta-700020 INDIA
      Phone No.+91-33-4661473           Phone No.+91-33-2473810
-------------------------------------------------------------------

-----From: LeRoy Baxter 

How about OnUpdate() ?  this function gets called from OnInitalUpdate(), and
whenever the Document broadcasts an UpdateAllView()  ((and perhaps other
times as well))

-----From: Anujit Sarkar 

> Why can't you initialize them more than once???
> 
> I have a working application that destroys and creates views on
> the fly
> where I call 'OnInitialUpdate()'.  The code listed below seems to
> be working
> for me < grin >.
> 
>      ((CFormView*)m_wndSplitter.GetPane( row, column
> ))->OnInitialUpdate();
> 
> Roy Browning

Hi Roy,

I wanted to know if I can do the initialization without explicitly 
calling OnInitialUpdate().

Bye

Anujit

-------------------------------------------------------------------
Anujit Sarkar(e-mail address:anujit@vedika.ernet.in)
-------------------------------------------------------------------
Resi: 102 Southern Avenue        Office:Vedika International
      'Sarobar' 7  N.E.                 21 Lansdowne Court
      Calcutta -700029                  5B Sarat Bose Road
      INDIA                             Calcutta-700020 INDIA
      Phone No.+91-33-4661473           Phone No.+91-33-2473810
-------------------------------------------------------------------



Graham -- Cunningham@tgd.swissptt.ch
Wednesday, July 31, 1996

why dont you call the CView::OnInitialUpdate directly ie as below
curView->OnInitialUpdate();
>SetActiveView((CView*)curView);

>----------
>From: 	Deepak Saxena[SMTP:Deepak_Saxena@ccm.ch.intel.com]
>Sent: 	Freitag, 26. Juli 1996 22:51
>To: 	mfc-l@netcom.com
>Subject: 	Re: How to intialize data fields in a class derived from CFo
>
>[Mini-digest: 3 responses]
>
>SetActiveView() sets the focus to the view you send it.  So maybe 
>overding the WM_SETFOCUS handler and checking to see if the view has 
>already been intialized or not should work.
>
>Deepak
>
>
>______________________________ Reply Separator
>_________________________________
>Subject: How to intialize data fields in a class derived from CFormVi
>Author:  owner-mfc-l@netcom.com at SMTPGATE
>Date:    7/26/96 1:44 PM
>
>
>Environment:MSVC 4.1,Win95
>
>I have created a SDI application.It may have different views during
>program execution but only one of them exists at any point of time.
>I am using CFrameWnd::CreateView(...) to create the views.
>//Code snippet
>CView* prevView=GetActiveView();
>prevView->DestroyWindow();
>CWnd* curView=NULL;
>
>CCreateContext localCCreateContext;
>localCCreateContext.m_pCurrentFrame=this;
>
>localCCreateContext.m_pNewViewClass=RUNTIME_CLASS(CQueryView);
>//
>if (!(curView=CreateView(&localCCreateContext)))
>{
>    TRACE0("Failed to create new view\n");
>    return ;
>}
>
>// activate the input view
>   RecalcLayout();
>
>   SetActiveView((CView*)curView);
>
>All the views are subclasses of CView or CFormView.But the
>views which are derived from CFormView contains combo,listbox and
>listcontrols which need to be initialized by filling them with
>required items.I cannot initialize them in OnInitialUpdate as this
>is only a one-time initialization method that gets called only
>once.Where can I do the initialization?
>
>Thanks in advance
>
>-------------------------------------------------------------------
>Anujit Sarkar(e-mail address:anujit@vedika.ernet.in)
>-------------------------------------------------------------------
>Resi: 102 Southern Avenue        Office:Vedika International
>      'Sarobar' 7  N.E.                 21 Lansdowne Court
>      Calcutta -700029                  5B Sarat Bose Road
>      INDIA                             Calcutta-700020 INDIA
>      Phone No.+91-33-4661473           Phone No.+91-33-2473810
>-------------------------------------------------------------------
>
>-----From: LeRoy Baxter 
>
>How about OnUpdate() ?  this function gets called from
>OnInitalUpdate(), and
>whenever the Document broadcasts an UpdateAllView()  ((and perhaps
>other
>times as well))
>
>-----From: Anujit Sarkar 
>
>> Why can't you initialize them more than once???
>> 
>> I have a working application that destroys and creates views on
>> the fly
>> where I call 'OnInitialUpdate()'.  The code listed below seems to
>> be working
>> for me < grin >.
>> 
>>      ((CFormView*)m_wndSplitter.GetPane( row, column
>> ))->OnInitialUpdate();
>> 
>> Roy Browning
>
>Hi Roy,
>
>I wanted to know if I can do the initialization without explicitly 
>calling OnInitialUpdate().
>
>Bye
>
>Anujit
>
>-------------------------------------------------------------------
>Anujit Sarkar(e-mail address:anujit@vedika.ernet.in)
>-------------------------------------------------------------------
>Resi: 102 Southern Avenue        Office:Vedika International
>      'Sarobar' 7  N.E.                 21 Lansdowne Court
>      Calcutta -700029                  5B Sarat Bose Road
>      INDIA                             Calcutta-700020 INDIA
>      Phone No.+91-33-4661473           Phone No.+91-33-2473810
>-------------------------------------------------------------------
>



Pete Chestna -- pchestna@highground.com
Monday, August 05, 1996

You should create special update codes for the lHint item of an OnUpdate
call.  I used these to fake a DoDataExchange for dialog controls.  If you
have subclassed the controls in the view, you could even call
UpdateData(fSaveAndValidate) and override DoDataExchange for each control to
do the right thing based upon the update hint.

Pete

At 08:21 AM 7/31/96 +0200, you wrote:
>why dont you call the CView::OnInitialUpdate directly ie as below
>curView->OnInitialUpdate();
>>SetActiveView((CView*)curView);
>
>>----------
>>From: 	Deepak Saxena[SMTP:Deepak_Saxena@ccm.ch.intel.com]
>>Sent: 	Freitag, 26. Juli 1996 22:51
>>To: 	mfc-l@netcom.com
>>Subject: 	Re: How to intialize data fields in a class derived from CFo
>>
>>[Mini-digest: 3 responses]
>>
>>SetActiveView() sets the focus to the view you send it.  So maybe 
>>overding the WM_SETFOCUS handler and checking to see if the view has 
>>already been intialized or not should work.
>>
>>Deepak
>>
>>
>>______________________________ Reply Separator
>>_________________________________
>>Subject: How to intialize data fields in a class derived from CFormVi
>>Author:  owner-mfc-l@netcom.com at SMTPGATE
>>Date:    7/26/96 1:44 PM
>>
>>
>>Environment:MSVC 4.1,Win95
>>
>>I have created a SDI application.It may have different views during
>>program execution but only one of them exists at any point of time.
>>I am using CFrameWnd::CreateView(...) to create the views.
>>//Code snippet
>>CView* prevView=GetActiveView();
>>prevView->DestroyWindow();
>>CWnd* curView=NULL;
>>
>>CCreateContext localCCreateContext;
>>localCCreateContext.m_pCurrentFrame=this;
>>
>>localCCreateContext.m_pNewViewClass=RUNTIME_CLASS(CQueryView);
>>//
>>if (!(curView=CreateView(&localCCreateContext)))
>>{
>>    TRACE0("Failed to create new view\n");
>>    return ;
>>}
>>
>>// activate the input view
>>   RecalcLayout();
>>
>>   SetActiveView((CView*)curView);
>>
>>All the views are subclasses of CView or CFormView.But the
>>views which are derived from CFormView contains combo,listbox and
>>listcontrols which need to be initialized by filling them with
>>required items.I cannot initialize them in OnInitialUpdate as this
>>is only a one-time initialization method that gets called only
>>once.Where can I do the initialization?
>>
>>Thanks in advance
>>
>>-------------------------------------------------------------------
>>Anujit Sarkar(e-mail address:anujit@vedika.ernet.in)
>>-------------------------------------------------------------------
>>Resi: 102 Southern Avenue        Office:Vedika International
>>      'Sarobar' 7  N.E.                 21 Lansdowne Court
>>      Calcutta -700029                  5B Sarat Bose Road
>>      INDIA                             Calcutta-700020 INDIA
>>      Phone No.+91-33-4661473           Phone No.+91-33-2473810
>>-------------------------------------------------------------------
>>
>>-----From: LeRoy Baxter 
>>
>>How about OnUpdate() ?  this function gets called from
>>OnInitalUpdate(), and
>>whenever the Document broadcasts an UpdateAllView()  ((and perhaps
>>other
>>times as well))
>>
>>-----From: Anujit Sarkar 
>>
>>> Why can't you initialize them more than once???
>>> 
>>> I have a working application that destroys and creates views on
>>> the fly
>>> where I call 'OnInitialUpdate()'.  The code listed below seems to
>>> be working
>>> for me < grin >.
>>> 
>>>      ((CFormView*)m_wndSplitter.GetPane( row, column
>>> ))->OnInitialUpdate();
>>> 
>>> Roy Browning
>>
>>Hi Roy,
>>
>>I wanted to know if I can do the initialization without explicitly 
>>calling OnInitialUpdate().
>>
>>Bye
>>
>>Anujit
>>
>>-------------------------------------------------------------------
>>Anujit Sarkar(e-mail address:anujit@vedika.ernet.in)
>>-------------------------------------------------------------------
>>Resi: 102 Southern Avenue        Office:Vedika International
>>      'Sarobar' 7  N.E.                 21 Lansdowne Court
>>      Calcutta -700029                  5B Sarat Bose Road
>>      INDIA                             Calcutta-700020 INDIA
>>      Phone No.+91-33-4661473           Phone No.+91-33-2473810
>>-------------------------------------------------------------------
>>
>
---
"To you -- is it movement or is it action?       Peter J. Chestna
 It is contact or just reaction?                 HighGround Systems
 And you -- revolution or just resistance?       PChestna@highground.com
 Is it living, or just existence?" - RUSH        (508) 263-5588 x.125





| Вернуться в корень Архива |