ListView_SubItemHitTest redraws items

I have created my own CListCtrl derived control. In this I need to
override OnToolHitTest(). In this a call ListView_SubItemHitTest() to
detect over which item the mouse pointer is. But when I do that the
item is redrawn, which make my list flickering. This only happens when
I have a manifest file and when the application is dialog based and
the application run on WinXP. The following code illustrates the
problem:

CFlickerList is derived from CListCtrl:


void CFlickerList::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
{  
  NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
  
  if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
  {
        *pResult = CDRF_NOTIFYITEMDRAW;
  }
  else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
  {
        *pResult = CDRF_NOTIFYSUBITEMDRAW;;
  }
  
  else if ( (CDDS_ITEMPREPAINT| CDDS_SUBITEM) ==
            pLVCD->nmcd.dwDrawStage )
  {
    CDC* pDC = CDC::FromHandle(pLVCD->nmcd.hdc);

    int nItem = static_cast<int> (pLVCD->nmcd.dwItemSpec);
    int nSubItem =  pLVCD->iSubItem;

    TRACE(_T("Redrawing %d %d\n"), nItem, nSubItem);

    CRect rect;

    CString text = GetItemText(nItem, nSubItem);

    GetSubItemRect(nItem, nSubItem, LVIR_BOUNDS, rect);

    //Draw several times to make flickering
    for(int i=0; i<100; i++)
    {      
      pDC->FillSolidRect(&rect, RGB(255,100,0));
      pDC->DrawText(text ,
		    rect, 
 		    DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS );
    }
    *pResult = CDRF_SKIPDEFAULT;
  }
}

void CFlickerList::OnMouseMove(UINT nFlags, CPoint point) 
{
  LVHITTESTINFO lvhitTestInfo;
  
  lvhitTestInfo.pt = point;

  //LockWindowUpdate();
  HitTest(&lvhitTestInfo);
  //UnlockWindowUpdate();
}

If I make a CFlickerList in a dialog and add some items the item is
redrawn when the mouse pointer is over it (it seems only happen to
items in the first column). If I uncomment the HitTest line no redrawn
is done. One way to solve this is to call
LockWindowUpdate()/UnlockWindowUpdate(). But this doesn't work well in
OnToolHitTest(). For some reason tool tips are now shown when I do
this.

Is there someone that has any suggestion to solve this?

/PEK


0
pekspro (18)
9/5/2004 8:19:25 AM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
1474 Views

Similar Articles

[PageSpeed] 4

pekspro@home.se (PEK) wrote in message news:<413acb9c.7956326@news.individual.net>...
> I have created my own CListCtrl derived control. In this I need to
> override OnToolHitTest(). In this a call ListView_SubItemHitTest() to
> detect over which item the mouse pointer is. But when I do that the
> item is redrawn, which make my list flickering. This only happens when
> I have a manifest file and when the application is dialog based and
> the application run on WinXP. The following code illustrates the
> problem:
> 
> CFlickerList is derived from CListCtrl:
> 
> 
> void CFlickerList::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
> {  
>   NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
>   
>   if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
>   {
>         *pResult = CDRF_NOTIFYITEMDRAW;
>   }
>   else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
>   {
>         *pResult = CDRF_NOTIFYSUBITEMDRAW;;
>   }
>   
>   else if ( (CDDS_ITEMPREPAINT| CDDS_SUBITEM) ==
>             pLVCD->nmcd.dwDrawStage )
>   {
>     CDC* pDC = CDC::FromHandle(pLVCD->nmcd.hdc);
> 
>     int nItem = static_cast<int> (pLVCD->nmcd.dwItemSpec);
>     int nSubItem =  pLVCD->iSubItem;
> 
>     TRACE(_T("Redrawing %d %d\n"), nItem, nSubItem);
> 
>     CRect rect;
> 
>     CString text = GetItemText(nItem, nSubItem);
> 
>     GetSubItemRect(nItem, nSubItem, LVIR_BOUNDS, rect);
> 
>     //Draw several times to make flickering
>     for(int i=0; i<100; i++)
>     {      
>       pDC->FillSolidRect(&rect, RGB(255,100,0));
>       pDC->DrawText(text ,
> 		    rect, 
>  		    DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS );
>     }
>  *pResult = CDRF_SKIPDEFAULT;
>   }
> }
> 
> void CFlickerList::OnMouseMove(UINT nFlags, CPoint point) 
> {
>   LVHITTESTINFO lvhitTestInfo;
>   
>   lvhitTestInfo.pt = point;
> 
>   //LockWindowUpdate();
>   HitTest(&lvhitTestInfo);
>   //UnlockWindowUpdate();
> }
> 
> If I make a CFlickerList in a dialog and add some items the item is
> redrawn when the mouse pointer is over it (it seems only happen to
> items in the first column). If I uncomment the HitTest line no redrawn
> is done. One way to solve this is to call
> LockWindowUpdate()/UnlockWindowUpdate(). But this doesn't work well in
> OnToolHitTest(). For some reason tool tips are now shown when I do
> this.
> 
> Is there someone that has any suggestion to solve this?
> 
> /PEK
Hi,
Seeing your sending of this remind me onto you like about my 1 prior
problem !
 All of this was long ago but available for you a very hard search on my head :-
)).
As personal opinion, it got to do with parent OnPaint and OnEraseBackground keep
s getting in more than should. That single infuriating XP problem is a quirk in
a product (version difference) that will make you loathe it and your odds of dea
ling with this breaking irritants is handling before the OnMouseWheel.
Just if you need it more info a guess I get this from The code project.
Good luck

Eddy Ruslim
-----------
Utility software to increase your productive value
http://www.myrealemall.com/stores/Finasoft/index.asp
e.g: backup helper/file lister, attendance with amano interface, invoice
0
9/9/2004 7:54:45 PM
Reply:

Similar Artilces:

Redrawing question
Hi all, I have listbox in my application...Now when i enter the data into it, i do it using InsertString starting from top....Now when the number of rows entered becomes equal to size of listbox.....data gets added but is not seen(i need to move the scroll bar to see that data)....what i want is at all the time i should be able to see the last string entered....if strings entered in the begining are not seen then its ok.....how should i do that in listbox..........also one other thing i would like to add is data gets entered every 2 econds(i.e, a new string is added every 2 seconds)......

Deleting a single mail item remotely?
Is it possible to delete an item from user(s) mailbox(es) if it is mistakenly sent? We've just migrated to Exchange 2003 and I would like to know as we could do it with sendmail easily. What normally happens to require this need is someone sends an email they shouldn't have to the wrong people then panics and rings us to try and delete it before the users in question logon and see the mail. a On Sun, 4 Apr 2004 20:16:52 +0100, "al" <{ask_me}@blueyonder.co.uk> wrote: >Is it possible to delete an item from user(s) mailbox(es) if it is >mistakenly sent? We&...

CScrollview not redrawing properly
I have a CScrollView onto which I drew some text using the DrawText call. But it isn't working like it should. If I resize the window so that the last lines of text aren't showing, then scroll down, they don't show up. I scroll back up, and the top lines are there. Then, if I resize the window back to large, I can see the bottom lines again. This must have something to do with the drawing, but I'm not quite sure how exactly the drawing is handled when scrolling with the CScrollView object. Please help! In OnDraw() for the ScrollView, I have: CRect clientRect; GetClientR...

Is it mandatory to create a recovery farm for Item Level Recovery
We want to test Item Lever Recovery in Share Point.We have successfully did the backup but when we tried to restore test word file we are not able to select the original server as it is not in list. Is it mandatory to setup other server for RECOVERY FARM . After recovering individual item do we need to manyally copy file to original sharepoint server. -Tejas For SharePoint 2010 with DPM 2010, recovery is possible without recovery farm creation as well. But for older versions of SharePoint and/or with DPM 2007 recovery farm creation is required. Thanks, Praveen...

ListView_SubItemHitTest redraws items
I have created my own CListCtrl derived control. In this I need to override OnToolHitTest(). In this a call ListView_SubItemHitTest() to detect over which item the mouse pointer is. But when I do that the item is redrawn, which make my list flickering. This only happens when I have a manifest file and when the application is dialog based and the application run on WinXP. The following code illustrates the problem: CFlickerList is derived from CListCtrl: void CFlickerList::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult) { NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNM...

Item discount scheme
I have a cleint that had discount scheme for an item. She turned it off, but when she rings up the item in the pos register it gives a warning message: "Warning 907, The item quantity discount was not found in the database. Do you want to continues?" I veify that the discount scheme is turned off, but still gives that warning message in pos. I re-selected the discount scheme and turned it off again and it seem to fix that warning message. I thought it was a bug in the software, so I updated their POS system from 1.3.1006 to 1011, but still gave that error. Any ideas why the so...

how to redraw the bitmap in a dialog box
hello, Can someone tell how to do this since i have been struggling with it for more than 2 weeks. My application draws a series of bitmaps on the dialog box one after the other. Its something like an animation where i read the bitmaps from a file and draw each one subsequently in a specified region of the dialog box using "dc.bitblt" in a while loop in the OnPaint message handler.Everyhtin is working fine but the problem arises when i move this dialog box outside the client area of the application and then move it back in or minimise the application and maximise it again. Then the O...

how to prevent sent items to be duplicated in the sent items fold
All of my sent messages in Outlook show up in the sent items folder in duplicate. How do I prevent that from happening? To make it less of a uessing game, how about telling us: version of Outlook type of mail store used Has it always behaved this way? If not, what did you do just before it changed? Regards Judy Gleeson MVP Outlook "Bev" <Bev@discussions.microsoft.com> wrote in message news:0DB0C3DA-4F3C-450B-BE32-E43DAF1B95F5@microsoft.com... > All of my sent messages in Outlook show up in the sent items folder in > duplicate. How do I pre...

redraw thing
So my Excel app has VBA code that does a long file read and update operation. This can take up to one hour. And the client wants it to show a "please wait" message while it is doing this to help assure that it isn't just hung. So I added a non-modal user form with the message. Put it up on the screen before the work starts, and unload it again after the work is done. My problem is, the form does not finish redrawing before the work starts. And by then, Excel is sucking all the CPU doing the work, so the form does not redraw. It shows an empty frame the entire time. Which just m...

sent emails not being moved from outbox to sent items
A friend of mine has recently changed computers, and transfered the pst file from the old to the new. Whilst sending email and replies, actually works, the email sent stays in the outbox instead of being transfered to the sent items folder. The email is not date stamped as being sent, but tests prove that they are actually going. Suggestions to fix this please. Despite heaps of time spent trying to resolve the issue, we have found nothing. tks Peter Outlook has a feature to send the mails after a certain duration... tha means, all mails are spooled in the outbox until the specified tim re...

Multiple Posting Accounts For Single Item
Is it possible to assign multiple Posting Accounts to a single kit component item in Great Plains 8.00? For example, Picture Frame ABC has one component (123). Kit Item Number: Picture Frame ABC * Component Item Number: 123 On the Item Account Maintenance screen, ‘Sales’ for Component Item Number 123 are set to go to Account number xxxx-xx-xx. I want to create a new kit - Picture Frame DEF. This new kit will be exactly the same as Picture Frame ABC except I want the ‘Sales’ for Component Item Number 123 to go to a different account number yyyy-yy-yy. Is this possible? Or are ther...

Duplicate Inboxes, Drafts, Sent items, Junk email, deleted items
I have 4 email accounts that I'm using in Win Live Mail. Each account has an inbox, a drafts folder, a sent items folder, a junk email folder, and a deleted items folder. Talk about overkill ! I'm happy that each account has an inbox....that does what 4 message rules did in Outlook Express. But the multiple drafts, sent items, junk email, and deleted items are just plain irritating. The program won't let me delete them. Is there any way to fix this irritant? I just don't need all these folders. Thanks. Each account has its own compliment of ...

Customize Price List Items
I think I can safely say that its not a supported customization to modify the Price List Items form. Needless to say I'm once again disappointed with this product, but to be a good trooper (until we switch to another CRM), the lack of this ability really screws everything up for out business process. First it was bad that the entire kitting process in the Product catalog serves no function whatsoever, but now I can't customize the price list or price list items?! So am I to believe that EVERY SINGLE ONE OF YOU are using the same price list form?! PLEASE tell me I'm not alone in t...

Find in ALL SENT ITEMS greyed out!
I need a way of searching in "all sent items" from "all accounts". I can see "all sent email" in quick view but the "find" option there is greyed out. I run 35 email addresses. As owner of several slightly related websites I have emails similar to "apples@shop1.com" "oranges@shop1.com" "lemons@shop1.com" "apples@shop2.com" "oranges@shop2.com" "lemons@shop2.com" The people that email me have clicked on an email address and I like to give the impression they are dealing with a...

Capture Item Lookup Code before it goes on POS screen!
I'm doing little customization for RMS POS. I need to get Item lookup code before it goes on POS transaction screen. In other words when I type item number in POS screen and press enter, I need to intercept and get that number before RMS searches that item through inventory and adds to transaction entry. If I use this mySession.Transaction.Entries.Element(I).Item.Description I get what I need but only after item is on transaction screen Appreciate your response Thanks, ...

Journal calendar items?
I'm using envelope journaling and it's working very well; however, I'd like to know if I can also capture calendar events in the journal. Thanks, D On Sat, 11 Feb 2006 00:17:27 -0800, Dan <Dan@discussions.microsoft.com> wrote: >I'm using envelope journaling and it's working very well; however, I'd like >to know if I can also capture calendar events in the journal. >Thanks, >D Only the send them as an email. ...

PO Return for uninvoiced item
We're trying to process a return against a PO line that was received in error. The receipt has not been matched to an invoice, and won't be since it was our mistake to receive it in the first place. There has been no further inventory or sales activity on the item since the PO receipt. When I try to enter a 'Return', the specific receipt transaction doesn't show. If I enter 'Return with Credit' then it does show. Since we won't be invoiced I'd rather not create a credit on the vendor account, but there doesn't appear to be an option at this poi...

inactivating matrix items
Is there an easy way to inactivate matrix items? I have been manually calling up each size and choosing "options" and "make item inactive". This still leaves the main code active. How do I inactivate the entire Item code and Description? thanks there's a task in the inventory wizard that will let you make multiple items inactive at once. You can't make the Matrix itself inactive - the Matrix is not really an Item, its just a way to group multiple related items together. You could Delete the Matrix - this will not delete any of the matrix 'child' ...

How to change item encoding with macro?
With russian outlook 2003 it has been possible to change item encoding individually, by opening each item and select it's appropriate menu. With russian outlook 2007 this is not working (as it seems). I want to automate it: convert several items in batch? Is it possible? TIA. ...

Redrawing a Window Based on Input
Hello, all: I've a small problem I'm trying to tackle. I have a dialog box application that creates an instance of my own class derived from CWnd. BOOL CMyDialog::OnInitDialog() { ... this->m_pMyWnd = new CMyWnd; this->m_pMyWnd->Create(NULL, NULL, WS_OVERLAPPEDWINDOW & ~WS_MINIMIZEBOX & ~WS_MAXIMIZEBOX | WS_CHILD | WS_VISIBLE, rect, this, 1000); ... } The dialog box creates the derived window, and the window can be moved and dragged about the dialog box. However, I also have stationary buttons in the dialog box that are supposed to change the canvas in...

Wrong date on Sent items
Hello, I have Outlook 2007 and for some reason, just recently, my sent items are coming with December 10, 2009 and December 11th, 2009, etc which is incorrect as we are on December 9th, 2009. I did check the clock and it has the correct date and time. I went to control panel, to Date/Time and it has the correct date and time and the correct Time Zone. The internet Zone seems to be fine as well. Any ideas? Is there any other setting on Outlook that I can check? Thank you in advance for your help. What type of email account? Does it happen to all mail or just some? Did you r...

Average function for more than 30 items
How can I use Average function to calculate average of more than 30 items? becasue Average function do not accept 31st item & gives an error Or Is there any other alternative. Thank you, Murtaza Don't use =AVERAGE(A1,A2,A3,A4,...,A100) ... won't work Use: =AVERAGE(A1:A100) Mangesh "Murtaza" <NoEmail@NoEmail> wrote in message news:OXQp4E7zFHA.904@tk2msftngp13.phx.gbl... > How can I use Average function to calculate average of more than 30 items? > becasue Average function do not accept 31st item & gives an error > > Or Is there any other a...

Print an item message for specific ILCs
Is there a way to do conditional printing of an item message on the receipt? I need to print a "No Exchanges or Refunds!" message below any item description from a specific category. The tag along item doesn't work because it throws of the quantities on the receipt and reports etc and clutters the receipt. If the above is not possible how about a message towards the bottom of the receipt? I'm assuming you dont already know this, but you probably do. Yes you can put a simple refunds or exchanges clause at the bottom of your reciepts. You can use the Footer lines i...

How to inactivate an inventory item in GP v8 ?
Hi, In GP v8, how can I "inactivate" an inventory item ? in GP v8, how can I make an "inactive" inventory item not be a selectable item? A very common inventory scenario is when there is a problem with a certain item an you do not want to be able to sell it until the problem is resolved. This is also true of certian inventory lots. If this cannot be done in v8, was it fixed in v9 ? I look forward to any and all comments. Regards, Brcobrem have you tried making it Discontinued? -- dlothspe[MSFT]@online.microsoft.com This posting is provided "AS IS" wit...

Sorting by Item Description and then Item ID?
Hello: A GP 10.0 client wants to be able to have the Inventory Item Description appear in the Inventory Items lookup window but have the window sort in order of Inventory Item ID. So, the first column would be the Inventory Item ID and the lookup window would be sorted by this. But, the third column would have GP’s Item Description appear. Is it possible to accomplish this using Modifier with VBA? Thanks! childofthe1980s get smartfill from rocktonsoftware "childofthe1980s" <childofthe1980s@discussions.microsoft.com> wrote in message news:5B3B5B5A-1266-4174-91FC-5D7...