Discussion:
CreateWindow COMBOBOX without any CBS_ style set : what am I getting ?
(too old to reply)
R.Wieser
2022-12-24 07:35:06 UTC
Permalink
Hello all,

I'm putting a combobox onto a dialog using CreateWindowEx, only setting the
WS_VISIBLE and WS_CHILD styles (no CBS_* ones). As a result I get something
that looks the same as if I specified the CBS_DROPDOWN style.

Question : what am I actually getting / whats the difference between no
style and the CBS_DROPDOW one ?

Regards,
Rudy Wieser
JJ
2022-12-25 17:12:35 UTC
Permalink
Post by R.Wieser
Hello all,
I'm putting a combobox onto a dialog using CreateWindowEx, only setting the
WS_VISIBLE and WS_CHILD styles (no CBS_* ones). As a result I get something
that looks the same as if I specified the CBS_DROPDOWN style.
Question : what am I actually getting / whats the difference between no
style and the CBS_DROPDOW one ?
Regards,
Rudy Wieser
Considering that a combobox can only have 3 main styles where all of them
are non zero, it has to have a default style to represent style with zero
value. That default style is CBS_SIMPLE. Whether CBS_SIMPLE is specified or
not when the control is created, and whether the style value of the created
control actually has CBS_SIMPLE or not. It's kind of weird, but that's just
how it is.

Some controls would complain if they're created with an invalid style, but
at least combobox, doesn't complain.
R.Wieser
2022-12-25 18:49:39 UTC
Permalink
JJ,
Post by JJ
Considering that a combobox can only have 3 main styles where all
of them are non zero, it has to have a default style to represent
style with zero value.
:-) You're working your way back from the answer to the question, instead
of starting with the question and try to figure out what the answer is.

So no, I don't agree with either. 3 is not some magical number and a
"default style" is, to me, just the 'unspecified behaviour' you're left with
when you've handled all specified cases.
Post by JJ
It's kind of weird, but that's just how it is.
I know it is. Starting with two style values doing the exact same thing is
odd. I could have accepted it at the end of the range (styles 4 and
higher - there seem to room for 16 styles), but not the start. Thats why I
was asking. :-)

Regards,
Rudy Wieser
JJ
2022-12-26 00:00:44 UTC
Permalink
Post by R.Wieser
I know it is. Starting with two style values doing the exact same thing is
odd. I could have accepted it at the end of the range (styles 4 and
higher - there seem to room for 16 styles), but not the start. Thats why I
was asking. :-)
Regards,
Rudy Wieser
Well, only Microsoft knows why the main style value starts from 1 instead of
0.
R.Wieser
2022-12-26 06:44:03 UTC
Permalink
Post by JJ
Well, only Microsoft knows why the main style value starts from 1
instead of 0.
I was hoping someone else, hopefully present in this newsgroup, would know
too. Alas.

By the way, I probably will throw all the 16 values at it to see if I can
spot a pattern. Perhaps I will even find another undocumented style !

And thanks for the reply - even though I seldom seem to be agreeing with you
... :-)

Regards,
Rudy Wieser

Loading...