Re: Solved: No border on dynamically created CListCtrl in W2K (fine on XP)



The problem had nothing to do with English or your use of it.

You posted a question which was very complex, but which had no code. It is impossible to
guess, in any language used for interpersonal communication, what is wrong when
insufficient information is given. You were reporting a problem that nobody had seen. I
was willing to take the time to run an experiment, because I have a visiting Win2K box
this week.

But then you posted a note that said you had used ModifyStyle to change the style. It was
not clear that this was something new or had been part of the original problem. There is
a known discontinuity when you call ModifyStyleEx to change the border style, and the
SWP_DRAWFRAME option is required to get the frame to redraw correctly. If someone says
they did this, our first reaction is to point this out (it isn't always obvious), but we
can't point out solutions to partially-stated problems..

I find it all too common that someone reports problem "A". But they don't tell what they
actually DID. So when you poke them, they give 10% of the code involved. Poke some more.
Another 10%. After six or seven interactions, they provide all the code, and the problem
is obvious, but it took three days to get the code. This is so common that I just assume
when someone is providing only pieces of the code that they are omitting something utterly
ciritical which is the REAL source of the problem. Which is what appeared to happen here.

The communication problem had nothing to do with your use of English; had you explained
the same problem in the same way in German, or French, or Swedish, and I spoke those
languages, I would have produced exactly the same response. My reaction was not to your
use of English, but your incomplete communication. (I actually can speak and read German,
but not well enough to communicate highly technical information; it would take me a couple
years to get back up to speed in technical German, which I haven't really used in 40
years).

The title was fine, but it didn't communicate anything useful in terms of diagnosing the
problem.

One thing I learned in a long academic career and later commercial career, dealing with
people from all over the world, including students, colleagues, and customers, is that
there are people who do not communicate well no matter what their native language is. I
once spent two hours talking to a customer in France, walking through a sequence of
operations that resulted in the program hanging, and in the entire two hours he did not
once tell me one of the keystrokes he made, even though we were going
"keystroke-by-keystroke", because "he didn't think it mattered". It turns out it was the
keystroke that set up the situation that caused the hang. I learned this only after I
sent him a version of the program that logged all keystrokes, and examined what the log
contained. What it contained and what he told me he had done differed by one keystroke,
and it was the only important event in the whole transaction. I knew by the early 1970s
that communication skills and language skills are orthogonal. I've had people give
EXCELLENT communication and not spell a single word right or have a recognizable syntax to
their questions, but they gave me all the information that I needed to solve their
problem.

Perhaps I just get frustrated because of the huge number of questions of the form "My
program failed, what did I do wrong?" that appear here. But I've insisted in precision
and completeness in problem statements since my teens, and that was a LONG time ago. (When
I was 18, I even came up with a detailed form for our system operators to report program
failures...with each console light shown, please fill in all the lights that are on--there
were about 20 of them, and they were essential to diagnosing a crash. This was when I was
part of the QA team during one summer). So I tend to react badly to incomplete problem
descriptions.

I've spent years training programmers to report and diagnose problems, and I continue that
training here.

I have dealt with a lot of English-as-secord-language people in my career, and I am
extremely tolerant of these issues. I've spent enough time in Germany with
German-as-a-second-language to know what it feels like. But precision and completeness in
a bug report are not related to language skills. Just communication skills. So don't
think I'm coming down on you because you don't speak English as your primary language.
I've never thought that way.
joe



On Sun, 3 Dec 2006 09:42:39 -0500, "Bob" <bob@xxxxxxxxxx> wrote:

Joe,

The code that I included in my last post was the fix. I thought I made it
clear but, hey, English is not my mother tongue so I might be wrong. There
is a lot of frustration in your responses which is not necessary, I think,
and it seems like you are loosing it and not always paying adequate
attention to what people are saying :)
Please keep in mind that this newsgroup is read/written to by people whose
native language is not always English. For some people, like myself,
writing a single sentence in English is sometimes like writing half a page
in a native language. I guess, we (i.e. non English speaking guys) tend to
be less descriptive and not that clear at times. So, a bit of patience and
"reading between the lines" would be very helpful here. But you can't do
that if you are so frustrated all the time :) Maybe in cases like that it
is better to take a big breath and not to respond? Give it some thought
please.

It is also OK not to know all the answers to the questions asked on this
forum :)

And in retrospect, I still think that even the title of my initial post ("No
border on dynamically created CListCTrl in W2K (fine on XP)") was not that
bad, was it?

Anyway, the following is how I came across the solution/hack/workaround. If
anyone could back this up with theory (e.g. pointers to docs, etc.) I'd
really appreciate it.

I had another problem with the dynamically created CListCtrl. The list
appeared with double borders on XP when it was filled with items and had a
vertical scrollbar. Again, lists created in dialog editor were fine. I
discovered that the dialog removes WS_BORDER style from the list _after_ it
creates it even though WS_BORDER is set in the corresponding resource script
(you can easily verify this in Spy++). So, I decided to do the same: 1)
create the list with WS_BORDER 2) then remove the border with ModifyStyle().
It worked!
Knowing that the dialog does some extra 'magic' when creating list controls
I kind of knew that I was on the right path to solve my previous problem
(i.e. the border issue on W2K). The SWP_FRAMECHANGED/WM_NCCALCSIZE looked
like a good candidate so I went for it.

Bob


"Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in message
news:dl24n29hjn6bd80eit57977rlljgf1lane@xxxxxxxxxx
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'm
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


Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm

Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: Solved: No border on dynamically created CListCtrl in W2K (fine on XP)
    ... clear but, hey, English is not my mother tongue so I might be wrong. ... lists created in dialog editor were fine. ... create the list with WS_BORDER 2) then remove the border with ModifyStyle. ... WM_NCCALCSIZE to be send to the control. ...
    (microsoft.public.vc.mfc)
  • Re: mot de passe root
    ... > I am not trying to misrepresent anything, and I don't believe that I ... The single language I referred to is of course English. ... website, in the bit about mailing lists, to use an appropriate language ...
    (freebsd-questions)
  • Re: 2012 (or sooner) candidate for prez
    ... 'Press 1 for English' is immediately banned. ... speak it or wait at the border until you can. ... When imports are allowed, there will be a 100% import tax on it. ... All foreign aid using American taxpayer money will immediately ...
    (rec.sport.football.college)
  • Re: Me for President
    ... Press 1 for English is immediately banned. ... Speak it or wait at the border until you can. ... people if they want to donate to a disaster fund, ... to be Chief Justice of the Supreme Court. ...
    (rec.gambling.poker)
  • Re: Me for President
    ... Press 1 for English is immediately banned. ... Speak it or wait at the border until you can. ... people if they want to donate to a disaster fund, ... to be Chief Justice of the Supreme Court. ...
    (rec.gambling.poker)