|
-
December 19th, 2008, 03:26 PM
#16
Re: Button functions
void CU6b82Dlg::OnDemo()
{
UpdateData (TRUE);
{
m_Sequence="BBB";
m_Sequence2="AAA";
m_Sequence3="CDEF";
m_Sequence4="abcde";
}
UpdateData (FALSE);
}
this is how it appears if the button had a single function...
however I need to make it so when demo is pressed again this firstly clears then a new set of letter appears in the sequences
-
December 19th, 2008, 04:02 PM
#17
Re: Button functions
Ah, so you want to move data from one edit to another. Then, it should be like this:
Code:
void CU6b82Dlg::OnDemo()
{
// take data from controls into variables
UpdateData (TRUE);
CString sequence;
// this is just an example
switch(rand() % 5)
{
case 1: sequence="AAA"; break;
case 2: sequence="BBB"; break;
case 3: sequence="CCC"; break;
case 4: sequence="DDD"; break;
}
// swap data
m_Sequence5 = m_Sequence4;
m_Sequence4 = m_Sequence3;
m_Sequence3 = m_Sequence2;
m_Sequence2 = m_Sequence1;
m_Sequence5 = sequence;
// put data in controls from variables
UpdateData (FALSE);
}
-
December 19th, 2008, 05:35 PM
#18
Re: Button functions
 Originally Posted by cilu
Ah, so you want to move data from one edit to another. Then, it should be like this:
Code:
void CU6b82Dlg::OnDemo()
{
// take data from controls into variables
UpdateData (TRUE);
CString sequence;
// this is just an example
switch(rand() % 5)
{
case 1: sequence="AAA"; break;
case 2: sequence="BBB"; break;
case 3: sequence="CCC"; break;
case 4: sequence="DDD"; break;
}
// swap data
m_Sequence5 = m_Sequence4;
m_Sequence4 = m_Sequence3;
m_Sequence3 = m_Sequence2;
m_Sequence2 = m_Sequence1;
m_Sequence5 = sequence;
// put data in controls from variables
UpdateData (FALSE);
}
I think you have got me confused i simply want a way to get my button to but in information of my choice. It can be anything. But for example the first click will put letters into all four edit boxes
eg
m_Sequence "AAAA"
m_Sequence2"BBBB"
m_Sequence3"CCCC"
m_Sequence4"DDDD"
then if i press demo again it will replace these with for example
m_Sequence "ADAD"
m_Sequence2"ADCA"
m_Sequence3"AGEB"
m_Sequence4"CGEBA"
I simply need to know how when a button is pressed more than once/numerous times, how I set up this function
-
December 20th, 2008, 06:39 AM
#19
Re: Button functions
I think we already gave you enough information to make this work. Here is something more. You should be able to use it:
Code:
void CU6b82Dlg::OnDemo()
{
switch(m_State)
{
case 0:
// do something
break;
case 1:
// do something
break;
case 2:
// do something
break;
case 3:
// do something
break;
case 4:
// do something
break;
}
m_State++;
m_State %= 5;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|