Re: PreCreateWindow() & CListBox
".rhavin grobert" <clqrq@yahoo.de> wrote in message
news:1191271158.355053.61800@o80g2000hse.googlegroups.com...
On Oct 1, 9:37 pm, "Mark Salsbery [MVP]"
<MarkSalsbery[MVP]@newsgroup.nospam> wrote:
".rhavin grobert" <cl...@yahoo.de> wrote in message
news:1191266548.093000.160770@y42g2000hsy.googlegroups.com...
On Oct 1, 8:20 pm, "Mark Salsbery [MVP]"
<MarkSalsbery[MVP]@newsgroup.nospam> wrote:
It looks like you're removing the LBS_OWNERDRAWVARIABLE style and
adding the LBS_OWNERDRAWFIXED style.
er... yes, that's what i meant ;-)
Also, the last param to ModifyStyle() is NOT a bool.
I know, but for testing purposes 'twas enough. WS_VISIBLE, if you
prefer. It only has to be something != 0.
Why not 0? You should only use non-0 if you want to specify flags.
currently sitting at my girlfriends computer i cant look into the mfc-
sourcecode, but it is something linke
if (flags != NULL) {
::SetWindowPos(/* some flags i need */ | flags);
}
SetWindowPos() is only called if flags is non-0. That still doesn't make
"true" an appropriate value to pass., unless true maps to the flag you want
passed to SetWindowPos(), in which case "true" just makes your code kinda
cryptic :)
I don't believe PreCreateWindow() will be called for a subclassed
control created from a dialog resource.
In my CButton deriviation it gets called...
Then why did you state "the PreCreateWindow() is not called at
all;-\"??
We're talking 'bout CListBox.
You can try Tom's suggestion, but I don't know if you'll get an
OnCreate()
for a dialog resource control either.
Some styles cannot be changed after a control is created....I'm not sure
if
that applies here - it's not documented.
thats why i want to change them *before* the control is created...
If it's a resource, why not set the style in the resource file?
An "explanation" for CButton: Try to have an ownerdrawn checkbox;-)
I want to have the flags usable, thats why i would like to do
something like:
(1) Read flags
(2) Modify flags according to need of derived class.
(3) Create window
(4) Use original flags in deriviation if useful
I'm not sure how you're going to do this if the control is part of a dialog
resource. In that case, the first time you have access to the control is
after it's created. At that time, as I already mentioned, I'm not sure if
you're allowed to change those particular styles. The first chance you get
to do so, however is in PreSubclassWindow().
What makes you think it wasn't working BTW?
--
Mark Salsbery
Microsoft MVP - Visual C++