Author Topic: wxMessageBox not displayed while button clicked  (Read 4073 times)

Offline cotede2

  • Multiple posting newcomer
  • *
  • Posts: 17
wxMessageBox not displayed while button clicked
« on: May 09, 2010, 11:32:34 pm »
Hello ,

I face an issue.
I expect a wxMessageBox being displayed when , I click on the button but nothing happens.
Do you know why?
thanks for your time

Code
#include "MainFrame.h"

//(*InternalHeaders(MainFrame)
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/msgdlg.h>
#include "testdb.h"

//*)

//(*IdInit(MainFrame)
const long MainFrame::ID_TEXTCTRL2 = wxNewId();
const long MainFrame::ID_TEXTCTRL1 = wxNewId();
const long MainFrame::ID_STATICTEXT3 = wxNewId();
const long MainFrame::ID_STATICTEXT2 = wxNewId();
const long MainFrame::ID_BUTTON1 = wxNewId();
const long MainFrame::ID_PANEL1 = wxNewId();
//*)

BEGIN_EVENT_TABLE(MainFrame,wxFrame)
   EVT_BUTTON(ID_BUTTON1, MainFrame::OnButton1Click)
END_EVENT_TABLE()

MainFrame::MainFrame(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
{
//(*Initialize(MainFrame)
Create(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("wxID_ANY"));
Panel1 = new wxPanel(this, ID_PANEL1, wxPoint(56,24), wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1"));
TextCtrl2 = new wxTextCtrl(Panel1, ID_TEXTCTRL2, _("Text"), wxPoint(144,128), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL2"));
TextCtrl1 = new wxTextCtrl(Panel1, ID_TEXTCTRL1, _("Text"), wxPoint(144,168), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL1"));
StaticText3 = new wxStaticText(Panel1, ID_STATICTEXT3, _("Identifiant"), wxPoint(64,136), wxDefaultSize, 0, _T("ID_STATICTEXT3"));
StaticText2 = new wxStaticText(Panel1, ID_STATICTEXT2, _("Mot De Passe"), wxPoint(64,168), wxDefaultSize, 0, _T("ID_STATICTEXT2"));
Button1 = new wxButton(Panel1, ID_BUTTON1, _("Valider"), wxPoint(144,208), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1"));

Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&MainFrame::OnButton1Click);
Panel1->Connect(ID_PANEL1,(wxObjectEventFunction)&MainFrame::OnPanel1Paint,0,this);
//*)
}

MainFrame::~MainFrame()
{
//(*Destroy(MainFrame)
//*)
}


void MainFrame::OnPanel1Paint(wxPaintEvent& event)
{
}

void MainFrame::OnButton1Click(wxCommandEvent& event)
{

    wxString  mystring (wxT("Hello World"));

    wxMessageBox(mystring,
        mystring, wxOK | wxICON_INFORMATION, this);
   /* testdb* testdb_ = new testdb();
    int i = testdb_->connexion();
    wxString  mystring (wxT("Hello World"));
    this->TextCtrl2->AppendText(mystring);
    */

}

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: wxMessageBox not displayed while button clicked
« Reply #1 on: May 10, 2010, 01:50:09 am »
The question is not related to C::B and therefore violates our forum rules !

Topic locked !!