handle of view from doc

hi
can anyone tell me how to get the handle of View from doc in the foloowing way?
i have a var in my Doc
CMyView* pView;

and i want to use this var in doc to call

pView->InvalidateRect();

when i do above i get error pView hWnd = ?.
i need to do it the above way..
can anyone tell me how to assign hWnd correctly to the pView var in Doc?
tks
[396 byte] By [Joseph_R_Thomas] at [2007-11-18 9:59:56]
«« General
»» plugin
# 1 Re: handle of view from doc
since i have a graphical interface and i dont want flickering..i dont want to use
UpdateAllViews()
tks
Joseph_R_Thomas at 2007-11-11 2:36:31 >
# 2 Re: handle of view from doc
i tried this

POSITION pos = GetFirstViewPosition();
GetNextView(pos)->InvalidateRect(pStone->m_cycleRect);

is it ok?
anything wrong with this?
any disadvantage of doin this??
is there a better way??
Joseph_R_Thomas at 2007-11-11 2:37:31 >
# 3 Re: handle of view from doc
UpdateAllViews is the proper way to do this. It has a parameter which can be used to tell the view what needs to be updated so you can avoid flickering.
souldog at 2007-11-11 2:38:30 >
# 4 Re: handle of view from doc
code:------------------------
POSITION pos = GetFirstViewPosition();
GetNextView(pos)->InvalidateRect(pStone->m_cycleRect);
------------------------

can anyone tell me how am i supposed to do the above thing using UpdateAllViews and passing param to it??
tks
Joseph_R_Thomas at 2007-11-11 2:39:30 >
# 5 Re: handle of view from doc
Would that someone be me?

void UpdateAllViews( CView* pSender, LPARAM lHint = 0L, CObject* pHint = NULL );

Calling UpdateAllViews will cause OnUpdate to be called in all views.

virtual void OnUpdate( CView* pSender, LPARAM lHint, CObject* pHint );

You could pass an integer as the lParam and then use a switch statement in OnUpdate to invalidate the appropriate part of the view.

assuming pStone is derived form CObject you could pass this pointer in with the pHint parameter.

There are lots of ways, it is very flexible.;
souldog at 2007-11-11 2:40:29 >
# 6 Re: handle of view from doc
Originally posted by souldog
virtual void OnUpdate( CView* pSender, LPARAM lHint, CObject* pHint );

You could pass an integer as the lParam and then use a switch statement in OnUpdate to invalidate the appropriate part of the view.

assuming pStone is derived form CObject you could pass this pointer in with the pHint parameter.

can u also pls tell me if i have one main view..how do i do the wat you quoted above?
basically this is wat i am doin currently

CGoStone* pStone = m_pGoBoard->AddStone(boolFlg, point);
POSITION pos = GetFirstViewPosition();
GetNextView(pos)->InvalidateRect(pStone->m_cycleRect);

can u tell me how do i do the above using UpdateAllViews?
i dont understand wat parameters and how am ai supposed to apss the parameters to the UpdataAllViews()
tks a lot
Joseph_R_Thomas at 2007-11-11 2:41:36 >
# 7 Re: handle of view from doc
Take a look at this FAQ ( http://www.dev-archive.com/FAQS/FAQ-A01.html)...
Andreas Masur at 2007-11-11 2:42:37 >
# 8 Re: handle of view from doc
i know of this FAQ and if you read my first comment..you will see taht i used it!!!..
but i was told by a memmber below notto use and use UpdataAllViews instaed...
so i wanan use it..
problem is how do i pass parameter to it so that my whole screen does not flicker but i can all the fn i want..
CGoStone* pStone = m_pGoBoard->AddStone(boolFlg, point);
POSITION pos = GetFirstViewPosition();
GetNextView(pos)->InvalidateRect(pStone->m_cycleRect);

thru
UpdateAllViews
tks
Joseph_R_Thomas at 2007-11-11 2:43:34 >
# 9 Re: handle of view from doc
Just a general observation, I'd be leery of invalidating a view from a document. Documents should store/manage/update the data while the view should handle the display. I'd take the tact of using UpdateAllViews and in each view's OnUpdate determine what to Invalidate... i.e. the it's the view's responsability to determine what has changed and redraw it.

The reason behind this is to separate or clearly deliniate the responsiblity for the Doc and View. Doc's should be fairly (if not completely) independant the display implementation details. This is useful when you add a view to show statistics or represent the data in a different format, the doc doesn't need to be modified, it continues to UpdateAllViews and the individual views handle the change appropiately.

This may mean that you'll need to work on what you do inside of the View's OnUpdate, but that's highly dependant on the structure of your program...
bytz at 2007-11-11 2:44:35 >