SpinControl Help
-
I have a dialog with 6 spin controls on it. The controls are populated with a random number in the OnInitDialog method. Once one of the spin controls is increased I would like to turn off the other 5 so that they can't be changed. If the original control was then later decreased then I need to turn on the all of the controls again so that they may be changed. I have tried to do this the VScroll message handler but it seems that the buddy window is updated before or independant of this message handler. Thanks for the help, -Eric
-
I have a dialog with 6 spin controls on it. The controls are populated with a random number in the OnInitDialog method. Once one of the spin controls is increased I would like to turn off the other 5 so that they can't be changed. If the original control was then later decreased then I need to turn on the all of the controls again so that they may be changed. I have tried to do this the VScroll message handler but it seems that the buddy window is updated before or independant of this message handler. Thanks for the help, -Eric
You might be able to lock out the buddy changing by looking at EN_UPDATE (or is it EN_CHANGE...) Alternatively, turn off the buddying on the other controls with UDM_SETBUDDY (NULL) and re- connect them when your changed spinner goes back to its initial value. Iain.
-
You might be able to lock out the buddy changing by looking at EN_UPDATE (or is it EN_CHANGE...) Alternatively, turn off the buddying on the other controls with UDM_SETBUDDY (NULL) and re- connect them when your changed spinner goes back to its initial value. Iain.
Iain, Thanks for the help. I have used the EN_CHANGE message for each edit control and then I turned off the other spin controls if one was increased. The problem is that when the user clicks up again it will turn them all back on again. Here is a snippet of my code. Any ideas? I want to be able to only increase one of the 6 spin controls then turn off the rest. If the users then decreases the one spin control by one then it needs to turn the other controls back on again.
void CMyDialog::OnChangeEditOne() { if(!bFirstRun) { if(!bOne) { m_cTwo.EnableWindow(FALSE); m_cThree.EnableWindow(FALSE); m_cFour.EnableWindow(FALSE); m_cFive.EnableWindow(FALSE); m_cSix.EnableWindow(FALSE); m_cOk.EnableWindow(TRUE); bOne = TRUE; } else { m_cTwo.EnableWindow(TRUE); m_cThree.EnableWindow(TRUE); m_cFour.EnableWindow(TRUE); m_cFive.EnableWindow(TRUE); m_cSix.EnableWindow(TRUE); m_cOk.EnableWindow(FALSE); bOne = FALSE; } } else bFirstRun = FALSE; }
Thanks again. -Eric -
You might be able to lock out the buddy changing by looking at EN_UPDATE (or is it EN_CHANGE...) Alternatively, turn off the buddying on the other controls with UDM_SETBUDDY (NULL) and re- connect them when your changed spinner goes back to its initial value. Iain.
Iain, Thanks for the help. I have used the EN_CHANGE message for each edit control and then I turned off the other spin controls if one was increased. The problem is that when the user clicks up again it will turn them all back on again. Here is a snippet of my code. Any ideas? I want to be able to only increase one of the 6 spin controls then turn off the rest. If the users then decreases the one spin control by one then it needs to turn the other controls back on again.
void CMyDialog::OnChangeEditOne() { if(!bFirstRun) { if(!bOne) { m_cTwo.EnableWindow(FALSE); m_cThree.EnableWindow(FALSE); m_cFour.EnableWindow(FALSE); m_cFive.EnableWindow(FALSE); m_cSix.EnableWindow(FALSE); m_cOk.EnableWindow(TRUE); bOne = TRUE; } else { m_cTwo.EnableWindow(TRUE); m_cThree.EnableWindow(TRUE); m_cFour.EnableWindow(TRUE); m_cFive.EnableWindow(TRUE); m_cSix.EnableWindow(TRUE); m_cOk.EnableWindow(FALSE); bOne = FALSE; } } else bFirstRun = FALSE; }
Thanks again. -Eric