0

I am trying to do a property sheet application in MFC.
I added the dialogues for each tab and all working fine.
But my actual problem is that when I placed a button on one of the tab, the program control actually not reaching there. This is what I have done.

  1. Added a new dialog--> Created its class referring from CPropertyPage class

  2. Added a button and textbox in gender tab and tried the below code:

    void Gender::OnBnClickedBUTTON() { SetDlgItemInt(TEXTBOX_ID,1) }

I'm expecting the textbox to be printed with integer 1. But nothing happens. Should I add something else?
I am actually stuck with the control flow of the program. please help.

Jerry YY Rain
  • 4,134
  • 7
  • 35
  • 52
VISHNU
  • 73
  • 1
  • 9
  • If the textbox is an edit control it should update automatically, but if it's a static control you may need to invalidate it after setting the new value. Microsoft assume static controls will be static, i.e. unchanging. – Mark Ransom Jul 04 '14 at 04:32
  • Its an _edit control_ I didnot added any variables for it yet. trying to do with SetDlgItemInt(). – VISHNU Jul 04 '14 at 04:37
  • Did you use the wizard to add the OnBnClicked function? If not then you'll be missing the required entry in the message map. – Mark Ransom Jul 04 '14 at 04:46
  • Yes I used the wizard and Message map looks like:
    BEGIN_MESSAGE_MAP(Gender, CPropertyPage) ON_BN_CLICKED(IDC_BUTTON1, &Gender::OnBnClickedButton1) END_MESSAGE_MAP()
    – VISHNU Jul 04 '14 at 05:05
  • 1
    There's your problem then. In the message map, the function should be called &Gender::OnBnClickedBUTTON, not OnBnClickedButton1. – djikay Jul 04 '14 at 07:35

0 Answers0