|
jpyp wrote: As I stated in my original post, the high word of wParam is 0
I never claimed I could read
That's a BN_CLICKED notification.
It could be because the control received a WM_SETFOCUS message.
I can't recall if a BN_CLICKED gets sent when you send a BM_SETCHECK - if you comment out
that call, do you still get the notification?
I'm not sure why you're worried about it. There's lots of messages that most of us don't handle
or care about. It's much more of a problem when you expect a message and get none
I thought I posted this link, but in case I didn't: Button Messages[^]
This documents how messages are processed by and from a button control (this is documented for
pretty much all Windows controls).
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I do get the same problem if I comment out the SetCheck call. I'll investigate the WM_SETFOCUS idea. I don't that is it but you never know.
The reason I worry so much about it is that I have other controls on this dialog that are supposed to be disabled when the dialog opens. When the user click on the button that I have problem with, these controls are then enabled. My problem is that when I receive this "irritating" message when the dialog opens, these controls get enabled when they should not be yet because the user has not click on it yet.
Hope I'm making some sense.
Thanks!
jpyp
|
|
|
|
|
jpyp wrote: I'll investigate the WM_SETFOCUS idea. I don't that is it but you never know.
I just know what I read about how the default window proc for a button control handles the
WM_SETFOCUS message:
"Draws a focus rectangle on the button getting the focus. For radio buttons and automatic radio
buttons, the parent window is sent a BN_CLICKED notification message."
So, to back up, you are calling SetCheck(BST_UNCHECKED) for the radio button in question?
Is this an automatic radio button? If so, maybe calling SetCheck(BST_CHECKED) on the radio
button you DO want initially checked would be more appropriate.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
jpyp wrote: I have other controls on this dialog that are supposed to be disabled when the dialog opens.
Unless your resource(s) are frozen (that's a concept with my product), shouldn't you be disabling those at design time, and only enabling them when said button is clicked?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I fixed it!!!!! But before I tell how I fixed it, let me answer your comments/questions. First I'll show how the dialog is designed:
RadButCol1 RadButCol2
PushBut1 EditCol1_1 EditCol2_1
PushBut1 EditCol1_2 EditCol2_2
PushBut1 EditCol1_3 EditCol2_3
PushBut1 EditCol1_4 EditCol2_4
...
PushBut19 EditCol1_19 EditCol2_19
David: At design, I disable all buttons in column 1 and 2 and the two radio buttons are unchecked. So when I open the dialog both columns should be disabled. Then the user should clickone of the radio buttons to enable one set of edit controls. However when the dialog is open, the handler for RadButCol1 is being called automatically and therefore the edit controls of column one get enabled.
Mark: Setting the first push-button as the default button did not help. Also I tried with calling SetFocus() in the OnInitDlg() on PushBut1 so that the RadButCol1 would not have the focus on startup, but that still did not work.
Now the fix (and I still don't know why it worked!!!!):
In my .rc file I moved the declarations of the two radio buttons down so that they are not first in the dialog definition. Being first seems to trigger a BN_CLICKED notification message for some reason. If you have any idea why, please let me know.
I really appreciate your help and time on this issue.
Thanks!
jpyp
|
|
|
|
|
jpyp wrote: ...my handler for that button is called by the framework without any of my code sending a message.
While your code may not be doing it directly, a BM_SETCHECK message is being sent to the control, thus the control's handler is doing what it should. If this is undesirable behavior, there's an easy solution.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: While your code may not be doing it directly, a BM_SETCHECK message is being sent to the control, thus the control's handler is doing what it should. If this is undesirable behavior, there's an easy solution.
By easy solution you mean removing the SetCheck(FALSE) call in OnInitDialog(), I tried that with no difference.
Any other suggestions?
Thanks!
jpyp
|
|
|
|
|
jpyp wrote: By easy solution you mean removing the SetCheck(FALSE) call in OnInitDialog()...
No, I did not mean that at all. Try:
void CMyDialog::CMyDialog()
{
m_bInitializing = true;
}
BOOL CMyDialog::OnInitDialog()
{
CDialog::OnInitDialog();
...
m_bInitializing = false;
return TRUE;
}
void CMyDialog::OnButtonChange()
{
if (! m_bInitializing)
{
}
}
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks for your reply. However this will not help as the handler is being called after OnInitDialog() completes so in OnButtonChange() m_bInitializing will always be FALSE.
This is driving me crazy. This behavior does not happen with my other dialogs.
jpyp
|
|
|
|
|
jpyp wrote: the handler is being called after OnInitDialog() completes
It almost sounds like UpdateData() is the culprit.
What I don't understand, however, is why this is a problem. I've called SetCheck() within OnInitDialog() in several of my programs and it works fine. Can you explain a bit further what the actual problem is?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I'll investigate the UpdateData() idea.
See my last post to Mark with regard to more explanation on the problem.
Thanks!
jpyp
|
|
|
|
|
Is there any simple way of reading JPEG and TIFF images without using all those big libraries?? My images are no more than 512x512, so the images are pretty small. I would like to know a easy way to read the height, width and pixel data of the image nothing more than that.
Any suggestions??
-thanks
Pavan
|
|
|
|
|
Read the documentation on the File Formats and implement your own code to obtain the width and height and pixel data, if you call that "simple"? Or were you looking for the "Magic" solution?
led mike
|
|
|
|
|
led mike wrote: Read the documentation on the File Formats and implement your own code to obtain the width and height and pixel data
I know from experience how many trips to McD's THAT project takes!
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Why didn't you just use the "magic" solution? You could call yourself "The Great Salsbery"
led mike
|
|
|
|
|
I would only use those powers for evil
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
led mike wrote: Or were you looking for the "Magic" solution?
You mean such like SetDIBitsToDevice ?
|
|
|
|
|
Now why would you give away secrets like that on a public forum like this??
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Mark Salsbery wrote: why would you give away secrets like that on a public forum
Maybe it was a secrect but now its not
|
|
|
|
|
Mark Salsbery wrote: Now why would you give away secrets like that on a public forum like this??
Would you prefer to answer questions in Mark's forum all alone?
|
|
|
|
|
Nah. It's just those magic solutions are scary...luckily I have the worm's wart, frog's breath,
and chicken feet nearby...
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Moak wrote: You mean such like SetDIBitsToDevice?
Pavan Tiruveedhula wrote: without using all those big libraries??
Last time I checked that was part of big library.
led mike
|
|
|
|
|
I would say the least amount of work and impact on your projects would be to use GDI+.
It comes with recent Windows versions and you can load images with a couple lines of code.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Pavan Tiruveedhula wrote: Is there any simple way of reading JPEG and TIFF images without using all those big libraries??
I read your message as decoding an image format into raw RGB values. If you for example take uncompressed TIFF files (see Google), it's a rather simple parsing of file header and reading binary data. For a more complex format like JPEG you would need to implement the complete algorithm for decompressing/transforming... or just use a free library.
Btw, Windows GDI allows you to draw JPEG/PNG image data without manual decoding, see SetDIBitsToDevice. Easy peasy.
Hope it helps.
|
|
|
|
|