|
You could used a combination of 1) and
4) Use the List control in virtual mode. This makes use of the CListCtrl callback functions that request information about visible data only when needed.
I have used this technique in the past where a searching routine returns its result in a list control. A separate thread would do the searching, then post the result (or any other thread-safe method), back to the list control for populating. This is great, especially if you don't know the final number of items that will be shown in the control.
I Dream of Absolute Zero
|
|
|
|
|
I am high performance problem when working with CListCtrl with owner draw data and styles.
I cant change existing functionalites also using Virtual list control
Problem 1: Actully i am inserting 3000 records takes 2.11.This time only executing of insert statement.
Problem 2:
After inserted all the data if i scroll horizontal and vertical,grid lines is not refresing.if i use Invalidate i am getting flickering.
Please give me the solution/suggestion if any one faced like this problem.
Thanks.
PRABHUDURAI
|
|
|
|
|
prabhudurai wrote: I cant change existing functionalites also using Virtual list control
If you are prohibited from making changes, how can you be expected to solve the problem?
prabhudurai wrote: Problem 1: Actully i am inserting 3000 records
If you are using an owner-drawn control, there's no way to insert 3,000 items at a time. The control will only ask you about items that it is going to display (a few dozen at most).
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: If you are using an owner-drawn control, there's no way to insert 3,000 items at a time. The control will only ask you about items that it is going to display (a few dozen at most).
Owner-draw doesn't stop you from inserting items does it?
Seems to me I have done that.
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
Well, the LVM_SETITEMTEXT message cannot be used with the LVS_OWNERDATA style. Instead, you must respond to the LVN_GETDISPINFO notification and provide information needed to display the item.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
We may not be talking about the same thing. Here is what I tested with no handling of LVN_GETDISPINFO.
I have CMyListCtrl derived from CListCtrl and set the owner draw style and override DrawItem(). If you don't override DrawItem an Assert is thrown from CListCtrl::DrawItem() if Owner draw style is set.
Then I drop a CListCtrl onto a dialog and add a "control" member variable mapped to the ID of the List Control. Then I change the declaration of the member in the dialog class:
CMyListCtrl _list;
Then in the dialog OnInitDialog override I use InsertItem which I believe sends LVM_INSERTITEM message:
_list.InsertColumn(0, _T("Col One"));
_list.InsertColumn(1, _T("Col Two"));
_list.SetColumnWidth(0, 150);
_list.SetColumnWidth(1, 150);
CString sbuf;
for(int n=0; n<100; n++)
{
sbuf.Format(_T("Item %d"), n+1);
_list.InsertItem(n, sbuf);
sbuf.Format(_T("Item %d - 2"), n+1);
_list.SetItemText(n, 1, sbuf);
}
Notice there are two columns in the list but in my owner draw override I only draw the first one:
void CMyListCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
CDC* pDC = CDC::FromHandle( lpDrawItemStruct->hDC);
CString sbuf = GetItemText( lpDrawItemStruct->itemID, 0);
pDC->DrawText( sbuf, &lpDrawItemStruct->rcItem, DT_LEFT);
}
As expected the control displays only the first column of all 100 items. If I turn off the Owner Draw Style both columns draw as expected since the control is then drawing.
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
led mike wrote: We may not be talking about the same thing.
Apparently.
led mike wrote: _list.SetItemText(n, 1, sbuf);
I don't see how you could have done this as the assertion on line 494 of winctrl2.cpp would have fired. It asserts that SetItemText() cannot be used with the LVS_OWNERDATA style.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Ah now I get it.
prabhudurai wrote: when working with CListCtrl with owner draw data and styles.
Owner Draw and Owner Data are two different things, he posted both, I was talking about draw your were talking about data. Sorry for the confusion.
Oh I see from your first post you stated "owner-draw" as well not "owner data", that makes me feel a little better.
Last modified: Wednesday, July 12, 2006 9:34:40 AM --
|
|
|
|
|
led mike wrote: Owner Draw and Owner Data are two different things
I mistakingly used them interchangeably.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi all. could any one show me how i can get the html of a perticuler url and place that html inside a textbox/editbox for further manipulation. I have done such think in visual basic 6 but i do not know that can be done in visual c++ 6. I be happy if some one show me how i can achive that.Thanks
visual basic 6 method:
RichTextBox1.Text = Inet1.OpenURL(txtURL.Text, icString)
|
|
|
|
|
Do a search on MSDN for CHttpConnection. That will lead to several other classes that wrap the WinInet API for making HTTP requests.
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
method007 wrote: could any one show me how i can get the html of a perticuler url and place that html inside a textbox/editbox for further manipulation.
Have you considered URLDownloadToFile() ?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
man i am new to visual c++ .i be happy if u guys give me an example of how to use it. Just URLDownloadToFile() will not help me. You migh say msdn but that is not readable at all for starter.!! Furthermore, i do not want to download a url in file i just want to load its html code into a editbox for further process.
-- modified at 13:19 Tuesday 11th July, 2006
|
|
|
|
|
method007 wrote: Just URLDownloadToFile() will not help me.
Why not?
method007 wrote: You migh say msdn but that is not readable at all for starter.!!
Sure it is. I started using it some 15 years ago.
method007 wrote: Furthermore, i do not want to download a url in file i just want to load its html code into a editbox for further process.
This makes no sense. If you are wanting to edit the HTML, use URLDownloadToFile() . You can then plug the contents of the file into the edit control. Using the alternative IHTMLInterface would only complicate matters.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
my whole intention is to extract data from a html page so it would be easier to load the html instead of the file !! i have done this in visual basic 6 but i need to do it for a project that is visual c++ 6 and so far i just get unrleated answer and no example!!! i think this the nature of visual c++ programers unlicke visual basic programmers!!
|
|
|
|
|
method007 wrote: ...so far i just get unrleated answer and no example!!!
I've given you more than enough information to solve your problem. As a matter of fact, you've been given several solutions to the same problem. That's very gratuitous in my book.
This retrieves all of the <FONT> elements:
IDispatch pDisp2 = m_ctrlBrowser.GetDocument();
pDisp2->QueryInterface(IID_IHTMLDocument2, (void **) &ptrHTMLDocument);
BSTR pBURL = SysAllocStringByteLen(NULL, 1024);<br />
ptrHTMLDocument->get_URL(&pBURL);<br />
ptrHTMLDocument->get_all(&ptrHTMLElements);
ptrHTMLElements->get_length(&lElements);
VARIANT varName;<br />
varName.vt = VT_BYREF | VT_I1;<br />
varName.pcVal = "FONT";<br />
VARIANT varIndex;<br />
varIndex.vt = VT_I4;<br />
varIndex.lVal = 1;<br />
ptrHTMLElements->item(varName, varIndex, &pDisp3);
pDisp3->QueryInterface(IID_IHTMLElement, (void **) &ptrHTMLElement);
ptrHTMLElement->get_innerHTML(&pBURL);<br />
ptrHTMLDocument->Release();
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow thank u for u code. But i want the get the whole html of a specific url and place it in a textbox just like i showed u in visual basic 6. I do not want to retrive font elements!!!
|
|
|
|
|
method007 wrote: But i want the get the whole html of a specific url and place it in a textbox...
Then do as I've already suggested. Use URLDownloadToFile() to download the HTML to some temporary file. You can then plug the contents of the file into the edit control. It's a very simple procedure.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
In visual basic it is online code and but i have no idea how to do it in visual c++ 6. could u show me how ?Thanks
|
|
|
|
|
method007 wrote: ...i have no idea how to do it in visual c++ 6. could u show me how ?
See here. Once you have a file, you can then open the file using any number of methods (e.g., CFile , FILE* , CreateFile() ).
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
HTML from where ? if it's from the web, David gave you a good starting point.
else, if it's simple html text, just do a SetWindowText of the HTML code to the CEditBox; but it will not be formatted.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Maximilien . i want first get html code of a specified url then use that to extract specific data from it. i want to load that html in textbox first then maniuplate it!!
|
|
|
|
|
Hi,
I am using Visual C++ 6.0 MFC and I created a dialog based app that has several different dialog classes. I decided that I wanted to put each of my dialogs onto a tab control page. This I can do, but now when I click on my dialog command buttons nothing happens. I went into the dialog properties and changed them from popup to child and also the visible style check box and the four different combinations of them. I used the class wizard to define functions for OnNotify and OnChildNotify but these only fire when I click on the tab itself not the command buttons in the tab page. There is no WM_NOTIFY available through the class wizard. I have found information on how to create the tab control and how to get the dialog boxes to appear in the contorl but I can't find any good information about recognizing the event when a button on the tab page (dialog) is clicked. If anyone that can point me in the right direction it would be greatly appreaciated.
Buck
Buck
|
|
|
|
|
|
Hello
I'm currently interested in putting a 3D control (OGRE -a 3D engine-, namely) in a dialog box with other elements. So, you would insert that control in a dialog box, together with other things (buttons or even CHtmlView-derived classes) and it actually does work.
I have a problem, thought: I would like the control to be aware of the keyboard focus. Let me explain: in an edit box, for example, when the user clicks the edit box is selected and all keyboard actions go to the edit box. The same with for example CHtmlView.
My class currently inherits from CStatic, and I'm having real trouble making it capture the keyboard (interestingly, capturing the mouse has been easy!).
How could I solve this problem, so make my class act like, say, the CEdit class?
Thank you
S. Ali Tokmen
http://ali.tokmen.com
|
|
|
|