Click 1 button = click 2 button? 
Author Message
 Click 1 button = click 2 button?
Helo,
I have a modal dialog box has 2 buttons(or more).
WHen I click on one button, another button look like being clicked at
the same time.
My concept is : when i click on the button, the framework notifies
this and sends the message to dialog box.  Then the dialog box
sends the message to the "clicked" button.  The clicked button receives
the message and draws itself "lower" to show that it is clicked.
Thus, I guess override CMyDialog::OnCommand(wparam, lparam) can help.
Just ask the dialog box to send "click" message to two buttons at the
same time.
Am i right?
thanks.
rgds.
alan



Thu, 25 Jul 2002 03:00:00 GMT  
 Click 1 button = click 2 button?



Quote:
> I have a modal dialog box has 2 buttons(or more).
> WHen I click on one button, another button look like being clicked
at
> the same time.
> My concept is : when i click on the button, the framework notifies
> this and sends the message to dialog box.  Then the dialog box
> sends the message to the "clicked" button.  The clicked button
receives
> the message and draws itself "lower" to show that it is clicked.
> Thus, I guess override CMyDialog::OnCommand(wparam, lparam) can
help.
> Just ask the dialog box to send "click" message to two buttons at
the
> same time.
> Am i right?

No, you are wrong. It works the other way round. When you click on a
button, the button receives WM_LBUTTONDOWN and captures the mouse.
Then it is painted in 'down' state when mouse is over it and in 'up'
state otherwise. The transition is done in WM_MOUSEMOVE hander STILL
in the button window proc. And only when you release mouse over the
button and thus send WM_LBUTTONUP to it, the button registers a click
and sends WM_COMMAND to your dialog (before that it repaints itself in
'up' state).

What you want to do is quite complicated. My first idea was to
subclass both buttons and whenever one of them receives any mouse
message (and keyboard message, since you can press a button with a
space key) it sends it to the other. But that will confuse the mouse
capture.

Another idea: create one big button and make it owner-drawn, so that
it will paint itself as if there are two buttons with an empty space
between them. DrawFrameControl function will be of great help here.
You'll also need to capture either WM_LBUTTONDOWN / WM_LBUTTONUP or
WM_NCHITTEST to prevent this big button from getting pressed when
clicked between two "pseudobuttons".

With best wishes,
    Igor Tandetnik



Thu, 25 Jul 2002 03:00:00 GMT  
 Click 1 button = click 2 button?
Yes, i forgot one important concept: When a user click on the button,
the OS know it first, then the application framework know it.
The framework know the click is happened WITHIN the RELATED window, that is ,
the button.  The button receive WM_LBUTTONDOWN and draw itself
as "down" state.  

I'll try subclassing first.  This way look more scalable, more buttons
can be added.


: No, you are wrong. It works the other way round. When you click on a
: button, the button receives WM_LBUTTONDOWN and captures the mouse.
: Then it is painted in 'down' state when mouse is over it and in 'up'
: state otherwise. The transition is done in WM_MOUSEMOVE hander STILL
: in the button window proc. And only when you release mouse over the
: button and thus send WM_LBUTTONUP to it, the button registers a click
: and sends WM_COMMAND to your dialog (before that it repaints itself in
: 'up' state).

:What you want to do is quite complicated. My first idea was to
:subclass both buttons and whenever one of them receives any mouse
:message (and keyboard message, since you can press a button with a
:space key) it sends it to the other. But that will confuse the mouse
:capture.



Fri, 26 Jul 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Single click & double click the same button

2. Button with EnableWindow(FALSE) still receives Button Click

3. Help: Detect when right button is clicked above a button

4. Wait for a button click in a while loop

5. Detecting button clicks in NumericUpDown control.

6. Imitate a Button Click

7. Calling a buttons click

8. overriding button click events - help please

9. How to click a button @ designtime?

10. which mouse button clicked over notify icon?

11. Any button click clouses the modal form (C#)

12. Why the DataSet return null after button clicked

 

 
Powered by phpBB® Forum Software