CListCtrl update model: invalidate/update vs immediate

Hi,

I was wondering, why does this control (or controls in general) update 
itself immediately instead of in the update/'onpaint' handler?
All kinds of 'stupid' setredraw magic appears to be needed sometimes due 
to this.
1
OlafvdSpek (88)
3/22/2005 8:35:22 PM
vc.mfc 33608 articles. 0 followers. Follow

8 Replies
1838 Views

Similar Articles

[PageSpeed] 4

The update is happening in the WM_PAINT handler.  When you add a new item,
or change an item in a listctrl it will send a WM_PAINT message to itself.

AliR.

"Olaf van der Spek" <OlafvdSpek@GMail.Com> wrote in message
news:%23rV%23r6xLFHA.3928@TK2MSFTNGP09.phx.gbl...
> Hi,
>
> I was wondering, why does this control (or controls in general) update
> itself immediately instead of in the update/'onpaint' handler?
> All kinds of 'stupid' setredraw magic appears to be needed sometimes due
> to this.


0
AliR1 (391)
3/22/2005 8:46:23 PM
AliR wrote:
> The update is happening in the WM_PAINT handler.  When you add a new item,
> or change an item in a listctrl it will send a WM_PAINT message to itself.

But that's not how normal views work, is it?

> AliR.
> 
> "Olaf van der Spek" <OlafvdSpek@GMail.Com> wrote in message
> news:%23rV%23r6xLFHA.3928@TK2MSFTNGP09.phx.gbl...
> 
>>Hi,
>>
>>I was wondering, why does this control (or controls in general) update
>>itself immediately instead of in the update/'onpaint' handler?
>>All kinds of 'stupid' setredraw magic appears to be needed sometimes due
>>to this.
> 
> 
> 
0
OlafvdSpek (88)
3/23/2005 9:35:07 AM
How are you relating a View and a ListCtrl?
As far as CListCtrl, CListBox, CComboBox, CTreeCtrl are concerned, everytime
you modify the content of the control it will redraw itself. And for other
controls everytime you do things like SetWindowText they will redraw
themselfs.
Unless you use SetRedraw(..)

AliR.

"Olaf van der Spek" <OlafvdSpek@GMail.Com> wrote in message
news:uA5GZu4LFHA.3928@TK2MSFTNGP09.phx.gbl...
> AliR wrote:
> > The update is happening in the WM_PAINT handler.  When you add a new
item,
> > or change an item in a listctrl it will send a WM_PAINT message to
itself.
>
> But that's not how normal views work, is it?
>
> > AliR.
> >
> > "Olaf van der Spek" <OlafvdSpek@GMail.Com> wrote in message
> > news:%23rV%23r6xLFHA.3928@TK2MSFTNGP09.phx.gbl...
> >
> >>Hi,
> >>
> >>I was wondering, why does this control (or controls in general) update
> >>itself immediately instead of in the update/'onpaint' handler?
> >>All kinds of 'stupid' setredraw magic appears to be needed sometimes due
> >>to this.
> >
> >
> >


0
AliR1 (391)
3/23/2005 5:17:58 PM
AliR wrote:
> How are you relating a View and a ListCtrl?

I'm referring to the update semantics of a normal view.
You could update it 100 times in a row, but it'd only redraw itself once.

> As far as CListCtrl, CListBox, CComboBox, CTreeCtrl are concerned, everytime
> you modify the content of the control it will redraw itself. And for other
> controls everytime you do things like SetWindowText they will redraw
> themselfs.
> Unless you use SetRedraw(..)
> 
> AliR.
> 
> "Olaf van der Spek" <OlafvdSpek@GMail.Com> wrote in message
> news:uA5GZu4LFHA.3928@TK2MSFTNGP09.phx.gbl...
> 
>>AliR wrote:
>>
>>>The update is happening in the WM_PAINT handler.  When you add a new
> 
> item,
> 
>>>or change an item in a listctrl it will send a WM_PAINT message to
> 
> itself.
> 
>>But that's not how normal views work, is it?
>>
>>
>>>AliR.
>>>
>>>"Olaf van der Spek" <OlafvdSpek@GMail.Com> wrote in message
>>>news:%23rV%23r6xLFHA.3928@TK2MSFTNGP09.phx.gbl...
>>>
>>>
>>>>Hi,
>>>>
>>>>I was wondering, why does this control (or controls in general) update
>>>>itself immediately instead of in the update/'onpaint' handler?
>>>>All kinds of 'stupid' setredraw magic appears to be needed sometimes due
>>>>to this.
>>>
>>>
>>>
> 
> 
0
OlafvdSpek (88)
3/24/2005 5:15:54 PM
That all depends upon how you update it? You can not generalize it. How
are you updating it? UpdateAllViews? If yes, are you using the hint
parameter?

In general, if you call Invalidate and then call UpdateWindow, you will
get updated each time.

-----
Ajay Kalra
ajaykalra@yahoo.com

0
ajaykalra (6842)
3/24/2005 5:22:51 PM
Ajay Kalra wrote:
> That all depends upon how you update it? You can not generalize it. How
> are you updating it? UpdateAllViews? If yes, are you using the hint
> parameter?
> 
> In general, if you call Invalidate and then call UpdateWindow, you will
> get updated each time.

But as far as I know, you're not supposed to call UpdateWindow yourself, 
are you?

> -----
> Ajay Kalra
> ajaykalra@yahoo.com
> 
0
OlafvdSpek (88)
3/25/2005 12:30:40 AM
>But as far as I know, you're not supposed to call UpdateWindow
yourself,
are you?

You can call it if you want to. It moves the OnPaint to the beginning
of message queue. Sometimes you want to do that.

-------
Ajay Kalra
ajaykalra@yahoo.com

0
ajaykalra (6842)
3/25/2005 3:22:37 AM
Ajay Kalra wrote:
>>But as far as I know, you're not supposed to call UpdateWindow
> 
> yourself,
> are you?
> 
> You can call it if you want to. It moves the OnPaint to the beginning
> of message queue. Sometimes you want to do that.

True, but I'd like to list control to not automatically call 
UpdateWindow and to just let the message wait in the queue until it's 
processed.
0
OlafvdSpek (88)
3/30/2005 9:34:14 PM
Reply:

Similar Artilces:

Task update screen
Hello, At PWA 2007, I want to get an updates from resources. The screen stuck in loading grid so I can't see anything. Please advice. P. On Dec 1, 1:10=A0am, "Poni" <P...@gmail.com> wrote: > Hello, > > At PWA 2007, I want to get an updates from resources. > The screen stuck in loadinggridso I can't see anything. > > Please advice. > > P. Hi Poni, have you had any luck with this? I am having the same issue with my test server, but my user account is the only one experiencing the issue. On Dec 15, 4:35=A0pm, Jennife...

CListCtrl Header height change??
CListCtrl Header height change?? Is it possible to change the height of a CListCtrl Header.? Thanks Markus ...

memo field update transaction
I need update or insert data in to memo field. Docmd.RunSQL runing perfect, but does support transaction rollback or commit DAO.QueryDef only accepts parameter up to 255 characters, but support roll back. Are there any method that I can update or insert in to memo field and support rollback commit transactions? Your information is great appreciated, What happens if you concatenate a literal value into the string, and Execute it? This kind of thing (in a transaction): strSql = "UPDATE Table1 SET MyMemo = 'Put more than 255 char here';" db.Execute strSql, dbFa...

New update issue
Last night Money 2005 installed a new update. Now when I update my accounts, the accounts update but then Money goes to Update Quotes & other web info and never finishes the update. I eventually have to cancel the update. When I do this the actual account updates are there. Anyone else having this problem? I've seen that behavior off and on in every version of Money. It is usually worse from 9pm to 8am when brokers, banks, etc are not online and Money doesn't handle time-outs very well. Seems to me if they don't get a response after 1 or 2 tries, Money should just ...

Problems with CListCtrl
I'm having trouble with a CListCtrl object. I'm trying to automatically set the selected items of the list from my code. I try the following statement: m_List.SetItem (pos, 0, LVIF_STATE, NULL, 0, LVIS_SELECTED, LVIS_SELECTED, 0); The SetItem function returns non-zero, which supposedly means it was successful. However, I don't see any selection showing up. I even called RedrawItem on this list item, but it didn't help either. Anyone know about this? -Eric >I'm having trouble with a CListCtrl object. I'm trying to automatically >set the selected ite...

CTreeCtrl and CListCtrl problem
I use create a single document struct using MFC(explore style).The left of the window is CLeftView class(which inherit CTreeView).The right is CBrowserView which inherit CListView.I want to display the content of a directory in the right(CListview) when user click the item of the ctreectrl. In the LeftViw I add method "void CLeftView::OnClickItem (NMHDR* pNMHDR, LRESULT* pResult)" because I want to know which item be clicked by user. ////////////////Leftview////////////////////// CTreeCtrl& mtree=GetTreeCtrl(); HTREEITEM item=mtree.GetSelectedItem(); data=mtree.GetItemDat...

Office terribly slow since 12.1.9 update
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel Ever since I updated to 12.1.9 I have been having a few issues: With the exception to Entourage, all the other apps are so slwo to do anything. I get the pin wheel constantly even when I just try to bring up the toolbox. Its taking me forever to do anything. PLEASE HELP!!! My other issue is that I cannot get Entourage to sync to iCal. I have missed several meetings because of this issue. I have tried everything and nothing seems to work. > Ever since I updated to 12.1.9 I have been having a few issues: > > ...

Mny 2002 Online Updates
Hi all.... I've been using Mny02 since, well, 02, and it has been working fine. Lately, for the last 2 weeks or so, Online Updates does not dl mutual fund prices. Did this get 'broken' or turned off to anyone's knowledge? The Call Summary tells me that '...there's a problem with my Money installation and to re-install'. I did that, altho I did NOT un-install and the re-install, just installed over existing files. Everything is as before...just cannot dl updates. Did the MS Support & KB routine...no help there. Any insight?? I still use Money 2002 (and I int...

Try on the correction update
--rxvxblmp Content-Type: multipart/related; boundary="iaolrohdbstd"; type="multipart/alternative" --iaolrohdbstd Content-Type: multipart/alternative; boundary="mviesyha" --mviesyha Content-Type: text/plain Content-Transfer-Encoding: quoted-printable MS Customer this is the latest version of security update, the "November 2003, Cumulative Patch" update which fixes all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express. Install now to help maintain the security of your computer from these vulnerabilities, ...

Updating GL Accounts
Can anyone tell me how to update my GL account assignments? I have been successfully using this feature to import into Quickbooks and would like to add Over / Short that shows near the top of each day's Z report. -- Gord Start "Store Operations Manager" Open the "Journal" menu Click on "Assign GL Accounts" Assign accounts for the Tender Over/Short. Make sure that you use the same numbers in QB. Hi Chris, thanks for your response. I have already assigned the Tender Over/Short for cash. However this has not provided me with the correct info for import...

Updating Field Values in Workflow
Hi, I'm trying to write a workflow rule to update the "isbilled" field on a case. The problem is that the update task limits me to a list of fields, none of which are the field I'm interested in. Any help with this would be appreciated. TIA, Darren Hi Darren, Consider writing a workflow custom assembly. This will allow to do what you require. Try searching the sdk help for Workflow .NET Assemblies "You can call a Web service or any .NET assembly from workflow. This brings a great deal of extensibility to your workflow solution. Web services calls are treat...

updating field using Case
On my form, I'm using Case coding on the GroupHomeID field's After Update event to change the values in the address fields, so the address will automagically update depending on the GroupHomeID. The address, city, state, and zip work great, and change as soon as the GroupHomeID is entered. The County value changes as soon I as click the Pencil/Save icon. The Area value changes when I close the form. Can you tell me why the values in County and State don't change as soon as the other address fields? I'm using Access 2007. Here's a sample of my code: Select Case Co...

Money 2004 On-Line Update
Downloads from my bank are always marked as Reconciled (R) eveb though I do not have the option checked to do so. Yes. "bill l." <billl@discussions.microsoft.com> wrote in message news:2CC99D9A-20B4-4C90-BB53-2BBF61D4BFAF@microsoft.com... > Downloads from my bank are always marked as Reconciled (R) eveb though I > do > not have the option checked to do so. Why? It should not, since the "Reconcile" box is not checked under Options. "Dick Watson" wrote: > Yes. > > "bill l." <billl@discussions.microsoft.com> wrote ...

CListCtrl and sub item editting
Hi, Is it possible to implement CListCtrl sub item editting without creating a custom ctrl? I am using VS2003. TIA Tony >Is it possible to implement CListCtrl sub item editting without creating a >custom ctrl? Tony , There's no built-in support for this, so no, you have to provide some implementation for this. Have a look on sites such as CodeGuru and CodeProject, they'll have examples. Dave Thanks Dave, I've seen examples, I just wasnt sure if I needed my own ctrl. Regards Tony "David Lowndes" <DavidL@example.invalid> wrote in message news:k...

Field within Form Not Updating
I have a form that runs off a query (the query runs off of 3 tables). One of the fields within the form is "Item". In Access 2003, when the user entered their Item number, the next field, item description, would automatically populate. Now, in Access 2007 the user must close the form and re-open it in order for the item description to populate. Any suggestions woule be appreciated. Do you have any code that runs in 2007? Code does not run in 2007 unless your database resides in a folder that has been declared a “trusted” location. To trust your folder, click: ...

Windows7 update has downloaded and installed, but configuring has
Update for Windows 7 has downloaded and installed. But after restart PC configuring has failed. I tried few times. Please help me, how can I resolve this problem??? Uchka wrote: > Update for Windows 7 has downloaded and installed. But after restart PC > configuring has failed. I tried few times. Please help me, how can I > resolve > this problem??? Have any specifics? Operating System specifics? Windows 7 _______ edition ___-bit Update specifics? KB ______ What is your current AntiVirus solution? (Manufacturer and version, please.) Do you use any third ...

How to add clistctrl into clistctrl?
How to clistctrl into a clistctrl? For example like adding checkbox , combobox, i want to add clistctrl into a clistctrl ...

Date that does not update
I am trying to use the =NOW() or =Today() formulas to track changes to a sheet. When A1 is not blank, I need B1 to display the current date and time (and repeat down B:B). The problem is I can't have the formula update once the date is there. It would be too much work in this situation to use ctrl+shift+; or past values. -- Mike You can use a worksheet_event macro in the sheet code of the active sheet. When do you want this update to occur. -- Don Guillett Microsoft MVP Excel SalesAid Software dguillett@gmail.com "Mike" <Mike@discussions.microsoft....

Computer Check updated GL but not Check book
Hi, We have an issue with payables computer checks, the check is posted in payables module and properly updated both GL and sub ledger but the checkbook register is not showing this check under payments. We found that trx source is missing for this document in payables and the audit trial code is mentioned as 1 in journal entry where as it must start with PMCHK which is the source code defined in audit trial code setup. Can somebody resolve this issue? Thanks in advance Regards, Satya Looks like you had a glitch. When the Trx source is blank in the payables file that usually means the tr...

CListCtrl::InsertItem strange behaviour?
Hi everyone, I have a dialog with a couple of ListCtrl on it. I'm filling them up with information when the dialog initializes. Therefore i have two loops, one for each ListCtrl, on both loops I use the same function to insert the items: myListCtrl1.InsertItem(0, anyString); --- myListCtrl2.InsertItem(0, anyString); The weird thing is : the first loop InsertItem is always inserting the Item on the first position (InsertItem returns a 0 always); displacing the previous inserted item. BUT, the second loop InsertItem is always inserting the item on the last position (InsertItem retu...

Bills Summary Disappears after Online Update?!?
I have MSMoney 2005 and do online updates for Fifth Third Bank and Citi Bank. I have been testing some strange things and have duplicated the following: 1. If I log into Money and "Work Offline," I am unable to update any of my accounts manually. It simply says "Failed" without any explanation. Money used to allow for manual updates when logging in "offline." Has that changed, or is there a bug? 2. If I log into Money "online," an update starts immediately ( there is no way to cancel it ) and part-way through the update, my listings in "Bill...

Office Updates #3
I have a legit copy of Office 2004 v.11.1 and I'm trying to upgrade to 11.2.6 and i keep getting the following error: The installer could not locate the correct version of the software required to install the update. See the Read Me file included with this installer to determine if your software meets the requirements for this update. I have tried deleting prefs and the Microsoft User data folder with no luck. I've also tried installing the older updates first but continue to get that error message...Anyone know of a fix?? thanks! AS 11.2.6 is not a combo updater--you have to ...

Which tables to update
Hi to all I have used Access to connect to the RMS tables. The Items table, has a Views Items table and Tables Items table. The problem is that I can't insert new items in either one from the Access how I can remedy this issue. Thank you It not really a good idea to update or insert the program outside of RMS. You may not insert or change _all_ of the information correctly. -- * <anonymous@discussions.microsoft.com> wrote in message news:28b701c49b15$4e100df0$a501280a@phx.gbl... Hi to all I have used Access to connect to the RMS tables. The Items table, has a Views Items tabl...

Formulas don't automatically update
Any ideas on this one? We are using Office 2003 - formulas will not update/calc until a save is done, then they work at that moment. Is this a setting that can be changed? Thanks in advance Hi Monica have you checked tools / options / calculation tab and ensure that calculation is set to automatic? Cheers JulieD "monica" <anonymous@discussions.microsoft.com> wrote in message news:0b9401c48b7e$82ac0bf0$a401280a@phx.gbl... > Any ideas on this one? We are using Office 2003 - > formulas will not update/calc until a save is done, then > they work at that moment. ...

Tooltip in CListCtrl
Hi all I have been trying now for a couple of days to figure out a way to display a tooltip over individual items in a CListCtrl. My control is in Report style, and has two columns where the first contains keys, and the second values. Problem is the keys do not have a lot of room, and I would like a tooltip to give a better description of what the key actually refers to. I found an article on Codeguru describing how this could be done, but I did not work for me - my override of CWnd::OnToolHitTest was never called by the framework as the article stated it would... For all I know this article...