Jump to content

erro em wxwidgets


wrproject

Recommended Posts

ola pessoal, eu tenho um problema neste codigo, ele nao muda a cor de fundo, nem posiciona os controlos de texto, podiam ajudar-me?

#include "wx/wx.h"
class teste: public wxApp
{
    wxFrame *janela;
    wxTextCtrl *texto;
    bool OnInit()
    {
        //definicoes da janela
        wxSize tamanho_janela(400,200);
        wxString titulo("janela de teste");
        long estilo_janela= wxCAPTION | wxCLOSE_BOX | wxSYSTEM_MENU;
        janela=new wxFrame(NULL, -1, titulo, wxDefaultPosition, tamanho_janela, estilo_janela);
        wxColour fundo(48, 214, 100);
        janela->SetBackgroundColour(fundo);
        janela->ClearBackground();



        //definicoes controlos de texto
        wxSize tamanho_texto(60,25);
        wxPoint posicao_texto(20,400);
        texto = new wxTextCtrl(janela, -1, "", posicao_texto,tamanho_texto);
        *texto<<"ola eliseu como estas";
        janela->Show(true);

        return true;


    }
    int OnExit() {
      janela->Destroy();
      return 0;
    }
    void OnChange(wxCommandEvent& event)
    {
        *texto<<"ola eliseu";
    }
    DECLARE_EVENT_TABLE()
};
BEGIN_EVENT_TABLE(teste, wxApp)
EVT_TEXT(1, teste::OnChange)
END_EVENT_TABLE()
//Iniciar a aplicacao
IMPLEMENT_APP(teste)


cumps  😛

Link to comment
Share on other sites

Olá!

Olha, agora não tenho muito tempo e por isso não posso analisar o teu código, mas se queres uma sugestão, não tenha trabalho a fazer janelas e outros elemento GUI à mão, usa um dos editores referidos neste tópico que poupas muito tempo e muitas chatices. Aconselho-te o wxDevC++.

Cumprimentos!

A solução de um problema, por mais complicado que seja, tem de ser simples e clara. Caso contrário criamos um novo problema!O caminho mais fácil é muitas vezes o melhor caminho!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.