efficient 'push&hold' button ?
-
i'm trying to implement a button that functions for example the way that the seek or pitchbend controls function on a cd player. that is, you press/'push' it and 'work starts getting done' and 'stops getting done' when/after you release the button. the only way that i know and that works is to check mouse coordinates upon WM_LBUTTONDOWN/UP (since WM_COMMAND gets sent only after you press and depress a button) and compare them with the button position/recantgle and then take appropriate action... but that seems too complicated (calculating, storing & comparing coordinates), is there a simpler way ? thnx :)
-
i'm trying to implement a button that functions for example the way that the seek or pitchbend controls function on a cd player. that is, you press/'push' it and 'work starts getting done' and 'stops getting done' when/after you release the button. the only way that i know and that works is to check mouse coordinates upon WM_LBUTTONDOWN/UP (since WM_COMMAND gets sent only after you press and depress a button) and compare them with the button position/recantgle and then take appropriate action... but that seems too complicated (calculating, storing & comparing coordinates), is there a simpler way ? thnx :)
There are lots of button examples here.
"Take only what you need and leave the land as you found it." - Native American Proverb
-
There are lots of button examples here.
"Take only what you need and leave the land as you found it." - Native American Proverb
DavidCrow wrote:
There are lots of button examples here.
i know, but there are only two examples on this/similar topic. http://www.codeproject.com/cpp/mouserepeat.asp[^] and http://codeproject.com/buttonctrl/repeatbutton.asp[^]. actualy that is only one example since the latter uses the first, and they both use the 'check if in client rectangle on lmbutton down' method and mfc... i'm looking for a perhaps simpler/more efficient method (and with using just win32) ...
-
DavidCrow wrote:
There are lots of button examples here.
i know, but there are only two examples on this/similar topic. http://www.codeproject.com/cpp/mouserepeat.asp[^] and http://codeproject.com/buttonctrl/repeatbutton.asp[^]. actualy that is only one example since the latter uses the first, and they both use the 'check if in client rectangle on lmbutton down' method and mfc... i'm looking for a perhaps simpler/more efficient method (and with using just win32) ...
Anonymous wrote:
i'm looking for a perhaps simpler/more efficient method (and with using just win32) ...
While only partially related, have you seen this?
"Take only what you need and leave the land as you found it." - Native American Proverb
-
Anonymous wrote:
i'm looking for a perhaps simpler/more efficient method (and with using just win32) ...
While only partially related, have you seen this?
"Take only what you need and leave the land as you found it." - Native American Proverb
DavidCrow wrote:
While only partially related, have you seen this?
hmm thanks for the link but i can't find the handling of WM_LMBUTTONDOWN (and checking if it's for the desired button) in the shown code of that example... am i blind or is it somehow hidden/already implemented by mfc ? i found a different approach, explained here http://www.pluralsight.com/articlecontent/cpprep0797.htm[^]. it seems simpler and more logical but to implement it for this purpose the button control, that is it's window, should have it's own window procedure which i could then override to handle WM_LMBUTTONDOWN/UP messages... so my question is do even the buttons have a window procedure ? although when i think about it this approach also isn't as straitforward as it looks, at least not for what i need to use it. in the new wnd procedure i would then have to call GetParent() and then send a message to the parent dialogbox which would then again have to be processed by the dialogbox procedure ... :) in your opinion, which method is more efficient then ? :)
-
DavidCrow wrote:
While only partially related, have you seen this?
hmm thanks for the link but i can't find the handling of WM_LMBUTTONDOWN (and checking if it's for the desired button) in the shown code of that example... am i blind or is it somehow hidden/already implemented by mfc ? i found a different approach, explained here http://www.pluralsight.com/articlecontent/cpprep0797.htm[^]. it seems simpler and more logical but to implement it for this purpose the button control, that is it's window, should have it's own window procedure which i could then override to handle WM_LMBUTTONDOWN/UP messages... so my question is do even the buttons have a window procedure ? although when i think about it this approach also isn't as straitforward as it looks, at least not for what i need to use it. in the new wnd procedure i would then have to call GetParent() and then send a message to the parent dialogbox which would then again have to be processed by the dialogbox procedure ... :) in your opinion, which method is more efficient then ? :)