|
How do you send a button click message to parent window?
Message I want processed in the parent:
ON_BN_CLICKED(IDC_EDIT_SOMEBTN, OnEditBtn)
In the child:
this->GetParent()->SendMessage(
am I on the right track, what do I need to put in the SendMessage?
|
|
|
|
|
littleGreenDude wrote: ...what do I need to put in the SendMessage?
My first guess would be BM_CLICK .
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
it has to be more than that... that would be sending the BM_CLICK message to the parent window how would the parent window know to associate the click witht he proper control?
|
|
|
|
|
Don't you have to send the message to the control itself ?
Maybe with something like :
CButton* pButton = (CButton*)GetTheButtonFromYourUI();
pButton->SendMessage( ... );
|
|
|
|
|
You send BM_CLICK to the button, which in turn, notifies the parent with a BN_CLICKED notification.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
::SendDlgItemMessage(hWnd,IDC_EDIT_SOMEBTN,BM_CLICK,0,0);
|
|
|
|
|
Use WM_COMMAND .
Please refer here[^] for more information.
Regards,
Paresh.
|
|
|
|
|
littleGreenDude wrote: am I on the right track
yes
GetParent()->SendMessage( WM_COMMAND, MAKEWPARAM(::GetDlgCtrlID( m_hWnd ), BN_CLICKED), (LPARAM)m_hWnd );
|
|
|
|
|
Maybe check out mouse_event()[^] as well.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I have a CTreeCtrl that I disable drawing on using SetRedraw(FALSE) while setting the nodes in an attempt to avoid refresh issues.
If I call DeleteAllItems() after I call SetRedraw(FALSE) and scrollbars had been visible, the refresh that hides the scrollbars still runs even before I call SetRedraw(TRUE) etc...
Ultimately, after I've rebuilt the tree, the scrollbars will usually still be needed and once again resurface. If the visible state of the scrollbars will be the same before and after I rebuild the tree, it would be desireable to completely disable the scrollbar refresh until the rebuild is completed.
Is there a way to completely disable redrawing, even with the scrollbars in a CTreeCtrl during tree refreshes?
|
|
|
|
|
What is the best way to detect if a user presses the L button down and releases it within a specified region on a dialog? The way I'm considering doing it is to use the OnLButtonDown and OnLButtonUp methods and set a bool flag when the user presses down whilst within this region and when they release the mouse to check this flag and then check if they are still in the region. Is this the best/recommended way of doing it or is there better more effient ways?
TIA,
|
|
|
|
|
AFAIK, this is the one... But you have to use the SetCapture also.
- NS -
|
|
|
|
|
cheers, I implemented it as I described but also used SetCapture and ReleaseCapture and it worked a treat
|
|
|
|
|
Detect a LButtonDown over the region, capture the mouse when this happens, and then wait for the LButtonUp message. If the LBU is over the region, react.
Watch out for things like (De)activate and/or kill focus messages - if the user switches apps while holding down the mouse button, you will need to release the capture.
The reason you do not want to just react to LBU is that the user could click and hold the mouse button down, and then drag it over to your app and release. This happens a lot by accident and you would not want to react to that accident. Try that with a standard button control and you will see what I mean.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
hi, i got an I/O Completion Port question , one of socket called WSARecv(...) and waiting in GetQueuedCompletionStatus( ... ) .
While waiting, can i call WSASend(...) to send data to the socket ? Can buffer conflict if both WSARecv , WSASend return by GetQueuedCompletionStatus( ... ) at the same time by different thread ? If so , how can i prevent that? Thank you.
|
|
|
|
|
unknown101 wrote: Can buffer conflict if both WSARecv , WSASend
We cannot no the answer for any memory your code is managing. The kernel buffers should not be a problem.
unknown101 wrote: If so , how can i prevent that?
Using synchronization.
|
|
|
|
|
Hi,
My project has a Modal dialog box(first dialog box)
1)First dialog box consist of a button, on clicking that button another modal dialog box(second dialog box) opens.
2)First dialog box also consist of tab control which consist of two tabs.Each tab has modelless dialog box.
My question is when i open the second dialog box(opens on pressing the button) the control will be with second dialog box as it is a modal dialog box but when i place it on one of the tab dialog box(the dialog size of the second dialog box is smaller than the dialog box on the tab) and a mouse click on the tab dialog box the control goes to tab dialog box,.Why?? How to avoid this. The second dialog box should have the control until i close it.
I hope you people got my quesion.
Thanks in advance
|
|
|
|
|
What is the parent/owner relationship between the first and second modal dialog boxes?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks for reply.
First dialog box is a main application(User interface for the user).second dialog box is, if the user wants to change the COM port settings like baud rate or parity he has to open second dialog box which can be opened by pressing the button on the main application.
|
|
|
|
|
It matters not what they are used for. What is the parent/owner relationship between the first and second modal dialog boxes? Just because dialog A opens dialog B, that does not also imply that dialog A is the parent of dialog B, or that dialog B is owned by dialog A.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
You are asking style of the window. Both are popup window style.
I hope i have answered your question if not let me know in detail.Am not getting what does parent/owner relationship means.Even tab windows are popup style.
|
|
|
|
|
We should not have popup window style for dialog box??
This is the settings for main application
STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE |
WS_CAPTION | WS_SYSMENU
Second modal dialog box
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
|
|
|
|
Ok.
Are you using resource editor? or coding all by yourself?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Am using resource editor(MFC SDI project)
|
|
|
|
|
Then in the button to do the call, try it like:
void CMyButton::OnClick ()
{
CMySecondDlg newDlg;
if (IDCANCEL == newDlg.DoModal ())
return;
}
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|