|
CrocodileBuck wrote: I read that the simpliest way is to call UpdateAllViews() from the doc and pass a CRect to the view's OnUpdate().
The rect which is passed to the view's OnUpdate() ist the part which is updated.
But it wont work , I tried it for some hours now
The code you posted is not trying to use a CRect so how are we supposed to know what you are trying that is not working?
led mike
|
|
|
|
|
Thx for yor quick replies,
here the code which tries to pass a pointer to CRect:
Doc.cpp:
CString CMyDoc::LoadFile(CString cstrSearchString, CString *ptrArrFileNames, CString cstrFileExtension, int iZaehler)
{
m_iZaehler = iZaehler;
ptrMlf->loadmyfile (cstrSearchString + m_ptrArrFileNames[iZaehler],cstrFileExtension);
m_cstrAusgabe = ptrMlf->lf_cstrAusgabe;
CRect *MyRect;
MyRect(100, 100, 100, 100);
CObject* pHint = NULL;
pHint = reinterpret_cast<cobject*>(MyRect);
UpdateAllViews(NULL, 1, pHint);
return m_cstrAusgabe;
}
Many many thanx and best regards
Croc
|
|
|
|
|
That code compiles?
Maybe try something simpler:
CRect MyRect(100, 100, 100, 100);
CObject* pHint = (CObject*)&MyRect;
UpdateAllViews(NULL, 1, pHint);
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanx,
it will work, i could now pass the CRect!
Simple is Simply the best way
But do you know what i have to do in the OnUpdate of the viw.cpp ?
The view will not automatically update only the rect area ?
I men when i print text in my view and then load new text my version of UpdateAllViews should only update the rect ???
But how?
Sorry for my stupid question but i m really confused !
Many thanx
Croc
|
|
|
|
|
A simple call to InvalidateRect() in your OnUpdate() overrides should do it.
void CMyView::OnUpdate(CView* pSender, LPARAM , CObject* pHint)
{
InvalidateRect((CRect*)pHint, TRUE);
}
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mr. Salsbery,
i tried
InvalidateRect((LPCRECT)pHint, TRUE);
but it won't work
Thanx for all your help
Croc
|
|
|
|
|
What does "won't work" mean?
If you're using a rect of (100,100,100,100) then nothing will
happen, since the rect has no dimensions (width and height are 0).
Try a valid rect!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
yes thats right but i tried it with
CRect MyRect(0,0, 200, 150);
CObject* pHint = (CObject*)&MyRect;
and this fails too!
Manx thanx and best regards
Croc
|
|
|
|
|
What does "fails" mean?
Doesn't compile? Crashes at runtime? Nothing happens?
It marks the area for updating. The next WM_PAINT message will
update that area. If the same exact data is drawn as on the last WM_PAINT,
you're not going to see a difference.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I Mean nothin happens!
Ahhh the InvalidateRect() hasn't to do something with the text printed in the RTFCtrl on the View ???!!!
What can i do that i can see a little difference ?????
Many many thanx for your help and best regards
Croc
|
|
|
|
|
CrocodileBuck wrote: What can i do that i can see a little difference ?
You need to change something between calls to UpdateAllViews() if
you want to see something different in the view. What are your views
drawing? Something from the document? If so, change the document.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I will only print Text (SetWindowText) in the View !!!????
Many many thanks and best regards
Croc
|
|
|
|
|
Only you know what's going on in your views.
The text data must be coming from somewhere...
Change it and update the views!
And make sure changing it doesn't already cause an update implicitly,
or you still won't see anything.
If the view is a window not in your control (where you don't do the painting,
like an edit control), then you may not have control over updating regions of
the window.
If you are doing the painting in your view, look at the invalid rect in the WM_PAINT
handler - you should see that your update rect is there. What you do with that info in
your painting code is up to you.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Ok. Thanx, iwill try it !
Tomorrow i will mail my success or ... ;(
Many many thanx and best regards
Croc
|
|
|
|
|
You are in deep deep sh*t at this point dude. Maybe you should just treat the buck to a Filet-O-Fish and call it a day.
I'm outta here, have a great weekend!
led mike
|
|
|
|
|
Cheers!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
The Server stalled posting this one, (and crashed my Laptop) Tought it was Lost.
Good for You, Enjoy
Bram van Kampen
modified on Saturday, July 12, 2008 9:02 PM
|
|
|
|
|
led mike wrote: I'm outta here, have a great weekend!
Just Enjoy, You Deserve.
Wish I was there thoug,
Regards
Bram van Kampen
|
|
|
|
|
What class is your view derived from?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
CrocodileBuck wrote: fom CView !
And you're using SetWindowText() ? I've not ever tried that, but it just seems odd.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Sry, i was too fast, but your version won't work Too !
Thax for all your help & best regards
Croc
|
|
|
|
|
I inserted a shockwaveflash activex control in my project, and it works.
How to find the file (eg. .ocx)? The "Insert ActiveX Control" dialog shows no path info.
system
|
|
|
|
|
Working with EVc++4 on ARMV4I device.
I have an CArray :
CArray<CStockEntry, CStockEntry> stockArr;
void SetCStockEntryArr(CArray<CStockEntry, CStockEntry>& arr);
CArray<CStockEntry, CStockEntry>& GetStockEntryArr();
in my .cpp:
void DeptStock::SetCStockEntryArr(CArray<CStockEntry, CStockEntry>& arr) {
for (int i=0; i <= arr.GetUpperBound(); i++) {
CStockEntry se = arr.GetAt(i);
this->stockArr.Add(se);
}
CString s1 = _T("Size of copied Array & Org:");
s1.Format(_T("%s %d %d"), s1, stockArr.GetSize(), arr.GetSize());
AfxMessageBox(s1);
s1.Empty();
return;
}
CArray<CStockEntry, CStockEntry>& DeptStock::GetStockEntryArr() {
CString s1 = _T("Size of Returning Array:");
s1.Format(_T("%s %d"), s1, stockArr.GetSize());
AfxMessageBox(s1);
s1.Empty();
return this->stockArr;
}
In between Set & Get I don't perform any operations on the stockArr.
Why is while set, it is stored properly, but while retriing I get an empty array.
Any help is appreciated.
Thanks
Terry
|
|
|
|
|
I tested your code as follows:
struct CStockEntry
{
int entry;
CStockEntry(int i = 0) {entry = i;}
};
class DeptStock
{
public:
CArray<CStockEntry, CStockEntry> stockArr;
void SetCStockEntryArr(CArray<CStockEntry, CStockEntry>& arr)
{
for (int i=0; i <= arr.GetUpperBound(); i++)
{
CStockEntry se = arr.GetAt(i);
this->stockArr.Add(se);
}
CString s1 = _T("Size of copied Array & Org:");
s1.Format(_T("%s %d %d"), s1, stockArr.GetSize(), arr.GetSize());
AfxMessageBox(s1);
s1.Empty();
return;
}
CArray<CStockEntry, CStockEntry>& GetStockEntryArr()
{
CString s1 = _T("Size of Returning Array:");
s1.Format(_T("%s %d"), s1, stockArr.GetSize());
AfxMessageBox(s1);
s1.Empty();
return this->stockArr;
}
};
...
CArray<CStockEntry, CStockEntry> stockArr;
stockArr.Add(CStockEntry(0));
stockArr.Add(CStockEntry(1));
stockArr.Add(CStockEntry(2));
stockArr.Add(CStockEntry(3));
stockArr.Add(CStockEntry(4));
DeptStock test;
test.SetCStockEntryArr(stockArr);
CArray<CStockEntry, CStockEntry> &stockArrRef = test.GetStockEntryArr();
It works fine.
What aren't you showing?
FWIW, calling Empty() on those local CStrings is unnecessary.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|