CButton GetState , how to read the press and hold state of a button?
-
Hello, in my aplication using VC** 6.0 , there are two buttons ( + and -) they controls the value of 16 different edit boxes. It's working, but now i want that if you press and hold one these two buttons the value on their respective edit box increases until you release the button. From the help, i read that you can do this using GetState(), with this mask 0x0004, but i can't get it works. here is some code
void CCalibracionDlg::OnBUTTONmas()
{
unsigned int BotonHold=0;
char incremento;
BotonHold=0x0004 & m_Button_mas.GetState();
while (BotonHold != 0)
{
incremento=1;
Decremento_Incremento(incremento);
BotonHold=0x0004 & m_Button_mas.GetState();
}
}this is the code for button "+" . I hope i've explained it well.
-
Hello, in my aplication using VC** 6.0 , there are two buttons ( + and -) they controls the value of 16 different edit boxes. It's working, but now i want that if you press and hold one these two buttons the value on their respective edit box increases until you release the button. From the help, i read that you can do this using GetState(), with this mask 0x0004, but i can't get it works. here is some code
void CCalibracionDlg::OnBUTTONmas()
{
unsigned int BotonHold=0;
char incremento;
BotonHold=0x0004 & m_Button_mas.GetState();
while (BotonHold != 0)
{
incremento=1;
Decremento_Incremento(incremento);
BotonHold=0x0004 & m_Button_mas.GetState();
}
}this is the code for button "+" . I hope i've explained it well.
Why you dont use of
CSpinButtonCtrl
Class?Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )
-
Hello, in my aplication using VC** 6.0 , there are two buttons ( + and -) they controls the value of 16 different edit boxes. It's working, but now i want that if you press and hold one these two buttons the value on their respective edit box increases until you release the button. From the help, i read that you can do this using GetState(), with this mask 0x0004, but i can't get it works. here is some code
void CCalibracionDlg::OnBUTTONmas()
{
unsigned int BotonHold=0;
char incremento;
BotonHold=0x0004 & m_Button_mas.GetState();
while (BotonHold != 0)
{
incremento=1;
Decremento_Incremento(incremento);
BotonHold=0x0004 & m_Button_mas.GetState();
}
}this is the code for button "+" . I hope i've explained it well.
I'm sorry i'm not in VC but as a C-Programmer (kind of) I would suggest: Create a function/method Scroll() that has 1 argument with value 1 (meaning spin down) and -1 (meaning spin up). Intercept the mousebuttondown-message. When the mouse is down, call Scroll() and set a timer such that when it goes off Scroll() is called again. Intercept the mousebuttonup-message. When the mouse is up set the timer off - that's it. If you also intercept the mousewheel-message you can then reroute those to your Scroll() - The user can use the mousewheel to spin. I'm sorry i don't have the code, or maybe better options, but i hope it helps... Rozis
-
Why you dont use of
CSpinButtonCtrl
Class?Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )