-
June 13th, 2005, 04:05 PM
#1
Repaint of region within C++ application
Hi all,
As someone with limited knowledge of C++ I'm trying to figure out how to repaint a part of my application.
I right click on an icon and select 'Mark' which basically adds a 'Checkmark' bmp to the icon I'm right clicking on. The problem is that the 'Checkmark' doesn't appear unless I move the app. or drag another window over the app. containg the icon, which of course fires a repaint of my app. How can I add it so that upon right clicking on the icon it repaints the screen ther and then. I've heard that 'invalidaterect' and 'updatewindow' may work but not sure how to implement.
Thanks in advance.
Neil
Below is the code that needs to call the repaint.
LRESULT OnGfxMarkitem(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
if (iHitInternal1 == htItem)
{
if ( GetItemImage(iHitInternal2) != COMPARE_TOOL_IMAGE_INDX)
{
CWindow wnd(m_hOwnerWindow);
SetItemImage(iHitInternal2,COMPARE_TOOL_IMAGE_INDX);
wnd.SendMessage(WM_OUTBAR_NOTIFY, NM_OB_ITEMCLICK_COMPARE, iHitInternal2);
}
else
{
SetItemImage(iHitInternal2,DEFAULT_IMAGE_INDX);
}
}
return 0;
}
-
June 13th, 2005, 04:58 PM
#2
Re: Repaint of region within C++ application
You just call UpdateWindow for the window that contains your icon(s) right after you have finished with adding the 'Checkmark'.
//Exceptions exist!
-
June 14th, 2005, 06:43 AM
#3
Re: Repaint of region within C++ application
How do I call UpdateWindow for the window that contains the icons in the code I posted?
Thanks
-
June 14th, 2005, 06:59 AM
#4
Re: Repaint of region within C++ application
Originally Posted by neilharvey
How do I call UpdateWindow for the window that contains the icons in the code I posted?
Sorry, but I don't understand the code you posted. What is CWindow wnd supposed to do there? Looks like you're mixing MFC with ATL?
-
June 14th, 2005, 10:38 AM
#5
Re: Repaint of region within C++ application
Like I said it's new to me and I'm trying to get some hints as to how to solve my problem. gstercken, perhaps you can explain MFC and ATL?
Anyone else know how I can call UpdateWindow in the code I first posted?
Tahnks
-
June 14th, 2005, 10:43 AM
#6
Re: Repaint of region within C++ application
Originally Posted by neilharvey
gstercken, perhaps you can explain MFC and ATL?
See MSDN for details - it's all there.
The question is: How did you create your application in the first place? And where and how did you add the code you posted?
-
June 14th, 2005, 10:59 AM
#7
Re: Repaint of region within C++ application
The application was written by someone no longer with the firm. I am desperately trying to add the functionality described in the first post and although I know what I'm trying to achieve I am having difficulty implementing it. Like I said, I think I need to use UpdateWindow but how do I specify what area to update and the exact syntax. The code I posted comes from one of the header files being used by the app. Thanks
-
June 14th, 2005, 11:20 AM
#8
Re: Repaint of region within C++ application
Originally Posted by neilharvey
Like I said, I think I need to use UpdateWindow but how do I specify what area to update and the exact syntax.
No, I don't think so. UpdateWindow is only required if for some reason you need to redraw a window immediately (before returning control to the system and processing WM_PAINT messages). That's not the case in your situation.
-
June 14th, 2005, 11:41 AM
#9
Re: Repaint of region within C++ application
Originally Posted by gstercken
No, I don't think so. UpdateWindow is only required if for some reason you need to redraw a window immediately (before returning control to the system and processing WM_PAINT messages). That's not the case in your situation.
Well, it sounds like the OP infact needs an immediate redraw here, g !! See below>>>
How can I add it so that upon right clicking on the icon it repaints the screen ther and then
-
June 14th, 2005, 11:48 AM
#10
Re: Repaint of region within C++ application
Originally Posted by kirants
Well, it sounds like the OP infact needs an immediate redraw here, g !! See below>>>
I still don't think so. In the WM_RBUTTONDOWN handler, the new icon is set. After that, the handler returns, WM_PAINT messages will be processed, and the window is redrawn immediately with the new icon. What I find rather strange in the OP's code is that CWindow instance created locally on the stack...
-
June 14th, 2005, 11:53 AM
#11
Re: Repaint of region within C++ application
Yep. I don't understand the code though.. OP, please explain what the code is ? Is it the WndProc handler for that window or is it handler in the parent window.. Please elaborate !!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|