Re: Solved: No border on dynamically created CListCtrl in W2K (fine on XP)
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Sat, 02 Dec 2006 18:25:57 -0500
I note that at no time had you previously posted that you called ModifyStyle(Ex). The
answer would have been obvious.
Keep in mind when asking questions
(a) ask the question you have in mind
(b) provide ALL the information about the problem
(c) provide a suitable code example.
You gave a partial code example (horrendously incomplete, in retrospect). It is not
surprising that, given the rather incomplete information, that nobody had ever seen your
problem. You'd never described your problem! You waved your hands in a vague way about
some unspecified code.
joe
On Sat, 2 Dec 2006 13:56:44 -0500, "bob" <bob@xxxxxxxxxx> wrote:
I think I finally got it. It works on 2 different W2K machines so I'mJoseph M. Newcomer [MVP]
assuming that I'll be OK.
The key seems to be SWP_FRAMECHANGED flag in ModifyStyle(Ex). So, after the
control is created I call ModifyStyle() and provide the flag to force
WM_NCCALCSIZE to be send to the control. Dialogs must be doing that too
although I'm not certain about it. I also had to remove WS_BORDER so the
control does not have a 'double' border under XP (but this is another
story). My current code to create the control is as follows:
DWORD dwStyle = LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER |
LVS_ALIGNLEFT | WS_TABSTOP;
DWORD dwExStyle = WS_EX_CLIENTEDGE;
BOOL bRet = m_pwndList->CreateEx(dwExStyle, dwStyle, rect, this, IDC_LIST);
m_pwndList->ModifyStyle(WS_BORDER, 0, SWP_SHOWWINDOW | SWP_FRAMECHANGED);
It works fine now on both XP and W2K.
Many thanks to all of you who tried to help me.
Bob
"bob" <bob@xxxxxxxxxx> wrote in message
news:u75BhYbFHHA.5104@xxxxxxxxxxxxxxxxxxxxxxx
I've run into this weird problem with CListCtrl in report view. I need to
create the list dynamically using new() and Create() in OnInitDialog().
The problem is that on W2K the list appears without a border when it is
empty or not completely filled with items. When the number of items is
greater than can be shown (i.e. a scrollbar appears on the right side) the
border is displayed fine.
The same code works fine on XP.
And, of course, lists - empty or filled - placed on dialogs at design time
have always worked fine for me. I used Spy++ to compare window styles of
list controls created in a dialog editor with styles of the dynamically
created one and did not see any differences.
Has anyone run into this problem? I'd appreciate _any_suggestions.
Thanks,
Bob
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- Follow-Ups:
- References:
- Prev by Date: Re: A question regarding use of the Test Container to check ActiveX controls
- Next by Date: Re: No border on dynamically created CListCtrl in W2K (fine on XP)
- Previous by thread: Re: Solved: No border on dynamically created CListCtrl in W2K (fine on XP)
- Next by thread: Re: Solved: No border on dynamically created CListCtrl in W2K (fine on XP)
- Index(es):
Relevant Pages
|