Originally posted by Michael Mattias
View Post
Announcement
Collapse
No announcement yet.
Wm_measureitem
Collapse
X
-
Last edited by Chris Holbrook; 7 Feb 2008, 10:24 AM.
-
I meant not sending a message to the control in question. If you can get a handle to the control (which of course you can), you know everything there is to know about that control.
Leave a comment:
-
Originally posted by Michael Mattias View Post...handle WM_MEASUREITEM in the owner window procedure?
Leave a comment:
-
Why not just handle WM_MEASUREITEM in the owner window procedure?
Leave a comment:
-
You aren't providing enough surrounding code to make it possible to find the problem.
SendMessage will send any message to the control, so if the control isn't getting the message it is likely one of two problems.
- hList is not being defined with the correct handle to the listbox control.
- your subclassing code for the listbox, isn't processing the message correctly.
ie.
If you use:
CASE %our_MEASUREITEM
instead of
CASE %WM_USER + %our_MEASUREITEM
in the subclass routine, then you will miss the message.
The %WM_USER constant should be used only when you define your custom message constant and not elsewhere.
ie.
%our_MEASUREITEM = %WM_USER+100
Then use:
SendMessage hCtrl%, %our_MEASUREITEM
and in the subclass code select case use:
CASE %our_MEASUREITEM
A good way to test to see if a custom message is getting through to your subclass routine, use the BEEP command in the message processing code.
No BEEP, then message never occurs.
Leave a comment:
-
Originally posted by Chris Boss View PostWhen sending messages..
Leave a comment:
-
When sending messages, always read the API docs to see if a return value is needed.
ie.
Code:FUNCTION=SendMessage (hlist, %WM_USER + %our_MEASUREITEM, wparam, lparam) EXIT FUNCTION
Leave a comment:
-
Wm_measureitem
Working on a superclassed Listbox control.
I tried to trap this message in the parent window and send a user message on to the child control so that it could provide the MEASUREITEMSTRUCT.ItemHeight value:
Code:CASE %WM_MEASUREITEM ' pass the message on to the superclassed LB control sendmessage (hlist, %WM_USER + %our_MEASUREITEM, wparam, lparam)
MSDN says: The system sends the WM_MEASUREITEM message to the owner window of combo boxes and list boxes created with the OWNERDRAWFIXED style before sending the WM_INITDIALOG message. As a result, when the owner receives this message, the system has not yet determined the height and width of the font used in the control; function calls and calculations requiring these values should occur in the main function of the application or library.- based upon the font actually used in the Listbox control
- which can be done by the Listbox control itself?
Tags: None
Leave a comment: