|
do you mean that:
SetRedraw(false);
....
SetRedraw(true);
myList.RedrawWindow();
I applied it, it looks better but the actual time is the same with previous.
And I'll try virtual list control now, thks,
|
|
|
|
|
tataxin wrote: do you mean that:
Hope you are adding this above and after the "for" loop. Is it necessary to call RedrawWindow ?
tataxin wrote: I applied it, it looks better but the actual time is the same with previous.
And I'll try virtual list control now, thks, [Smile]
It's better to use virtual list if volume of data is high!
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
yes, for loops are inside, like this
SetRedraw(false);
for()
{
......
for()
{
......
}
}
SetRedraw(true);
myList.RedrawWindow();
it takes same time with the previous, in my project.
And, without RedrawWindow(), nothing is showed, myList is empty.
Ahh, the idea of virtual list is very nice. I'm reading now,
|
|
|
|
|
tataxin wrote: // get color, depends on the real data
COLORREF aColor = GetRowColor(txt);
crRows.InsertAt(0, aColor)
containers like CArray, vector are not suitable for insertion. Because those containers keep the data in contagious memory block and if you want to insert one item to middle, they've do a lot of memory moving to keep the items contagious.
Go for other insertion friendly containers such as std::list . Check there about how to use it - http://www.cplusplus.com/reference/stl/list/[^]
tataxin wrote: // get color, depends on the real data
COLORREF aColor = GetRowColor(txt);
crRows.InsertAt(0, aColor)
If you've lot of items to be added to your listctrl, better lock the control by LockWindowUpdate() then after insertion of all items, unlock by UnlockWindowUpdate() . It will avoid the flicker. Check this - http://weseetips.com/2008/04/19/how-to-update-bulk-amount-of-data-to-gui-controls-without-flicker/[^]
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
ah, thank you Jijo, I will check it now
|
|
|
|
|
hi all,
I found a solution, just use the custom draw, do not use a SetRowColor() method. So I just insert new row at top, like this
CArray crRows;
CArray newData;
int nNew = newData.GetCount();
for (int i=0; i<nnew;>
CString txt = newData.GetAt(i);
myList.InsertItem(0, txt);
COLORREF aColor = GetRowColor(txt);
crRows.InsertAt(0, aColor)
}
and then, in custom draw of the list control, I implement like this:
void CExample1Dlg::OnNMCustomdrawList2(NMHDR *pNMHDR, LRESULT *pResult)
{
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<nmlvcustomdraw*>( pNMHDR );
int nItem = static_cast<int> (pLVCD->nmcd.dwItemSpec);
pLVCD->clrTextBk = RGB(0, 0, 0);
*pResult = CDRF_DODEFAULT;
if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
{
*pResult = CDRF_NOTIFYITEMDRAW;
}
else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
{
COLORREF aColor = crText.GetAt(nItem);
pLVCD->clrText = aColor;
*pResult = CDRF_DODEFAULT;
}
}
</int>
that's all, and it doesn't take any time to change the color (time is almost 0)
Thank you everyone
|
|
|
|
|
Hi,
I want to create a modal dialog box instead of a messagebox in a worker thread.But when I closed the dialog box the program is gone (shutting down). What can cause to this problem? Is there a way to create a modal dialog box in a thread?
I think I shoud say that I am writing the program for Windows CE, but I think that the problem may be a general problem.
Thanks
|
|
|
|
|
Can you Paste your code ??
Regards,
Sandip.
|
|
|
|
|
Don't create UI in your worker thread, send a message to your main UI thread and create a dialog there.
use synchronisation event to wait for the dialog in your thread.
This signature was proudly tested on animals.
|
|
|
|
|
My code is like that;
UINT ComThreadEvent1(LPVOID lParam)
{
CNotepad *dlg = (CNotepad *)lParam;
while(HD != NULL)
{
::Sleep(500);
int index = dlg->events.Find(_T("\r\n"),0);
if(index == 0 )
{
dlg->thread2->ResumeThread();
dlg->GetEvent(dlg->events.Left(index));
}
}
return 0;
}
void CNotepad::GetEvent(CString event)
{
CString str;
if(event.Mid(9,2) == "C0")
{
str = "Hello";
CMessageBox mBox;
mBox.DoModal();
}
}
Here GetEvent() method is creating Modal Dialog box.How can I send a message to my main UI thread and create a dialog there?
Thanks
|
|
|
|
|
Hello. I'm trying to find something about the WebBrowser control, but have only managed to get information for MFC or C#, which doesn't help much as I'm writing a native C++ application. If you know any resources for Web Browser controls on pure WinAPI and native C++ environment, please let me know of them. Thanks.
|
|
|
|
|
|
Thanks! That might just be what I'm looking for.
|
|
|
|
|
Hi All,
I have to create project using VC++, where the resources will be in separate DLL and that resource DLL should be used at run time according to the language selected. Could some one help me guiding in the same?
Thanks,
Anand.
|
|
|
|
|
See here[^]
and here too [^]
Regards,
Sandip.
|
|
|
|
|
Nice links, thank you.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
You are welcome
Regards,
Sandip.
|
|
|
|
|
|
Thanks Sandeep,
I got exactly what I wanted
Thanks,
Anand.
|
|
|
|
|
Hi friends
Whats the difference between Debugging mode and Release mode?
Regards
Nisha.S
|
|
|
|
|
You haven't Googled for yet, have you [^]?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
why you reply message selecting question button,you may select reply or General radio button!!!!
buntyrolln
|
|
|
|
|
buntyrolln wrote: why you reply message selecting question button,you may select reply or General radio button!!!!
Possibly because I posted a question.
You aren't aware of, are you?
BTW you forgot the final question mark in your one.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
ya but you are asking question to the person who is asking a question,so your question is not the main question. Because of that some confusion arises.
buntyrolln
|
|
|
|
|
Don't be confused. Be happy.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|