Tab causes CStatic-derived object to repaint!!

Hi,

I derived a class named CGroupBox from CStatic. I am using it the following
way:

1. I created a dialog (and its corresponding CDialog-derived class) using
the resource editor
2. In the dialog, I created a group box.
3. I mapped the group box component to a CGroupBox member of the dialog's
class using the Class Wizard.

I did this so that I could override OnPaint() and give the group box a
custom look. When the dialog comes up, the focus is set to an edit control.
As soon as I hit the TAB key to switch to the next edit control, the group
box's label gets repainted--only the label, and using default attributes
other than those I use in OnPaint(). That means it gets repainted in the
wrong place, with the wrong font, obscuring part of the label I draw in
OnPaint().

This only happens the first time I hit TAB. If I force the dialog to repaint
(by, say, covering it with another window, then uncovering it), the label
paints normally, and hitting TAB causes no further problems. I have no clue
as to what function is repainting the label, but I know it is not my
overriden OnPaint() or OnNcPaint().


I used Spy++ to capture the messages the group box window receives when I
hit TAB for the first time (no messages received if I hit TAB again):

<00001> 0007039A S ..message:0x0128 [Unknown] wParam:00010002
lParam:00000000
<00002> 0007039A R ..message:0x0128 [Unknown] lResult:00000000


Any clues, anybody?

Thanks,
Silvio


0
slopes (29)
8/14/2003 6:58:52 PM
vc.mfc 33608 articles. 0 followers. Follow

4 Replies
744 Views

Similar Articles

[PageSpeed] 33

Is that 0x0128 message by any chance the WM_UPDATEUISTATE message?
-- 
Jeff Partch [VC++ MVP]

"Silvio Lopes de Oliveira" <slopes@shuf.com> wrote in message
news:bhgm5c$mi1@dispatch.concentric.net...
> Hi,
>
> I derived a class named CGroupBox from CStatic. I am using it the
following
> way:
>
> 1. I created a dialog (and its corresponding CDialog-derived class) using
> the resource editor
> 2. In the dialog, I created a group box.
> 3. I mapped the group box component to a CGroupBox member of the dialog's
> class using the Class Wizard.
>
> I did this so that I could override OnPaint() and give the group box a
> custom look. When the dialog comes up, the focus is set to an edit
control.
> As soon as I hit the TAB key to switch to the next edit control, the group
> box's label gets repainted--only the label, and using default attributes
> other than those I use in OnPaint(). That means it gets repainted in the
> wrong place, with the wrong font, obscuring part of the label I draw in
> OnPaint().
>
> This only happens the first time I hit TAB. If I force the dialog to
repaint
> (by, say, covering it with another window, then uncovering it), the label
> paints normally, and hitting TAB causes no further problems. I have no
clue
> as to what function is repainting the label, but I know it is not my
> overriden OnPaint() or OnNcPaint().
>
>
> I used Spy++ to capture the messages the group box window receives when I
> hit TAB for the first time (no messages received if I hit TAB again):
>
> <00001> 0007039A S ..message:0x0128 [Unknown] wParam:00010002
> lParam:00000000
> <00002> 0007039A R ..message:0x0128 [Unknown] lResult:00000000
>
>
> Any clues, anybody?
>
> Thanks,
> Silvio
>
>


0
jeffp (1711)
8/14/2003 7:29:19 PM
Good work! If you don't mind me asking, how did you verify that 0x0128 was
indeed UPDATEUISTATE?

I ended up handling this problem by overriding WindowProc() and returning
true for message == 0x0128.

Thanks for your help!

Silvio



"Jeff Partch" <jeffp@mvps.org> wrote in message
news:O30Vi0tYDHA.1872@TK2MSFTNGP12.phx.gbl...
> "Jeff Partch" <jeffp@mvps.org> wrote in message
> news:OT9icQrYDHA.2548@TK2MSFTNGP09.phx.gbl...
> > "Silvio Lopes de Oliveira" <slopes@shuf.com> wrote in message
> > news:bhh1el$mi6@dispatch.concentric.net...
> > > I don't know; Spy++ was not able to identify it. I tried to find the
> > > definition of WM_UPDATEUISTATE but I could not find it. I also
> looked into
> > > winuser.h (where the WM_ messages are defined) and could find
> neither
> > 0X0128
> > > nor WM_UPDATEUISTATE.
> >
> > Well, I'm away from my dev box right now, but I'll look it up later.
> If my
> > memory is right, what I think is happening is that the tab key usage
> is
> > activating the visibility of the mnemonic underlines and whatnot, and
> which
> > causes the system to send (I think) a WM_UPDATEUISTATE message, at
> which the
> > static WNDPROC is probably repainting itself directly. But its only a
> > theory.
>
> Okay Silvio,
>
> > <00001> 0007039A S ..message:0x0128 [Unknown] wParam:00010002
>
> I just checked and message 0x0128 is WM_UPDATEUISTATE, but the wParam
> value indicates I was a bit off. The LOWORD(wParam) value corresponds to
> UIS_CLEAR, but the HIWORD(wParam) value corresponds to UISF_HIDEFOCUS
> not UISF_HIDEACCEL.
> -- 
> Jeff Partch [VC++ MVP]
>
>


0
slopes (29)
8/15/2003 6:02:40 PM
A group box is not derived from CStatic; it is a CButton. Therefore, putting a group box
on your dialog and attaching it to CGroupBox derived from CStatic is a fundamental error.
Make sure you do not have the WS_TABSTOP attribute set in this control. The alternative is
to actually put a CStatic on the dialog and attach you class  to that.
					joe

On 14 Aug 2003 18:58:52 GMT, "Silvio Lopes de Oliveira" <slopes@shuf.com> wrote:

>Hi,
>
>I derived a class named CGroupBox from CStatic. I am using it the following
>way:
>
>1. I created a dialog (and its corresponding CDialog-derived class) using
>the resource editor
>2. In the dialog, I created a group box.
>3. I mapped the group box component to a CGroupBox member of the dialog's
>class using the Class Wizard.
>
>I did this so that I could override OnPaint() and give the group box a
>custom look. When the dialog comes up, the focus is set to an edit control.
>As soon as I hit the TAB key to switch to the next edit control, the group
>box's label gets repainted--only the label, and using default attributes
>other than those I use in OnPaint(). That means it gets repainted in the
>wrong place, with the wrong font, obscuring part of the label I draw in
>OnPaint().
>
>This only happens the first time I hit TAB. If I force the dialog to repaint
>(by, say, covering it with another window, then uncovering it), the label
>paints normally, and hitting TAB causes no further problems. I have no clue
>as to what function is repainting the label, but I know it is not my
>overriden OnPaint() or OnNcPaint().
>
>
>I used Spy++ to capture the messages the group box window receives when I
>hit TAB for the first time (no messages received if I hit TAB again):
>
><00001> 0007039A S ..message:0x0128 [Unknown] wParam:00010002
>lParam:00000000
><00002> 0007039A R ..message:0x0128 [Unknown] lResult:00000000
>
>
>Any clues, anybody?
>
>Thanks,
>Silvio
>

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15974)
8/15/2003 9:06:53 PM
"Silvio Lopes de Oliveira" <slopes@shuf.com> wrote in message
news:bhj780$bnq@dispatch.concentric.net...
> Good work! If you don't mind me asking, how did you verify that 0x0128 was
> indeed UPDATEUISTATE?

I've got it #defined in the SDK headers installed on my system.

> I ended up handling this problem by overriding WindowProc() and returning
> true for message == 0x0128.

Cool! Glad you got it working the way you wanted!

-- 
Jeff Partch [VC++ MVP]


0
jeffp (1711)
8/15/2003 11:01:48 PM
Reply:

Similar Artilces:

Creating charts with objects in excel
Version: 2008 Operating System: Mac OS X 10.4 (Tiger) Processor: Intel I am trying to put statistical information in bar charts created in Excel. I put asterisks in text boxes and draw lines below them to show which groups are being compared. The program does not seem to want to let me group them all, maybe there is a limit to how much you can group? So, to keep them from moving, I tried to save as a picture in a jpeg or png format but not all the lines and asterisks are showing up. I am finding this program extremely frustrating to use and hope I don't lose my mind before I finish my the...

Selecting with the mouse causes the object to move
I'm using Powerpoint 2003 with Windows 7. When I select an object in Powerpoint, whether left- or right-clicking, the object moves slightly. This is a royal pain, because I have to press ctrl-z after every selection, otherwise the movement continues to propagate on every successive selection. I think it is a mouse problem (I have a gateway mouse). Any thoughts on how to correct this? Is it a cordless mouse? If so, toss it and go back to a corded mouse. "rowed79" wrote: > I'm using Powerpoint 2003 with Windows 7. When I select an object in > Powe...

Error when doing Insert/Object/Create from file
Pub 2002 pop up error window says: Pub cannot launch or communicate with the OLE server program to complete the task. There may not be enough disk space, or there may be a problem witht he server program. I have a large Publisher 2002 document open (24x36) and want to insert a MS Word 2002 document into it and get this message. I have reloaded Office, and have 8GB of disk space free. The Word file size is 100K. I can't find anything in knowledge base or anywhere else. Anybody have an idea on how to insert the doc without re- creating it in a text box? Go to www.microsoft.com/da...

Money 2006 crashes when I click on the Bills tab
Hi, I've been having a problem where Money 2006 crashes when I click on the Bills tab. I've followed the remedy discussed by KB900969 to no avail. Anyone have any suggestions on how I might get to the bottom of this? From Help...About: Money version 15.0.80.513 -- Thanks, Mike ...

Exchange tabs in Active Directory Users and Computers
Hi, We have an exchange server and many other domain controllers. In order for us to have the Exchange tabs in Active Directory is to use the Exchange server. We want to be able to have the Exchange tabs in our domain controllers so that other admin can create email accounts on our only one exchange server. Can someone help me on this? Much appreciated. --kent On Tue, 6 Jan 2004 03:58:07 -0800, Kent Nguyen wrote: > We have an exchange server and many other domain > controllers. In order for us to have the Exchange tabs > in Active Directory is to use the Exchange serve...

Picture/Object in List
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel How do I associate a picture(object) to a specific cell in a list, so I can sort, filter, etc. (Normally objects just &quot;float&quot; on a spreadsheet and if you sort, objects will not move with the row they are placed.) <br><br>Thank you, Basically, this doesn't work in Excel 2008. If an image is wholly contained within the cell that contains its top left corner, and its properties are set to "Move and size with cells", then if you move the cell the picture will move. If y...

XSLT Extension Object Problem
In my old VB6 application I have an xslt extension object that builds a small cross reference document and returns it as a NodeList in my XSLT. I can then use it with xpath expressions as $nodeset/xpath and I would get my values or use xsl:copy-of and I would get the whole document in my results tree. In my .Net version I don't get anything with my $nodeset/xpath expression and if I use the xsl:copy-of I get a value of System.Xml.XPath.XPathNodeList. I know this is the real object of the node set but what am I doing wrong for it not to be a node-set when it returns to my XSLT? Anyone...

Key command to switch between tabs
I am wondering if any of you know the key command to switch from one tab on an excel sheet to an alternate one. Any tips appreciated. Thanks, Mike Ctrl + pageup/down -- Regards, Peo Sjoblom "Mike" <anonymous@discussions.microsoft.com> wrote in message news:1372901c3f726$86caee50$a501280a@phx.gbl... > I am wondering if any of you know the key command to > switch from one tab on an excel sheet to an alternate > one. Any tips appreciated. > > Thanks, > > Mike Mike Ctrl+PgDown or Ctrl+PgUp -- HTH Nick Hodge Microsoft MVP - Excel Southampton, ...

Pivot table caused 50 MB excel file
I used more than 15 pivot tables in an excel file. It also have quite a lot of formulas. Though there is hardly much of data, file size has increased to 50 MB. In my quest to find out what caused this huge size, I deleted all the sheets one by one and observed that workbook with all the sheets deleted was 7 MB!! I am sure this is very common for excel to get heavy in size but any idea how to shrink/compress it back to normal? 1. Is it caching, which needs to be cleared? 2. I have already deleted all the not populated rows and columns to tell excel that data does not exist there!! what els...

Outlook blocked access to the potentially unsafe objects: package
Hi, We get a warning prompt while sending a mail with another emails as attachments. It says "outlook found potentially unsafe objects" message. All the attachments in the email are MSG format files. I know the procedure to allow unsafe file attachments but the error message says "unsafe objects". How do I allow sending mails with unsafe objects?? -Chandu If you try to send the same message in Plain Text format, do you still get that error? If so, there is probably an object within your message that is triggering the error. Things like Stationery and Si...

When pressing 'send/receive', I am told object not found. Why?
I have configured email account and the test is positive to my blackberry and to my earthlink account. It won't come to outlook though. Why not? Any error messages? --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) virus, all mail sent to my personal account will be deleted without reading. After furious head scratching, alextrio asked: | I have configured email account and the test is positive to my | blackberry and to my earthlink account. It won't come to outlook | though. ...

Setup Read permissions in Exchange advanced tab
The user is not able to open another user's mailbox even I have added the user to the mailbox rights tab and given him "Read Permissions". I try the same with given the user "Full mailbox access", the user will then able to open the mailbox. Am I missing anything? You will have to go into the user's Outlook Client Right Click on thier Inbox and select > properties > persmissions tab and add the user you want to have permissions. Read only will also automatically select the 'folder visible' option. this will give the user 'reviewer' righ...

Background color of each tab button in a TabControl
Hi I changed background color of a tab control in the OnEraseBackground and set the button properties to TRUE in reource editor . I want to change teh background color of these buttons . How shoudl I go for it?Pls guide Bhargs Can some one help me out here Ali R,Ajay,Scott,David ,pls guide. Bhargs wrote: > Hi > I changed background color of a tab control in the OnEraseBackground > and set the button properties to TRUE in reource editor . > I want to change teh background color of these buttons . > How shoudl I go for it?Pls guide > Bhargs Bhargs wrote: >>Hi >&...

Printing jpeg objects in Excel2003
...

Runtime Error 429 "ActiveX Component can't create object"
Hi all, My VB6 exe as a service is running flawless on my dev computer w. XP Pro. I have created a PDW install and installed it on a WindowsEmbedded (XP) system. There is no Form, so the only reference I have to any .ocx is: Public WithEvents mComm As MSComm Private Sub Class_Initialize() Set mComm = CreateObject("MSCOMMLIB.MSCOMM") End Sub Private Sub Class_Terminate() Set mComm = Nothing End Sub Private Sub mComm_OnComm() Comm1_OnComm End Sub All dll's, tlb's and mscomm32.ocx are registered and in SharedDLLs. What else could cause ...

CArray seems to overwrite stored objects
Hello, I'm rather new to C++ and MFC programming. I encountered the following error: when storing objects in a CArray, the values of previously set objects are changed. CArray<CPerson*, CPerson*> marrPeople; // cut empty compiler and destructor void CF::addPerson(CPerson *poP){ marrPeople.Add(poP); } CPerson* CF::getPerson(int iIndex) { return marrPeople.GetAt(iIndex); } // NOTE: aantalPersons = amountofpersons int CF::getAantalPersons() { return marrPeople.GetSize(); } In a loop I add an undetermined amount of Persons : CF* oF = new CF(); while(somecondition) { ...

When inserting an Adobe object in Publisher, why is it blurry?
I have an Adobe file that appears very sharp in Adobe Acrobat. When I insert it as an object into my Publisher file, it becomes blurry. How can I insert it with the same quality, same resolution as the original Adobe file? Elly wrote: > I have an Adobe file that appears very sharp in Adobe Acrobat. When I insert > it as an object into my Publisher file, it becomes blurry. How can I insert > it with the same quality, same resolution as the original Adobe file? Have a read of http://ed.mvps.org/Static.aspx?=Publisher/convertpdf -- Ed Bennett - MVP Microsoft Publisher http://...

VB syntax problem with referencing another tab
Hi. The following macro works fine if I run it while the tab in question is open. If I try to run it with another tab open, I get a 400 error. I'm pretty sure it's just a problem with the way I'm referencing the tab. Any ideas on how I could make this work? Sub Formatierung_Einverkauf() Set sh1 = Sheets("Einverkauf") z = 4 Do Until sh1.Cells(z, 1).Value = "" If sh1.Cells(z, 1).Value <> sh1.Cells(z + 1, 1).Value Then sh1.Rows(z).Select With Selection.Borders(xlEdgeBottom) .LineStyle = xl...

recent updates causing profile problems
Greetings, I recently approved the latest batch of updates on my wsus server however on clients that have been updated i have noticed strange problems. 1. When logging on as local admin i always get an error saying the temp folder doesnt. This is happening on any updated client even those that had worked fine previously just the other day. 2. I also have office deciding to installing components for no reason which shouldnt be happening as they are all complete installs with local cab files. Any ideas anyone? Cheers jjohnson1980 wrote: > I recently approved the latest b...

subform error message about automation object
I have a subform that lets me edit existing records with no problem. When I attempt to type the first character in a new record (any field) I get the message "the object doesn't contain the automation object 'Project.'" Project is a table used in the subform. When I close the message I can proceed with the data entry and the record is saved just fine. There are no macros or VB code involved in this form or subform. I want this to keep working just as it is -- but without the error message! Any suggestions? This usually occurs if there is an equal sign procee...

Parsing <param> tag in <object> problem
I am now parsing <param> tag in <object> tag by using IHTMLDOMNode, but i found i can't exactly parsing every <param> tag. The sample tags: <OBJECT type="text/sitemap"> <param name="Keyword" value="Add method"> <param name="Name" value="Add Method (VBA Add-In Object Model)"> <param name="Local" value="html/vamthaddinadd.htm"> <param name="Name" value="Add Method (Visual Basic Extensibility)"> <param name="Local" value="html/vbmthadd.h...

xsd.exe Object reference not set to an instance of an object.
I am trying to generate a class from an xsd and i get this error. Microsoft (R) Xml Schemas/DataTypes support utility [Microsoft (R) .NET Framework, Version 1.1.4322.573] Copyright (C) Microsoft Corporation 1998-2002. All rights reserved. Error: Error generating classes for schema 'adf_message'. - Object reference not set to an instance of an object. If you would like more help, please type "xsd /?". The XSD files all validate in VS.Net and in XMLspy. I can't find any documentation to help track down what this means or how to correct this. Could someone point me i...

transparent object does not print out transparent
I have created a circle (with the circle tool) that has varient shading. It's orange in the center and fades out to transparent. I have a second object sitting behind my circle. While I am working on the document, the object appears as I have designed it, but whent I go to print, the object becomes solid and the transparent part becomes white, hiding the second object behind. Can anyone help me figure out how to print it out as a transparent object? Thanks! This is a known bug in Publisher 2002/2003 along with the rest of Office XP/Office 2003. Group the objects together, then ...

How is tabbed view accomplished in VC++ 6?
Hi folks, Looking at the resource editor in VC++ 6, it is not very clear how to add multiple sets of resources, one per tabbed view. Is this something that is not possible in version 6 of VC++? Thanks. Snuffelluffogus wrote: > Hi folks, > > Looking at the resource editor in VC++ 6, > it is not very clear how to add multiple sets > of resources, one per tabbed view. > > Is this something that is not possible in version 6 > of VC++? > > Thanks. On the 'Insert' menu select 'Resource'. Is this what you are looking for? -- Scott McPhillips...

macro for Tab colour change
This is what i have but the problem is when i type something in cell the Tab changes colour this is good & when i clear cell i want Tab to go back to its original colour is this possible Private Sub Workbook_SheetChange(ByVal Sh As Object, _ ByVal Target As Range) If Intersect(Target, Range("B300")) Is Nothing Then Exit Sub ActiveSheet.Tab.ColorIndex = 15 End Sub You could try this... Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) If Intersect(Target, Range("B300")) Is Nothing Then ActiveSh...