Click here to Skip to main content
15,890,557 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionButton Caption Pin
shiv@nand26-Mar-10 3:13
shiv@nand26-Mar-10 3:13 
AnswerRe: Button Caption Pin
CPallini26-Mar-10 3:21
mveCPallini26-Mar-10 3:21 
GeneralRe: Button Caption Pin
shiv@nand26-Mar-10 3:31
shiv@nand26-Mar-10 3:31 
GeneralRe: Button Caption Pin
CPallini26-Mar-10 3:39
mveCPallini26-Mar-10 3:39 
GeneralRe: Button Caption Pin
shiv@nand26-Mar-10 3:43
shiv@nand26-Mar-10 3:43 
GeneralRe: Button Caption Pin
CPallini26-Mar-10 3:46
mveCPallini26-Mar-10 3:46 
GeneralRe: Button Caption Pin
shiv@nand26-Mar-10 4:01
shiv@nand26-Mar-10 4:01 
GeneralRe: Button Caption Pin
CPallini26-Mar-10 4:10
mveCPallini26-Mar-10 4:10 
Well, you already set the caption for you button with known values, so what's your need now?

BTW I suggest you to maintain the CButton pointers in a member variable:
in class declaration:
CButton * m_btDynamic[5];

then, in you function you may do
void CTest::OnShowWindow(BOOL bShow, UINT nStatus)
{
     CDialog::OnShowWindow(bShow, nStatus);
     
     CString csText;    
     int   k=0;
         
     for(int i=0;i<5;i++)
     {
       m_btDynamic[i] = new CButton();
              
       csText.Format(L"Button %d",i+1);         
       m_btDynamic[i]->Create(csText,BS_FLAT|WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON|BS_ICON,
           CRect(10+k ,10+k,60+k,60+k),this, 5000+i);
        k=k+30;
     }
}


so that whenever you need to access the caption of, say, third button, you may call
m_btDynamic[2]->GetWindowText();

Smile | :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.

This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke

[My articles]

GeneralRe: Button Caption Pin
shiv@nand26-Mar-10 4:15
shiv@nand26-Mar-10 4:15 
GeneralRe: Button Caption [fixed] Pin
CPallini26-Mar-10 4:20
mveCPallini26-Mar-10 4:20 
GeneralRe: Button Caption Pin
shiv@nand26-Mar-10 4:25
shiv@nand26-Mar-10 4:25 
GeneralRe: Button Caption Pin
CPallini26-Mar-10 4:27
mveCPallini26-Mar-10 4:27 
GeneralRe: Button Caption Pin
Iain Clarke, Warrior Programmer26-Mar-10 4:27
Iain Clarke, Warrior Programmer26-Mar-10 4:27 
GeneralRe: Button Caption Pin
shiv@nand26-Mar-10 4:34
shiv@nand26-Mar-10 4:34 
GeneralRe: Button Caption Pin
Joe Woodbury26-Mar-10 7:02
professionalJoe Woodbury26-Mar-10 7:02 
GeneralRe: Button Caption Pin
CPallini26-Mar-10 7:22
mveCPallini26-Mar-10 7:22 
QuestionDrawing with offset [modified] Pin
Wasabi_26-Mar-10 3:07
Wasabi_26-Mar-10 3:07 
QuestionRe: Drawing with offset Pin
CPallini26-Mar-10 3:14
mveCPallini26-Mar-10 3:14 
AnswerRe: Drawing with offset Pin
Wasabi_26-Mar-10 3:29
Wasabi_26-Mar-10 3:29 
QuestionRe: Drawing with offset Pin
CPallini26-Mar-10 3:44
mveCPallini26-Mar-10 3:44 
AnswerRe: Drawing with offset Pin
Covean26-Mar-10 3:44
Covean26-Mar-10 3:44 
GeneralRe: Drawing with offset Pin
Wasabi_26-Mar-10 4:23
Wasabi_26-Mar-10 4:23 
Question.obj file help Pin
Cvaji26-Mar-10 1:51
Cvaji26-Mar-10 1:51 
AnswerRe: .obj file help Pin
CPallini26-Mar-10 2:59
mveCPallini26-Mar-10 2:59 
AnswerRe: .obj file help Pin
Richard MacCutchan26-Mar-10 4:55
mveRichard MacCutchan26-Mar-10 4:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.