Dúvida wxWidgets

1. Dúvida wxWidgets

Emerson Luiz Antonio
kidgumer

(usa Ubuntu)

Enviado em 05/04/2013 - 12:56h

Olá amigos, o código abaixo compila no ubuntu e windows, porém os valores não são inseridos em wxTextCtrl quando rodando no ubuntu. alguém saberia explicar o porque?

#include <wx/wx.h>
#include <iostream>


int i = 2;

enum
{
ID_BOTAO = 1,

};

class MeuApp : public wxApp
{
public:
virtual bool OnInit();
};

class Simple : public wxFrame
{
public:
Simple(const wxString& titulo);
void PushButton(wxCommandEvent& e);
void Idle(wxIdleEvent& e);

private:

wxButton* botao;
wxTextCtrl* edit;
wxStaticText* text;
wxPanel* painel;
wxBoxSizer* sizer_v;
wxBoxSizer* sizer_h;


DECLARE_EVENT_TABLE()
};

IMPLEMENT_APP(MeuApp)

bool MeuApp::OnInit()
{
Simple *primo = new Simple(wxT("Gerador de Numeros Primos"));
primo->Show(true);
return true;
}

Simple::Simple(const wxString& titulo)
:wxFrame(NULL, wxID_ANY,titulo, wxDefaultPosition, wxSize(350,150))

{
sizer_v = new wxBoxSizer(wxVERTICAL);
sizer_h = new wxBoxSizer(wxHORIZONTAL);
painel = new wxPanel(this, wxID_ANY,wxDefaultPosition, wxSize(1240,1200));
text = new wxStaticText(painel, wxID_ANY, wxT("Linguagens de Programacao"));
botao = new wxButton(painel, ID_BOTAO, wxT("SAIR"));
edit = new wxTextCtrl(painel, wxID_ANY, wxT(""),wxDefaultPosition, wxSize(230,20));

sizer_h->Add(text,wxSizerFlags(0).Border(wxALL, 5));
sizer_h->Add(botao,wxSizerFlags(0).Border(wxALL, 5));


sizer_v->Add(edit, wxSizerFlags(0).Border(wxALL, 10));
sizer_v->Add(sizer_h, wxSizerFlags(1).Border(wxALL, 5));

SetSizerAndFit(sizer_v);



}

void Simple::PushButton(wxCommandEvent& e)
{

wxMessageDialog* ptFechar = new wxMessageDialog(NULL, wxT("Tem certeza que quer sair?"), wxT("Confirmacao"),
wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION);
int resp = ptFechar->ShowModal();
ptFechar->Destroy();
if (resp == wxID_YES)
Destroy();
}

void Simple::Idle(wxIdleEvent& e)
{
int j, res;
int cont = 0;
j = i;

while(j > 0)
{



res = i%j;
if(res == 0) cont = cont + 1;

j = j - 1;


}
if (cont == 2)
{
wxString st;
st << i;
edit->SetLabel(st);

}
i = i + 1;
e.RequestMore();
}



BEGIN_EVENT_TABLE(Simple, wxFrame)
EVT_BUTTON( ID_BOTAO, Simple::PushButton)
EVT_IDLE(Simple::Idle)

END_EVENT_TABLE()



  






Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts