Custom owner-drawn controls

Hi guys!

I'm having a bit of trouble with my owner-drawn custom controls in MFC.
If there are other control on top of my custom controls, they are hidden.

How can I fix this?
Should  I use GetNextWindow in OnPaint and tell all the controls to draw 
themselves?
Or is there another way? or maybe i'm doing something wrong here...

Any idea appreciated,
Thanks
0
Dani (39)
6/12/2007 2:36:02 PM
vc.mfc 33608 articles. 0 followers. Follow

15 Replies
666 Views

Similar Articles

[PageSpeed] 37

What do you mean by other controls on top of my control?

Sibiling controls should not overlap each other, if a control is supposed to 
overlap another control, then the control that is on top should be a child 
of the control below it.


AliR.


"Dani" <Dani@discussions.microsoft.com> wrote in message 
news:45CA6671-DC3E-460D-901E-96BEE18B88AB@microsoft.com...
> Hi guys!
>
> I'm having a bit of trouble with my owner-drawn custom controls in MFC.
> If there are other control on top of my custom controls, they are hidden.
>
> How can I fix this?
> Should  I use GetNextWindow in OnPaint and tell all the controls to draw
> themselves?
> Or is there another way? or maybe i'm doing something wrong here...
>
> Any idea appreciated,
> Thanks 


0
AliR3470 (3236)
6/12/2007 2:40:09 PM
Thanks for the reply! :-)

But look at the Tab control in MFC. Try to put some controls over it.
You can see them... And they are not children of the Tab control...

"AliR (VC++ MVP)" wrote:

> What do you mean by other controls on top of my control?
> 
> Sibiling controls should not overlap each other, if a control is supposed to 
> overlap another control, then the control that is on top should be a child 
> of the control below it.
> 
> 
> AliR.
> 
> 
> "Dani" <Dani@discussions.microsoft.com> wrote in message 
> news:45CA6671-DC3E-460D-901E-96BEE18B88AB@microsoft.com...
> > Hi guys!
> >
> > I'm having a bit of trouble with my owner-drawn custom controls in MFC.
> > If there are other control on top of my custom controls, they are hidden.
> >
> > How can I fix this?
> > Should  I use GetNextWindow in OnPaint and tell all the controls to draw
> > themselves?
> > Or is there another way? or maybe i'm doing something wrong here...
> >
> > Any idea appreciated,
> > Thanks 
> 
> 
> 
0
Dani (39)
6/12/2007 2:56:02 PM
Which controls? How do you know they are not a child of the tab control?

AliR.


"Dani" <Dani@discussions.microsoft.com> wrote in message 
news:EC032123-CD8C-4C11-815F-ACFF017C87D7@microsoft.com...
> Thanks for the reply! :-)
>
> But look at the Tab control in MFC. Try to put some controls over it.
> You can see them... And they are not children of the Tab control...
>
> "AliR (VC++ MVP)" wrote:
>
>> What do you mean by other controls on top of my control?
>>
>> Sibiling controls should not overlap each other, if a control is supposed 
>> to
>> overlap another control, then the control that is on top should be a 
>> child
>> of the control below it.
>>
>>
>> AliR.
>>
>>
>> "Dani" <Dani@discussions.microsoft.com> wrote in message
>> news:45CA6671-DC3E-460D-901E-96BEE18B88AB@microsoft.com...
>> > Hi guys!
>> >
>> > I'm having a bit of trouble with my owner-drawn custom controls in MFC.
>> > If there are other control on top of my custom controls, they are 
>> > hidden.
>> >
>> > How can I fix this?
>> > Should  I use GetNextWindow in OnPaint and tell all the controls to 
>> > draw
>> > themselves?
>> > Or is there another way? or maybe i'm doing something wrong here...
>> >
>> > Any idea appreciated,
>> > Thanks
>>
>>
>> 


0
AliR3470 (3236)
6/12/2007 3:27:32 PM
Just make a simple test application, add a Tab control, and put some text 
boxes over it.
If you really want put a text box in a way that its half over the Tab, and 
half outside.


There you will see it draws fine.

And as far as I know, each window has its own WM_PAINT processing procedure,
and Windows is supposed to call them in the right order...

But as I said, its not working well...

"AliR (VC++ MVP)" wrote:

> Which controls? How do you know they are not a child of the tab control?
> 
> AliR.
> 
> 
> "Dani" <Dani@discussions.microsoft.com> wrote in message 
> news:EC032123-CD8C-4C11-815F-ACFF017C87D7@microsoft.com...
> > Thanks for the reply! :-)
> >
> > But look at the Tab control in MFC. Try to put some controls over it.
> > You can see them... And they are not children of the Tab control...
> >
> > "AliR (VC++ MVP)" wrote:
> >
> >> What do you mean by other controls on top of my control?
> >>
> >> Sibiling controls should not overlap each other, if a control is supposed 
> >> to
> >> overlap another control, then the control that is on top should be a 
> >> child
> >> of the control below it.
> >>
> >>
> >> AliR.
> >>
> >>
> >> "Dani" <Dani@discussions.microsoft.com> wrote in message
> >> news:45CA6671-DC3E-460D-901E-96BEE18B88AB@microsoft.com...
> >> > Hi guys!
> >> >
> >> > I'm having a bit of trouble with my owner-drawn custom controls in MFC.
> >> > If there are other control on top of my custom controls, they are 
> >> > hidden.
> >> >
> >> > How can I fix this?
> >> > Should  I use GetNextWindow in OnPaint and tell all the controls to 
> >> > draw
> >> > themselves?
> >> > Or is there another way? or maybe i'm doing something wrong here...
> >> >
> >> > Any idea appreciated,
> >> > Thanks
> >>
> >>
> >> 
> 
> 
> 
0
Dani (39)
6/12/2007 3:55:01 PM
Hi Dani,

Are you trying to overlay controls on the same dialog?  If so this will be a 
problem eventually for any kind of control.  I've done the trick where I 
overlay controls then hide or show just the ones that make sense at any 
time, but those dialogs are difficult to maintain.  I'm not sure what the 
rules are for who gets to be on top (Z-order?), but it wouldn't make sense 
to have any control overlap any other control in regular practice.

I'm not sure this is what you are trying to do, just offering up some 
opinion.

I've also had trouble with owner drawn controls where I want to put 
something else on top of it (like a bitmap on top of an owner draw list 
control).  I could never get this to work and just worked around the problem 
(displayed the bitmap OR the list control OR made the bitmap part of the 
list control drawing).

Tom

"Dani" <Dani@discussions.microsoft.com> wrote in message 
news:EC032123-CD8C-4C11-815F-ACFF017C87D7@microsoft.com...
> Thanks for the reply! :-)
>
> But look at the Tab control in MFC. Try to put some controls over it.
> You can see them... And they are not children of the Tab control...
>
> "AliR (VC++ MVP)" wrote:
>
>> What do you mean by other controls on top of my control?
>>
>> Sibiling controls should not overlap each other, if a control is supposed 
>> to
>> overlap another control, then the control that is on top should be a 
>> child
>> of the control below it.
>>
>>
>> AliR.
>>
>>
>> "Dani" <Dani@discussions.microsoft.com> wrote in message
>> news:45CA6671-DC3E-460D-901E-96BEE18B88AB@microsoft.com...
>> > Hi guys!
>> >
>> > I'm having a bit of trouble with my owner-drawn custom controls in MFC.
>> > If there are other control on top of my custom controls, they are 
>> > hidden.
>> >
>> > How can I fix this?
>> > Should  I use GetNextWindow in OnPaint and tell all the controls to 
>> > draw
>> > themselves?
>> > Or is there another way? or maybe i'm doing something wrong here...
>> >
>> > Any idea appreciated,
>> > Thanks
>>
>>
>> 

0
tom.nospam (3240)
6/12/2007 4:10:26 PM
Did you try putting two tab controls on top of each other!?  Try that, then 
see what it will take to make one appear on top of the other.

I am not sure what to tell you.  When it comes to the order in which control 
get drawn is their ZOrder. The ones with lower zorders number get drawn 
last.  Unless something causes a control to redraw itself without the others 
getting chance to redraw themselves, which will make the only control that 
recevied a WM_PAINT message appear to be on top of all other controls.

AliR


"Dani" <Dani@discussions.microsoft.com> wrote in message 
news:03441EE9-A303-44BF-AE17-EC68AACBAE1C@microsoft.com...
> Just make a simple test application, add a Tab control, and put some text
> boxes over it.
> If you really want put a text box in a way that its half over the Tab, and
> half outside.
>
>
> There you will see it draws fine.
>
> And as far as I know, each window has its own WM_PAINT processing 
> procedure,
> and Windows is supposed to call them in the right order...
>
> But as I said, its not working well...
>
> "AliR (VC++ MVP)" wrote:
>
>> Which controls? How do you know they are not a child of the tab control?
>>
>> AliR.
>>
>>
>> "Dani" <Dani@discussions.microsoft.com> wrote in message
>> news:EC032123-CD8C-4C11-815F-ACFF017C87D7@microsoft.com...
>> > Thanks for the reply! :-)
>> >
>> > But look at the Tab control in MFC. Try to put some controls over it.
>> > You can see them... And they are not children of the Tab control...
>> >
>> > "AliR (VC++ MVP)" wrote:
>> >
>> >> What do you mean by other controls on top of my control?
>> >>
>> >> Sibiling controls should not overlap each other, if a control is 
>> >> supposed
>> >> to
>> >> overlap another control, then the control that is on top should be a
>> >> child
>> >> of the control below it.
>> >>
>> >>
>> >> AliR.
>> >>
>> >>
>> >> "Dani" <Dani@discussions.microsoft.com> wrote in message
>> >> news:45CA6671-DC3E-460D-901E-96BEE18B88AB@microsoft.com...
>> >> > Hi guys!
>> >> >
>> >> > I'm having a bit of trouble with my owner-drawn custom controls in 
>> >> > MFC.
>> >> > If there are other control on top of my custom controls, they are
>> >> > hidden.
>> >> >
>> >> > How can I fix this?
>> >> > Should  I use GetNextWindow in OnPaint and tell all the controls to
>> >> > draw
>> >> > themselves?
>> >> > Or is there another way? or maybe i'm doing something wrong here...
>> >> >
>> >> > Any idea appreciated,
>> >> > Thanks
>> >>
>> >>
>> >>
>>
>>
>> 


0
AliR3470 (3236)
6/12/2007 4:16:49 PM
Well I guessed already that i'm trying to do something "unusual"..

As you may have already understood, I wrote a custom control which operates 
like a Tab control, but that one is a beauty... :-)
The problem is that unlike microsofts tab control, this one has issues with 
the other guys sitting on top of him...

"Tom Serface" wrote:

> Hi Dani,
> 
> Are you trying to overlay controls on the same dialog?  If so this will be a 
> problem eventually for any kind of control.  I've done the trick where I 
> overlay controls then hide or show just the ones that make sense at any 
> time, but those dialogs are difficult to maintain.  I'm not sure what the 
> rules are for who gets to be on top (Z-order?), but it wouldn't make sense 
> to have any control overlap any other control in regular practice.
> 
> I'm not sure this is what you are trying to do, just offering up some 
> opinion.
> 
> I've also had trouble with owner drawn controls where I want to put 
> something else on top of it (like a bitmap on top of an owner draw list 
> control).  I could never get this to work and just worked around the problem 
> (displayed the bitmap OR the list control OR made the bitmap part of the 
> list control drawing).
> 
> Tom
> 
> "Dani" <Dani@discussions.microsoft.com> wrote in message 
> news:EC032123-CD8C-4C11-815F-ACFF017C87D7@microsoft.com...
> > Thanks for the reply! :-)
> >
> > But look at the Tab control in MFC. Try to put some controls over it.
> > You can see them... And they are not children of the Tab control...
> >
> > "AliR (VC++ MVP)" wrote:
> >
> >> What do you mean by other controls on top of my control?
> >>
> >> Sibiling controls should not overlap each other, if a control is supposed 
> >> to
> >> overlap another control, then the control that is on top should be a 
> >> child
> >> of the control below it.
> >>
> >>
> >> AliR.
> >>
> >>
> >> "Dani" <Dani@discussions.microsoft.com> wrote in message
> >> news:45CA6671-DC3E-460D-901E-96BEE18B88AB@microsoft.com...
> >> > Hi guys!
> >> >
> >> > I'm having a bit of trouble with my owner-drawn custom controls in MFC.
> >> > If there are other control on top of my custom controls, they are 
> >> > hidden.
> >> >
> >> > How can I fix this?
> >> > Should  I use GetNextWindow in OnPaint and tell all the controls to 
> >> > draw
> >> > themselves?
> >> > Or is there another way? or maybe i'm doing something wrong here...
> >> >
> >> > Any idea appreciated,
> >> > Thanks
> >>
> >>
> >> 
> 
0
Dani (39)
6/12/2007 4:31:03 PM
Can you email me your tab control?  I have theore I want to try.

alir@learnstar.com

AliR.


"Dani" <Dani@discussions.microsoft.com> wrote in message 
news:B8F4ED42-03D1-4A1C-9D3D-B02C6304BAF0@microsoft.com...
> Well I guessed already that i'm trying to do something "unusual"..
>
> As you may have already understood, I wrote a custom control which 
> operates
> like a Tab control, but that one is a beauty... :-)
> The problem is that unlike microsofts tab control, this one has issues 
> with
> the other guys sitting on top of him...
>
> "Tom Serface" wrote:
>
>> Hi Dani,
>>
>> Are you trying to overlay controls on the same dialog?  If so this will 
>> be a
>> problem eventually for any kind of control.  I've done the trick where I
>> overlay controls then hide or show just the ones that make sense at any
>> time, but those dialogs are difficult to maintain.  I'm not sure what the
>> rules are for who gets to be on top (Z-order?), but it wouldn't make 
>> sense
>> to have any control overlap any other control in regular practice.
>>
>> I'm not sure this is what you are trying to do, just offering up some
>> opinion.
>>
>> I've also had trouble with owner drawn controls where I want to put
>> something else on top of it (like a bitmap on top of an owner draw list
>> control).  I could never get this to work and just worked around the 
>> problem
>> (displayed the bitmap OR the list control OR made the bitmap part of the
>> list control drawing).
>>
>> Tom
>>
>> "Dani" <Dani@discussions.microsoft.com> wrote in message
>> news:EC032123-CD8C-4C11-815F-ACFF017C87D7@microsoft.com...
>> > Thanks for the reply! :-)
>> >
>> > But look at the Tab control in MFC. Try to put some controls over it.
>> > You can see them... And they are not children of the Tab control...
>> >
>> > "AliR (VC++ MVP)" wrote:
>> >
>> >> What do you mean by other controls on top of my control?
>> >>
>> >> Sibiling controls should not overlap each other, if a control is 
>> >> supposed
>> >> to
>> >> overlap another control, then the control that is on top should be a
>> >> child
>> >> of the control below it.
>> >>
>> >>
>> >> AliR.
>> >>
>> >>
>> >> "Dani" <Dani@discussions.microsoft.com> wrote in message
>> >> news:45CA6671-DC3E-460D-901E-96BEE18B88AB@microsoft.com...
>> >> > Hi guys!
>> >> >
>> >> > I'm having a bit of trouble with my owner-drawn custom controls in 
>> >> > MFC.
>> >> > If there are other control on top of my custom controls, they are
>> >> > hidden.
>> >> >
>> >> > How can I fix this?
>> >> > Should  I use GetNextWindow in OnPaint and tell all the controls to
>> >> > draw
>> >> > themselves?
>> >> > Or is there another way? or maybe i'm doing something wrong here...
>> >> >
>> >> > Any idea appreciated,
>> >> > Thanks
>> >>
>> >>
>> >>
>> 


0
AliR3470 (3236)
6/12/2007 5:17:48 PM
I went over the whole code again, and there's no drawing where there shouldnt 
be.
If I use SetWindowPos and set it at the bottom (behind everything),
I can access the other controls (write in text boxes etc...) but they are 
not drawing their frames and background.
And if I set the window to be on top of everything else, all the controls 
DRAW OK!
but I cant access them, because of they are actually behind the tab control...

"AliR (VC++ MVP)" wrote:

> Did you try putting two tab controls on top of each other!?  Try that, then 
> see what it will take to make one appear on top of the other.
> 
> I am not sure what to tell you.  When it comes to the order in which control 
> get drawn is their ZOrder. The ones with lower zorders number get drawn 
> last.  Unless something causes a control to redraw itself without the others 
> getting chance to redraw themselves, which will make the only control that 
> recevied a WM_PAINT message appear to be on top of all other controls.
> 
> AliR
> 
> 
> "Dani" <Dani@discussions.microsoft.com> wrote in message 
> news:03441EE9-A303-44BF-AE17-EC68AACBAE1C@microsoft.com...
> > Just make a simple test application, add a Tab control, and put some text
> > boxes over it.
> > If you really want put a text box in a way that its half over the Tab, and
> > half outside.
> >
> >
> > There you will see it draws fine.
> >
> > And as far as I know, each window has its own WM_PAINT processing 
> > procedure,
> > and Windows is supposed to call them in the right order...
> >
> > But as I said, its not working well...
> >
> > "AliR (VC++ MVP)" wrote:
> >
> >> Which controls? How do you know they are not a child of the tab control?
> >>
> >> AliR.
> >>
> >>
> >> "Dani" <Dani@discussions.microsoft.com> wrote in message
> >> news:EC032123-CD8C-4C11-815F-ACFF017C87D7@microsoft.com...
> >> > Thanks for the reply! :-)
> >> >
> >> > But look at the Tab control in MFC. Try to put some controls over it.
> >> > You can see them... And they are not children of the Tab control...
> >> >
> >> > "AliR (VC++ MVP)" wrote:
> >> >
> >> >> What do you mean by other controls on top of my control?
> >> >>
> >> >> Sibiling controls should not overlap each other, if a control is 
> >> >> supposed
> >> >> to
> >> >> overlap another control, then the control that is on top should be a
> >> >> child
> >> >> of the control below it.
> >> >>
> >> >>
> >> >> AliR.
> >> >>
> >> >>
> >> >> "Dani" <Dani@discussions.microsoft.com> wrote in message
> >> >> news:45CA6671-DC3E-460D-901E-96BEE18B88AB@microsoft.com...
> >> >> > Hi guys!
> >> >> >
> >> >> > I'm having a bit of trouble with my owner-drawn custom controls in 
> >> >> > MFC.
> >> >> > If there are other control on top of my custom controls, they are
> >> >> > hidden.
> >> >> >
> >> >> > How can I fix this?
> >> >> > Should  I use GetNextWindow in OnPaint and tell all the controls to
> >> >> > draw
> >> >> > themselves?
> >> >> > Or is there another way? or maybe i'm doing something wrong here...
> >> >> >
> >> >> > Any idea appreciated,
> >> >> > Thanks
> >> >>
> >> >>
> >> >>
> >>
> >>
> >> 
> 
> 
> 
0
Dani (39)
6/12/2007 9:01:01 PM
Hello guys!

I have found the problem!

You have to modify the control's style with WS_CLIPSIBLINGS

WS_CLIPSIBLINGS makes windows automatically clip the other windows' region 
out of the paint region of the window that is behind them.
If you dont use WS_CLIPSIBLINGS, the painting order of the controls is very 
much undefined.

Thanks for the time you invested in this...
C'ya
Daniel


"Dani" wrote:

> Hi guys!
> 
> I'm having a bit of trouble with my owner-drawn custom controls in MFC.
> If there are other control on top of my custom controls, they are hidden.
> 
> How can I fix this?
> Should  I use GetNextWindow in OnPaint and tell all the controls to draw 
> themselves?
> Or is there another way? or maybe i'm doing something wrong here...
> 
> Any idea appreciated,
> Thanks
0
Dani (39)
6/13/2007 7:34:00 AM
Hi Dani,

Glad you got it worked out and thanks for sharing the answer.

Tom

"Dani" <Dani@discussions.microsoft.com> wrote in message 
news:8F8E9273-763E-43A7-B7A1-DA48CEDDD28F@microsoft.com...
> Hello guys!
>
> I have found the problem!
>
> You have to modify the control's style with WS_CLIPSIBLINGS
>
> WS_CLIPSIBLINGS makes windows automatically clip the other windows' region
> out of the paint region of the window that is behind them.
> If you dont use WS_CLIPSIBLINGS, the painting order of the controls is 
> very
> much undefined.
>
> Thanks for the time you invested in this...
> C'ya
> Daniel
>
>
> "Dani" wrote:

0
tom.nospam (3240)
6/13/2007 1:12:26 PM
First, WIndows behavior is a little vague when controls overlap.  Therefore, it is
considered poor practice to have controls overlap such that the pixels that they might
draw will conflict.  Don't do it.
				joe
On Tue, 12 Jun 2007 07:36:02 -0700, Dani <Dani@discussions.microsoft.com> wrote:

>Hi guys!
>
>I'm having a bit of trouble with my owner-drawn custom controls in MFC.
>If there are other control on top of my custom controls, they are hidden.
>
>How can I fix this?
>Should  I use GetNextWindow in OnPaint and tell all the controls to draw 
>themselves?
>Or is there another way? or maybe i'm doing something wrong here...
>
>Any idea appreciated,
>Thanks
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
6/17/2007 8:17:52 PM
That is not the correct approach; normally, you put a dialog in the tab and the controls
are children of the dialog.

Note that even if you take the approach you suggest, then it would be essential to make
all the controls in tab A completely invisible if you move to tab B.  

Note in my earlier post I mentioned that controls that overlap in a way that cause their
pixels to conflict is essentially bad practice.  Thus, a frame (static) or group box
(button) can "overlap" the controls "inside" them because there is no pixel-conflict.  If
there is pixel-conflict, assume your design is wrong, and change it so there is no
pixel-conflict.
					joe
On Tue, 12 Jun 2007 08:55:01 -0700, Dani <Dani@discussions.microsoft.com> wrote:

>Just make a simple test application, add a Tab control, and put some text 
>boxes over it.
>If you really want put a text box in a way that its half over the Tab, and 
>half outside.
>
>
>There you will see it draws fine.
>
>And as far as I know, each window has its own WM_PAINT processing procedure,
>and Windows is supposed to call them in the right order...
>
>But as I said, its not working well...
>
>"AliR (VC++ MVP)" wrote:
>
>> Which controls? How do you know they are not a child of the tab control?
>> 
>> AliR.
>> 
>> 
>> "Dani" <Dani@discussions.microsoft.com> wrote in message 
>> news:EC032123-CD8C-4C11-815F-ACFF017C87D7@microsoft.com...
>> > Thanks for the reply! :-)
>> >
>> > But look at the Tab control in MFC. Try to put some controls over it.
>> > You can see them... And they are not children of the Tab control...
>> >
>> > "AliR (VC++ MVP)" wrote:
>> >
>> >> What do you mean by other controls on top of my control?
>> >>
>> >> Sibiling controls should not overlap each other, if a control is supposed 
>> >> to
>> >> overlap another control, then the control that is on top should be a 
>> >> child
>> >> of the control below it.
>> >>
>> >>
>> >> AliR.
>> >>
>> >>
>> >> "Dani" <Dani@discussions.microsoft.com> wrote in message
>> >> news:45CA6671-DC3E-460D-901E-96BEE18B88AB@microsoft.com...
>> >> > Hi guys!
>> >> >
>> >> > I'm having a bit of trouble with my owner-drawn custom controls in MFC.
>> >> > If there are other control on top of my custom controls, they are 
>> >> > hidden.
>> >> >
>> >> > How can I fix this?
>> >> > Should  I use GetNextWindow in OnPaint and tell all the controls to 
>> >> > draw
>> >> > themselves?
>> >> > Or is there another way? or maybe i'm doing something wrong here...
>> >> >
>> >> > Any idea appreciated,
>> >> > Thanks
>> >>
>> >>
>> >> 
>> 
>> 
>> 
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
6/17/2007 8:20:56 PM
Z-order turns out to not give the necessarily correct guarantees if there is pixel
conflict.  Simple solution: don't let controls overlap!

When you have odd Z-order situations, you must go through additional effort to force the
frames to redraw (e.g., SetWindowPos(...SWP_DRAWFRAME); as an example)

But on the whole, you have some serious issues that have to be addressed if you have
conflicting Z-order.  A common cause is putting some kind of image in a CStatic and
putting other controls on top of it.
						joe

On Tue, 12 Jun 2007 14:01:01 -0700, Dani <Dani@discussions.microsoft.com> wrote:

>I went over the whole code again, and there's no drawing where there shouldnt 
>be.
>If I use SetWindowPos and set it at the bottom (behind everything),
>I can access the other controls (write in text boxes etc...) but they are 
>not drawing their frames and background.
>And if I set the window to be on top of everything else, all the controls 
>DRAW OK!
>but I cant access them, because of they are actually behind the tab control...
>
>"AliR (VC++ MVP)" wrote:
>
>> Did you try putting two tab controls on top of each other!?  Try that, then 
>> see what it will take to make one appear on top of the other.
>> 
>> I am not sure what to tell you.  When it comes to the order in which control 
>> get drawn is their ZOrder. The ones with lower zorders number get drawn 
>> last.  Unless something causes a control to redraw itself without the others 
>> getting chance to redraw themselves, which will make the only control that 
>> recevied a WM_PAINT message appear to be on top of all other controls.
>> 
>> AliR
>> 
>> 
>> "Dani" <Dani@discussions.microsoft.com> wrote in message 
>> news:03441EE9-A303-44BF-AE17-EC68AACBAE1C@microsoft.com...
>> > Just make a simple test application, add a Tab control, and put some text
>> > boxes over it.
>> > If you really want put a text box in a way that its half over the Tab, and
>> > half outside.
>> >
>> >
>> > There you will see it draws fine.
>> >
>> > And as far as I know, each window has its own WM_PAINT processing 
>> > procedure,
>> > and Windows is supposed to call them in the right order...
>> >
>> > But as I said, its not working well...
>> >
>> > "AliR (VC++ MVP)" wrote:
>> >
>> >> Which controls? How do you know they are not a child of the tab control?
>> >>
>> >> AliR.
>> >>
>> >>
>> >> "Dani" <Dani@discussions.microsoft.com> wrote in message
>> >> news:EC032123-CD8C-4C11-815F-ACFF017C87D7@microsoft.com...
>> >> > Thanks for the reply! :-)
>> >> >
>> >> > But look at the Tab control in MFC. Try to put some controls over it.
>> >> > You can see them... And they are not children of the Tab control...
>> >> >
>> >> > "AliR (VC++ MVP)" wrote:
>> >> >
>> >> >> What do you mean by other controls on top of my control?
>> >> >>
>> >> >> Sibiling controls should not overlap each other, if a control is 
>> >> >> supposed
>> >> >> to
>> >> >> overlap another control, then the control that is on top should be a
>> >> >> child
>> >> >> of the control below it.
>> >> >>
>> >> >>
>> >> >> AliR.
>> >> >>
>> >> >>
>> >> >> "Dani" <Dani@discussions.microsoft.com> wrote in message
>> >> >> news:45CA6671-DC3E-460D-901E-96BEE18B88AB@microsoft.com...
>> >> >> > Hi guys!
>> >> >> >
>> >> >> > I'm having a bit of trouble with my owner-drawn custom controls in 
>> >> >> > MFC.
>> >> >> > If there are other control on top of my custom controls, they are
>> >> >> > hidden.
>> >> >> >
>> >> >> > How can I fix this?
>> >> >> > Should  I use GetNextWindow in OnPaint and tell all the controls to
>> >> >> > draw
>> >> >> > themselves?
>> >> >> > Or is there another way? or maybe i'm doing something wrong here...
>> >> >> >
>> >> >> > Any idea appreciated,
>> >> >> > Thanks
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >> 
>> 
>> 
>> 
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
6/17/2007 8:24:28 PM
When I have two controls that would "overlap", I make sure they are disjoint at design
time, and move them at run time to be where I want them (otherwise you have a complete
nightmare).  If I have lots of them, I create an invisible static frame inside the dialog
and resize the dialog (in OnInitDialog) to that size, and the additional controls are set
as invisible and disabled although I place them outside the frame.  In some cases I'll put
the controls inside a frame of their own, and when I move them onto the main (visible)
dialog body I will maintain their relative positions.  I always move the controls I'm
replacing back out.

I have largely abandoned this technique since we got tabbed dialogs, so I think I've only
used it once in Win32 (I used it a lot in Win16).  But I would get these catastrophic
dialogs with seven layers of controls one-on-top-of-the-other, and the first thing I'd do
is rewrite them because they were unmaintainable.  In Win32, I prefer to rewrite them
using a tab control inside.

Otherwise, I make sure that I never have two controls overlapping when there can be a
conflict of the pixels they draw.  In the rare cases where I need overlap, it NEVER
happens at design time, and at runtime there is never more than one control that is
visible and enabled in the same location at the same time.
				joe
On Tue, 12 Jun 2007 09:10:26 -0700, "Tom Serface" <tom.nospam@camaswood.com> wrote:

>Hi Dani,
>
>Are you trying to overlay controls on the same dialog?  If so this will be a 
>problem eventually for any kind of control.  I've done the trick where I 
>overlay controls then hide or show just the ones that make sense at any 
>time, but those dialogs are difficult to maintain.  I'm not sure what the 
>rules are for who gets to be on top (Z-order?), but it wouldn't make sense 
>to have any control overlap any other control in regular practice.
>
>I'm not sure this is what you are trying to do, just offering up some 
>opinion.
>
>I've also had trouble with owner drawn controls where I want to put 
>something else on top of it (like a bitmap on top of an owner draw list 
>control).  I could never get this to work and just worked around the problem 
>(displayed the bitmap OR the list control OR made the bitmap part of the 
>list control drawing).
>
>Tom
>
>"Dani" <Dani@discussions.microsoft.com> wrote in message 
>news:EC032123-CD8C-4C11-815F-ACFF017C87D7@microsoft.com...
>> Thanks for the reply! :-)
>>
>> But look at the Tab control in MFC. Try to put some controls over it.
>> You can see them... And they are not children of the Tab control...
>>
>> "AliR (VC++ MVP)" wrote:
>>
>>> What do you mean by other controls on top of my control?
>>>
>>> Sibiling controls should not overlap each other, if a control is supposed 
>>> to
>>> overlap another control, then the control that is on top should be a 
>>> child
>>> of the control below it.
>>>
>>>
>>> AliR.
>>>
>>>
>>> "Dani" <Dani@discussions.microsoft.com> wrote in message
>>> news:45CA6671-DC3E-460D-901E-96BEE18B88AB@microsoft.com...
>>> > Hi guys!
>>> >
>>> > I'm having a bit of trouble with my owner-drawn custom controls in MFC.
>>> > If there are other control on top of my custom controls, they are 
>>> > hidden.
>>> >
>>> > How can I fix this?
>>> > Should  I use GetNextWindow in OnPaint and tell all the controls to 
>>> > draw
>>> > themselves?
>>> > Or is there another way? or maybe i'm doing something wrong here...
>>> >
>>> > Any idea appreciated,
>>> > Thanks
>>>
>>>
>>> 
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
6/17/2007 8:29:27 PM
Reply:

Similar Artilces:

How do I find the location of the font control in Win XP
Hi All, I'd like to change my fonts every now and then but don't know where to find them. Could someone please tell me where they are an how to use them? Thanks, Don Don, This newsgroup deals with Microsoft Access, a relational database application. You'll have better luck posting this on a newsgroup related to Windows Fonts. Try... microsoft.public.word.printingfonts -- hth Al Campagna Microsoft Access MVP http://home.comcast.net/~cccsolutions/index.html "Find a job that you love... and you'll never work...

Control Access to groups of contacts
I have a client who wants to have a master contact list so he can see the entire list. He has a handful of clients who will need to be able to view overlapping subsets of those contacts, but should not be able to view the entire list. Can access control be applied at this granularity? User Attributes or other Security groups are acceptible components of this access control. For instance, UserA needs to see contacts 1, 3 and 5 UserB needs to see contacts 1, 2, and 3 UserC needs to see contacts 2, 4, and 5 UserD needs to see contacts 1, 3, 4, and 5 ...

OnEvent Click and Tab Controls
Good Day All.. I have an issue that I had posted previously but it did not get resolved. It may partially be my fault for not explaining my need/question correctly. I have a form. The form contains a subform. & a tab control. The subform has 3 fields listed for the user: ShipTo, BillTo & Account Name The tab control has 3 tabs. The first tab is where I am struggling right now. I want the user to select ('click') on the "account" in the subform (data sheet) at the top. Once they click the "account" the fields on the tab control will then fill wit...

>> Calendar Control drag to select range
Hi, using MS Access 2003, is it possible to allow a user to drag to select a range of dates and, if 'yes', how do you store the selected date range? Many thanks, Jonathan Not that I know of. Storing a range of dates is quite simple though. You store the start date and the end date and use a calculation to show all the dates between. -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "Jonathan" <Jonathan@discussions.microsoft.com> wrote in message news:4F22299F-3765-40D2-AA03-67FB42FFC07A@microsoft.com... > ...

Create an instance of new Customized entity by Workflow
I created an entity named E1 under Account entity(Many-to-1 relationship with Account) then I want to create a workflow Rule that after creating an Account an instance of E1 entity is created automatically. It seems Activity creation is possible in workflow automatically! Is any soloution for this issiue? -- Mohsen Ahmadi you can create activities but not custom entities. You would need to either do this by using a callout or by creating a workflow .net assembly that can create the custom entity for you. ======================= John O'Donnell Microsoft CRM MVP http://codegallery.g...

Cview and Tree control
I have an MDI application which renders opengl scenes in a document. The CView class continously calls opengl library and paints the scene. Here is a screenshot: http://limefocus.net/screenshot.jpg I would like to add a tree control inside the document to manupilate the image generated in the CView. Is it possible to embed a tree control in a CDocument? Thanks. Jess You are mixing the paradigms here. A document does not care how its data is represented. Question you shoud ask is if you can put a tree control in your view. The answer is : absolutely. You can use a splitter to put a t...

Control Button
Hello I need some help with a form. What I am trying to do is, to place a button on a form in MS Access so that when you click on it, in another field it will display a number one. If you click on the same button again it will change the one to a two and so on. Wes Private Sub YourCommandButton_Click() YourTextBox = YourTextBox + 1 End Sub -- There's ALWAYS more than one way to skin a cat! Answers/posts based on Access 2000 Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200705/1 "Wes Derhak" <derhak.wg@shaw.ca&...

customized views disappear
Every so often my customized views for various folders just disappear. I've created them by copying the current view and modifying the copy, but periodically my copies disappear from the View menu. It seems to pick on my Tasks views regularly, while other customized views (e.g. mail) are fine. This is an Outlook 2002 w/Exchange server environment. Any ideas? ...

Customer Statement Crystal Report
Hi! Does anyone have a Customer Statement in Crystal format? Thanks -- Marisol Mortera Marisol, Your question is very generic. If you could be a little more precise, then I might have what you need. Girish "Marisol" wrote: > Hi! > > Does anyone have a Customer Statement in Crystal format? > > Thanks > -- > Marisol Mortera I am trying to build a crystal report for customer statements as well. The Great Plains one is very difficult to work with. If you have an example of this report in crystal, please email it at staceyleelee@hotmail.com Stacey &quo...

How do you control the color/pattern of a pie chart?
I need help with my pie charts. I need to create pie charts that are easily understood in B&W. How do I set the color or pattern for each portion of my pie chart? Hi, To format a slice you need to select it first. Click the pie once to select all slices. Click again to select individual slice. You can use the Fill Effects > Patterns to fill with b/w patterns. Also in print preview the Setup dialog has a Print Black & White option on the Chart Tab. Note this is only visible if you have a chart sheet or select the chartobject before print preview. If you are printing chartobje...

Business Portal Customer Logon
Hello all, I just installed business portal for GP 2.5. I setup a login for a customer on it and associated the login to a customer ID in GP. When the customer logs in, there really isn't any customer information displayed. Does anyone have a resource to let me know how to add customer specific content from GP? Want to display items like payment history, contact info, etc. Thanks, Tareef Tareef, Look for this capability in business portal 3.0. 2.5 is not a customer/vendor facing solution, and even though the advanced roles exist, I do not believe it will work as of now. 3.0 shou...

Making custom form default for contacts
Hello: I am a beginner with Outlook. I am a new hire in a department that uses Outlook contact information in a Word Mail Merge process. I am teaching myself how this all works, and have been doing ok, but I am struggling with forms, particularly the form used for contacts. I don't have any problems modifying the form (for example to add FirstName and LastName fields), but I am very confused about how to get Outlook to use my modified form instead of the default custom contacts form. It seems to me that this should be a simple property setting, but I've had no luck tinkering w...

Populate customer through web services
I am trying to import a customer record through dynamics web services and have the following questions: 1. How do I get the customer class information to default for the customer. I am passing in the customer class and the class field populates on the customer but the class information does not default. There is a behaviour on the create customer but it is of type internal. If I change the behaviour on the policy, the customer does not import at all. 2. How do I get the address on the customer card to be imported. I can get the customer addresses to be imported into Great Plains but no...

Printer Control
I have a printer control on my form and when I use it, it prints to the default printer. I would like for it to bring up the screen to allow me to select which printer to use, like when you use the file/print way. thanks Blair Private Sub Command310_Click() On Error GoTo Err_Command310_Click DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70 DoCmd.PrintOut acSelection DoCmd.GoToControl "CloseFemaleCards" Exit_Command310_Click: Exit Sub Err_Command310_Click: MsgBox Err.Description Resume Exit_Command310_Click End Sub This will call the print...

ActiveX control being added to outgoing e-mail?
I have a user running Outlook 2003 via Exchange 2000. All outgoing messages sent by his system apparently have an ActiveX control in them. Any messages I try to open on another machine give the alert "Your current Security settings prohibit running ActiveX controls..." Could this mean the user has a virus? Something else? Any help is appreciated, and a direct reply to me is appreciated as well. Thanks, John M John discovered this was due to bad signature or stationary files in Outlook. I had the same problem with a user and tested this theory. There was indeed some c...

Upgrade CRM 1.2 And Custom
Did somebody upgrade CRM 1.0 to 1.2 with several customization? I would like to know how CRM was after upgrade, and if you had any problem with custom? Regards, Sylvie Mondoux We had customizations and we had to change the isv.config and web.config file because those are replaced during the upgrade. Everything else was left in place in our case. "Sylvie" <anonymous@discussions.microsoft.com> wrote in message news:b7be01c43787$140ceac0$a101280a@phx.gbl... > Did somebody upgrade CRM 1.0 to 1.2 with several > customization? I would like to know how CRM was after > ...

Problem with multiline tab control #2
Hi, I have a problem with a tab control that I just can't seem to figure out. I have a tab control that made multi-line capable with m_ctrlTab.ModifyStyle(TCS_MULTILINE,TCS_MULTILINE); but, ever since I made the change I can't seem to display whichever tab I want upon application startup. It used to be a regular single-line tab (with 5 tabs) but I'm running out of space which is why I need a multiline solution. I have 6 tabs right now, three in one row. My code looks like this: ------------------------------- snip ------------------------------- BOOL Cxxxx:OnInitDialog() { ...

Customization option disappears under settings
Sometimes when we are logged onto Web crm we can see the customizations button on the navigation pane under settings. Other times it has disappeared altogether and the only way to get it back is to delete the temporary internet files. Does anyone know of a permanent solution for this? I assume this is CRM4. Do you also have CRM Outlook client on this machine? I have found that the Customisations option is not always avaliable in the outlook client, and if you have opened outlook before opening the web, the option will not be in the web client. You can change this my editing the isv.c...

Upper Control Limits
I have a line chart that shows 12 months of data and a trend line. I computed the Upper & Lower Control Limits using the Standard Deviation. Is there a way to put these lines on my charts so that when my boss looks at it she can tell if one or more of the points are out of control? Thanks In Advance Wm. William: This link will show you how to build a control chart in Excel. http://processtrends.com/pg_charts_control_chart.htm ....Kelly koday@processtrends.com "williamr" <williamr@discussions.microsoft.com> wrote in message news:64B0E55A-F4F1-4FE9-9566-C9BCCF2...

Show related records for custom entity
I have a custom entity. When I go to History I can not see the related records from contacts, opportunities, etc. They are not rolling up and there is no pick list to show related records or not. Is there a way to change this? Thanks, -Rick M On Fri, 23 Feb 2007 10:33:49 -0800, Rick M <RickM@discussions.microsoft.com> wrote: >I have a custom entity. When I go to History I can not see the related >records from contacts, opportunities, etc. They are not rolling up and there >is no pick list to show related records or not. Is there a way to change >this? > As...

Allow active x controls to run in RMS POS
Hi there. When trying to run drilldown.htm in RMS on my POS computer, I get the error message "Your current security settings prohibit running active x controls on this page", and it doesn't work. It works fine on my back office pc, and I can't find any difference between the IE settings on the two pcs. Where would I find the setting to allow active x controls to run? Cheers Problem solved, windows automatically blocked it because I sent it as an email attachment from my office pc Mheill wrote: > Hi there. > > When trying to run drilldown.htm in RMS on my POS co...

changing schedule owner in report manager
I have a NT user that has created some subscriptions in reporting services that run and email reports and has now left. His account will be disabled. Is there a way to change the owner of these schedules without having to recreate them? Thanks Declare @NewUserID Varchar Declare @OldUserID Varchar Set @OldUser = 'Domain\Olduser' Set @NewUser = 'Domain\Newuser' Select @OldUserID= UserID from dbo.Users where userName = 'Domain \Olduser' ( Assuming the old user still has presence in users table,otherwise keep a leftjoin on subscriptions(ownerid) with ...

Control the day & time in project accounting ( timesheet & equip.
We need to control the time sheet in project accounting as follows: No same time should be allowed to be entered on the timesheet & equipment log for the same project & cost category. In addition, the times should be controlled in way not to allow an employee to work on 2 or 3 projects at the same date & time. In addition, no equipment should be to work in 2 or more projects at the same date & time Thank you -- Joseph Abou Nader MCSA MCBMS Specialist ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes....

Handling Cut (CTRL-C) in a CListCtrl dervied control
Hello, I have a CListCtrl derived control which presents some data. Now, I want to add handling of CTRL-C: When the user presses CTRL-C the text of the currently selected item should be copied to the clippboard. As far as I figured, accelerators are my best option? Am I right or is there an 'easy' neat whay like some OnCTRLCPressed messages? Best regards, Oliver >I have a CListCtrl derived control which presents some data. > >Now, I want to add handling of CTRL-C: >When the user presses CTRL-C the text of the currently selected >item should be co...

Custom format macro?
Can I write a macro to format a number? I have a bunch of cells containing time intervals stored as floating point numbers in units of days. These are not dates, but are stored in the same format. Some examples: 1 1 day 2.5 2.5 days or 2 days, 12 hours 0.125 3 hours 0.020833 30 minutes and so on. These values are calculated. I would like to display them as nnn.n u where "nnn.n" is a floating point number formatted to 1 decimal place and "u" is a character indicating the units (Y=years, D=days, H=hours, M=minutes, S=seconds). The ...