| Newsgroups |
gmane.comp.windows.wtl |
| Message-ID |
<CAK3Hp+-DrCuCx2s3Xv31_d5jKgMrUGARP43ydbUCO4T_cnu-Jw@mail.gmail.com> |
--e89a8ff1bfd0e2d313052a8bcea4
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Hi Gil,
This happens because WTL by default uses WS_CLIPCHILDREN and
WS_CLIPSIBLINGS styles when creating control windows. In most cases that is
preferred, but it this particular case it causes a problem. The dialog
created from resources doesn't use those styles.
To change that, you need to change window traits used for creating
controls. Traits are a template argument for CMemDlgTemplateT class, which
itself is a template argument for CIndirectDialogImpl. So, instead of
declaring your class as:
class CAboutDlgIndirect : public CIndirectDialogImpl<CAboutDlgIndirect>
you should declare it as:
class CAboutDlgIndirect : public CIndirectDialogImpl<CAboutDlgIndirect,
CMemDlgTemplateT<CWinTraits<WS_CHILD | WS_VISIBLE, 0> > >
and the painting problem will go away.
Cheers,
Nenad
On Fri, Jan 29, 2016 at 6:42 AM, [email protected] [wtl] <[email protected]>
wrote:
>
>
> I've added an edit box and an up-down control to the AboutBox in the
> MemDlg sample. The edit is readonly with right aligned text; the spin
> control is auto-buddy, left attached, set buddy integer. It results in th=
e
> following code in the MemDlg.rc
>
> // in MemDlg.rc
>
> IDD_ABOUTBOX DIALOGEX 0, 0, 187, 102
> STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
> CAPTION "About"
> FONT 8, "MS Shell Dlg 2", 0, 0, 0x0
> BEGIN
> DEFPUSHBUTTON "OK",IDOK,130,81,50,14
> CTEXT "MemDlg Application v1.0\n\n(c) Copyright
> 2015",IDC_STATIC,25,57,78,32
> ICON IDR_MAINFRAME,IDC_STATIC,55,26,20,20
> GROUPBOX "",IDC_STATIC,7,7,115,88
> EDITTEXT IDC_EDIT1,125,39,40,14,ES_RIGHT | ES_AUTOHSCROLL |
> ES_READONLY
> CONTROL "",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT |
> UDS_ALIGNLEFT | UDS_AUTOBUDDY | UDS_ARROWKEYS,169,39,11,14
> END
>
>
> I copied the last controls to the indirect about box, as follows,
>
> // in AboutDlgIndirect.h
>
> BEGIN_CONTROLS_MAP()
> CONTROL_DEFPUSHBUTTON(_T("OK"), IDOK, 130, 81, 50, 14, 0, 0)
> CONTROL_CTEXT(_T("MemDlg Application v1.0\n\n(c) Copyright 2015")=
,
> IDC_STATIC, 25, 57, 78, 32, 0, 0)
> CONTROL_ICON(MAKEINTRESOURCE(IDR_MAINFRAME), IDC_STATIC, 55, 26,
> 18, 20, 0, 0)
> CONTROL_GROUPBOX(_T(""), IDC_STATIC, 7, 7, 115, 88, 0, 0)
> CONTROL_EDITTEXT(IDC_EDIT1, 125, 39, 40, 14, ES_RIGHT |
> ES_AUTOHSCROLL | ES_READONLY, 0)
> CONTROL_CONTROL(_T(""), IDC_SPIN1, _T("msctls_updown32"),
> UDS_SETBUDDYINT | UDS_ALIGNLEFT | UDS_AUTOBUDDY | UDS_ARROWKEYS, 169, 39,
> 11, 14, 0)
> END_CONTROLS_MAP()
>
>
> When running, the usual about box display correctly, but the indirect box
> has a glitch in the display of the spin control.
>
>
> Any ideas?
>
>
> Gil Rivlis
>
>
>
>=20
>
--e89a8ff1bfd0e2d313052a8bcea4
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<head>
<style type=3D"text/css">
<!--
/* start of attachment style */
.ygrp-photo-title{
clear: both;
font-size: smaller;
height: 15px;
overflow: hidden;
text-align: center;
width: 75px;
}
div.ygrp-photo{
background-position: center;
background-repeat: no-repeat;
background-color: white;
border: 1px solid black;
height: 62px;
width: 62px;
}
div.photo-title=20
a,
div.photo-title a:active,
div.photo-title a:hover,
div.photo-title a:visited {
text-decoration: none;=20
}
div.attach-table div.attach-row {
clear: both;
}
div.attach-table div.attach-row div {
float: left;
/* margin: 2px;*/
}
p {
clear: both;
padding: 15px 0 3px 0;
overflow: hidden;
}
div.ygrp-file {
width: 30px;
valign: middle;
}
div.attach-table div.attach-row div div a {
text-decoration: none;
}
div.attach-table div.attach-row div div span {
font-weight: normal;
}
div.ygrp-file-title {
font-weight: bold;
}
/* end of attachment style */
-->
</style>
</head>
<html>
<head>
<style type=3D"text/css">
<!--
#ygrp-mkp {
border: 1px solid #d8d8d8;
font-family: Arial;
margin: 10px 0;
padding: 0 10px;
}
#ygrp-mkp hr {
border: 1px solid #d8d8d8;
}
#ygrp-mkp #hd {
color: #628c2a;
font-size: 85%;
font-weight: 700;
line-height: 122%;
margin: 10px 0;
}
#ygrp-mkp #ads {
margin-bottom: 10px;
}
#ygrp-mkp .ad {
padding: 0 0;
}
#ygrp-mkp .ad p {
margin: 0;
}
#ygrp-mkp .ad a {
color: #0000ff;
text-decoration: none;
}
-->
</style>
</head>
<body>
<!-- |**|begin egp html banner|**| -->
<br><br>
<!-- |**|end egp html banner|**| -->
<div dir=3D"ltr">Hi Gil,<div><br></div><div>This happens because WTL by def=
ault uses=C2=A0WS_CLIPCHILDREN and WS_CLIPSIBLINGS styles when creating con=
trol windows. In most cases that is preferred, but it this particular case =
it causes a problem. The dialog created from resources doesn't use thos=
e styles.</div><div><br></div><div>To change that, you need to change windo=
w traits used for creating controls. Traits are a template argument for=C2=
=A0CMemDlgTemplateT class, which itself is a template argument for=C2=A0CIn=
directDialogImpl. So, instead of declaring your class as:</div><div><br></d=
iv><div>class CAboutDlgIndirect : public CIndirectDialogImpl<CAboutDlgIn=
direct><br></div><div><br></div><div>you should declare it as:</div><div=
><br></div><div>class CAboutDlgIndirect : public CIndirectDialogImpl<CAb=
outDlgIndirect, CMemDlgTemplateT<CWinTraits<WS_CHILD | WS_VISIBLE, 0&=
gt; > ><br></div><div><br></div><div>and the painting problem will go=
away.</div><div><br></div><div>Cheers,</div><div>Nenad</div><div><br></div=
></div><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Fri, Ja=
n 29, 2016 at 6:42 AM, <a href=3D"mailto:[email protected]">[email protected]</a>=
[wtl] <span dir=3D"ltr"><<a href=3D"mailto:[email protected]" target=
=3D"_blank">[email protected]</a>></span> wrote:<br><blockquote class=
=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd=
ing-left:1ex">
<u></u>
=20
<div style=3D"background-color:#fff">
<span>=C2=A0</span>
<div>
<div>
<div>
=20=20=20=20=20=20
=20=20=20=20=20=20
<p></p><p><span>I've added an edit box and an up-down control to =
the AboutBox in the MemDlg sample. The edit is readonly with right aligned =
text; the spin control is auto-buddy, left attached, set buddy integer. It =
results in the following code in the MemDlg.rc<br></span></p><p>// in MemDl=
g.rc</p><p>IDD_ABOUTBOX DIALOGEX 0, 0, 187, 102<br>STYLE DS_SETFONT | DS_MO=
DALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU<br>CAPTION "About"<=
br>FONT 8, "MS Shell Dlg 2", 0, 0, 0x0<br>BEGIN<br>=C2=A0=C2=A0=
=C2=A0 DEFPUSHBUTTON=C2=A0=C2=A0 "OK",IDOK,130,81,50,14<br>=C2=A0=
=C2=A0=C2=A0 CTEXT=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 "MemDlg Application v1.0\n\n(c) Copyright 2015",IDC_STATIC,25=
,57,78,32<br>=C2=A0=C2=A0=C2=A0 ICON=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0 IDR_MAINFRAME,IDC_STATIC,55,26,20,20<br>=C2=A0=
=C2=A0=C2=A0 GROUPBOX=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ""=
;,IDC_STATIC,7,7,115,88<br>=C2=A0=C2=A0=C2=A0 EDITTEXT=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0 IDC_EDIT1,125,39,40,14,ES_RIGHT | ES_AUTOHSCROLL | ES=
_READONLY<br>=C2=A0=C2=A0=C2=A0 CONTROL=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0 "",IDC_SPIN1,"msctls_updown32",UDS_SETBUDD=
YINT | UDS_ALIGNLEFT | UDS_AUTOBUDDY | UDS_ARROWKEYS,169,39,11,14<br>END<br=
><span></span></p><p><br></p><p>I copied the last controls to the indirect =
about box, as follows,</p><p>// in AboutDlgIndirect.h</p><p>=C2=A0=C2=A0=C2=
=A0 BEGIN_CONTROLS_MAP()<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 CONTROL_D=
EFPUSHBUTTON(_T("OK"), IDOK, 130, 81, 50, 14, 0, 0)<br>=C2=A0=C2=
=A0=C2=A0 =C2=A0=C2=A0=C2=A0 CONTROL_CTEXT(_T("MemDlg Application v1.0=
\n\n(c) Copyright 2015"), IDC_STATIC, 25, 57, 78, 32, 0, 0)<br>=C2=A0=
=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 CONTROL_ICON(MAKEINTRESOURCE(IDR_MAINFRAME)=
, IDC_STATIC, 55, 26, 18, 20, 0, 0)<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=
=A0 CONTROL_GROUPBOX(_T(""), IDC_STATIC, 7, 7, 115, 88, 0, 0)<br>=
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 CONTROL_EDITTEXT(IDC_EDIT1, 125, 39, =
40, 14, ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY, 0)<br>=C2=A0=C2=A0=C2=A0 =
=C2=A0=C2=A0=C2=A0 CONTROL_CONTROL(_T(""), IDC_SPIN1, _T("ms=
ctls_updown32"), UDS_SETBUDDYINT | UDS_ALIGNLEFT | UDS_AUTOBUDDY | UDS=
_ARROWKEYS, 169, 39, 11, 14, 0)<br>=C2=A0=C2=A0=C2=A0 END_CONTROLS_MAP()</p=
><p><br></p><p>When running, the usual about box display correctly, but the=
indirect box has a glitch in the display of the spin control.</p><p><br></=
p><p>Any ideas?</p><p><br></p><p>Gil Rivlis</p><p><br><span></span></p><p><=
br><span></span></p><p></p>
</div>
=20=20=20=20=20
=20=20=20=20
<div style=3D"color:#fff;min-height:0"></div>
</div>
=20=20
</blockquote></div><br></div>
<!-- |**|begin egp html banner|**| -->
<br>
<br>
<!-- |**|end egp html banner|**| -->
<div width=3D"1" style=3D"color: white; clear: both;"/>__._,_.___</div>
=20=20=20=20=20=20
=20=20
=20=20=20=20
<div id=3D"fromDMARC" style=3D"clear:both; margin-top: 10px;">
<hr style=3D"height:2px ; border-width:0; color:#E3E3E3; backgroun=
d-color:#E3E3E3;">
Posted by: =3D?UTF-8?Q?Nenad_Stefanovi=3DC4=3D87?=3D <nenad2001=
@gmail.com> <hr style=3D"height:2px ; border-width:0; color:#E3E=
3E3; background-color:#E3E3E3;">
</div>
<!-- Start Recommendations -->
<!-- End Recommendations -->
<!-- |**|begin egp html banner|**| -->
<img src=3D"http://geo.yahoo.com/serv?s=3D97476590/grpId=3D488621/grpspId=
=3D1705006764/msgId=3D16710/stime=3D1454154845" width=3D"1" height=3D"1"> <=
br>
<!-- |**|end egp html banner|**| -->
=20=20
<!-- |**|begin egp html banner|**| -->
<br>
=20=20=20
=20=20=20=20=20
=20
<!-- |**|begin egp html banner|**| -->
<div id=3D"ygrp-vital" style=3D"background-color: #f2f2f2; font-fam=
ily: Verdana; font-size: 10px; margin-bottom: 10px; padding: 10px;">
<span id=3D"vithd" style=3D"font-weight: bold; color: #333; text-tr=
ansform: uppercase; "><a href=3D"https://groups.yahoo.com/neo/groups/wtl/in=
fo;_ylc=3DX3oDMTJkY2J2MmhxBF9TAzk3MzU5NzE0BGdycElkAzQ4ODYyMQRncnBzcElkAzE3M=
DUwMDY3NjQEc2VjA3Z0bARzbGsDdmdocARzdGltZQMxNDU0MTU0ODQ1" style=3D"text-deco=
ration: none;">Visit Your Group</a></span>
<ul style=3D"list-style-type: none; margin: 0; padding: 0; display: in=
line;">
</ul>
</div>
<div id=3D"ft" style=3D"font-family: Arial; font-size: 11px; margin-top: 5p=
x; padding: 0 2px 0 0; clear: both;">
<a href=3D"https://groups.yahoo.com/neo;_ylc=3DX3oDMTJjNDI4NmEzBF9TAzk3ND=
c2NTkwBGdycElkAzQ4ODYyMQRncnBzcElkAzE3MDUwMDY3NjQEc2VjA2Z0cgRzbGsDZ2ZwBHN0a=
W1lAzE0NTQxNTQ4NDU-" style=3D"float: left;"><img src=3D"http://l.yimg.com/r=
u/static/images/yg/img/email/new_logo/logo-groups-137x15.png" height=3D"15"=
width=3D"137" alt=3D"Yahoo! Groups" style=3D"border: 0;"/></a>
<div style=3D"color: #747575; float: right;"> • <a href=3D"https://i=
nfo.yahoo.com/privacy/us/yahoo/groups/details.html" style=3D"text-decoratio=
n: none;">Privacy</a> • <a href=3D"mailto:wtl-unsubscribe@yahoogroups.=
com?subject=3DUnsubscribe" style=3D"text-decoration: none;">Unsubscribe</a>=
• <a href=3D"https://info.yahoo.com/legal/us/yahoo/utos/terms/" style=
=3D"text-decoration: none;">Terms of Use</a> </div>
</div>
<!-- |**|end egp html banner|**| -->
</div> <!-- ygrp-msg -->
=20=20=20
<br>
<!-- |**|end egp html banner|**| -->
<div style=3D"color: white; clear: both;"/>__,_._,___</div>
</body>
</html>
--e89a8ff1bfd0e2d313052a8bcea4--