Pagina 2 di 2 primaprima 1 2
Visualizzazione dei risultati da 11 a 12 su 12
  1. #11
    Utente di HTML.it
    Registrato dal
    Jan 2005
    Messaggi
    153
    Ricordi che ti avevo chiesto un manuale per MInGW tu mi hai indicato dei link che ho visitato, manon ci ho capito nulla perchè purtroppo con l'inglese sto litigato e non riuscendo a tradurre tutto in un modo comprensibile non capisco tutti i metodi delle classi. Potresti mandarmi un codice creato da te anche molto semplice ma che mi faccia capire come creare una finestra poi vedo ti trovare qualcuno che mi traduca bene i manuale dei link da te indicatemi. Ciao grazie

  2. #12
    Utente di HTML.it L'avatar di anx721
    Registrato dal
    Apr 2003
    Messaggi
    2,352
    Io non ho fatto molti programmi in wxWindows, ho solo seguito alcuni tutorial linkati dal sito; per fare una prova da MinGWDS cre un nuovo progetto wxWindows; quindi agiungi al progetto i seguenti 3 file:
    1 - un file wxProva.cpp (tra i source files)
    2 - un file wxProva.h (tra gli include files)
    3 - un file wxProva.rc (tra i Resource file)

    qui ti riporto il codice per tutti e tre i file:

    codice:
    /*      wxProva.h          */
    
    #include <wx/wx.h>
    #include <wx/mdi.h>
    #include <vector>
    
    using namespace std;
    
    enum
    {
        ID_Quit = 1,
    	ID_About,
    	ID_New
    };
    
    
    class ProvaText: public wxTextCtrl
    {
    public:
    	ProvaText();
    };
    
    
    class ProvaChild: public wxMDIChildFrame
    {
    	ProvaText *txt;
    public:
    	ProvaChild();
    	bool Create(wxMDIParentFrame *parent, wxWindowID id, const wxString& title, 
    		const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, 
    		long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame");
    };
    
    
    class ProvaClient: public wxMDIClientWindow
    {
    public:
    	ProvaClient();
    };
    
    
    class ProvaFrame: public wxMDIParentFrame
    {
    	vector<ProvaChild *> child_list;
    	ProvaClient *client;
    public:
        ProvaFrame(const char* title, const wxPoint& pos = wxDefaultPosition, 
    	const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE |
    	wxVSCROLL |  wxHSCROLL, const wxString& name = "frame");
    	virtual wxMDIClientWindow* OnCreateClient();
        virtual void OnNew(wxCommandEvent& event);
        virtual void OnQuit(wxCommandEvent& event);
        virtual void OnAbout(wxCommandEvent& event);
    	
        DECLARE_EVENT_TABLE()
    };
    
    
    class ProvaApp: public wxApp
    {
        virtual bool OnInit();
    	ProvaFrame *frame;
    };
    codice:
    /*      wxProva.cpp           */
    
    #include "wxProva.h"
    
    BEGIN_EVENT_TABLE(ProvaFrame, wxMDIParentFrame)
    	EVT_MENU(ID_New, ProvaFrame::OnNew)
    	EVT_MENU(ID_Quit, ProvaFrame::OnQuit)
    	EVT_MENU(ID_About, ProvaFrame::OnAbout)
    END_EVENT_TABLE()
    
    IMPLEMENT_APP(ProvaApp)
    
    bool ProvaApp::OnInit()
    {
        frame = new ProvaFrame("Hello World", wxPoint(50,50), wxSize(450,340));
        frame->Show(TRUE);
        SetTopWindow(frame);
        return TRUE;
    } 
    
    ProvaFrame::ProvaFrame(const char* title, const wxPoint& pos, 
    	const wxSize& size, long style, const wxString& name)
    	: wxMDIParentFrame((wxWindow *)NULL, -1, wxString(title), 
    		pos, size, style, name)
    {
        wxMenu *menuFile = new wxMenu;
    	
        menuFile->Append( ID_New, "&New..." );
        menuFile->AppendSeparator();
        menuFile->Append( ID_About, "&About..." );
        menuFile->AppendSeparator();
        menuFile->Append( ID_Quit, "E&xit" );
    	
        wxMenuBar *menuBar = new wxMenuBar;
        menuBar->Append( menuFile, "&File" );
    	
        SetMenuBar( menuBar );
    	
        CreateStatusBar();
        SetStatusText( "Welcome to wxWindows!" );
    }
    
    void ProvaFrame::OnQuit(wxCommandEvent& event)
    {
        Close(TRUE);
    }
    
    void ProvaFrame::OnNew(wxCommandEvent& event)
    {
    	ProvaChild *child = new ProvaChild();
    	child->Create(this, -1, wxT("Child"));
        child_list.push_back(child);
    }
    
    void ProvaFrame::OnAbout(wxCommandEvent& event)
    {
        wxMessageBox("This is a wxWindows Hello world sample",
            "About Hello World", wxOK | wxICON_INFORMATION, this);
    }
    
    wxMDIClientWindow *ProvaFrame::OnCreateClient()
    {
    	client = new ProvaClient();
    	client->Create(this, -1);
    	return client;
    }
    
    ProvaClient::ProvaClient()
    {
    	
    }
    
    ProvaChild::ProvaChild()
    {
    	
    }
    
    bool ProvaChild::Create(wxMDIParentFrame *parent, 
    	wxWindowID id, const wxString& title, 
    	const wxPoint& pos /* = wxDefaultPosition */, 
    	const wxSize& size /* = wxDefaultSize */, 
    	long style /* = wxDEFAULT_FRAME_STYLE */, 
    	const wxString& name /* = "frame" */)
    {
    	if(!wxMDIChildFrame::Create(parent, id, title, pos, size, style, name))
    	{
    		wxMessageBox("Errore nella creazione della finestra", 
    			"Errore", wxOK | wxICON_INFORMATION, this);
    		return false;
    	}
    	
    	txt = new ProvaText();
    	txt->Create(this, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 
    		wxTE_MULTILINE | wxTE_RICH /*| wxTE_PROCESS_ENTER	*/|
    		wxTE_PROCESS_TAB | wxTE_NOHIDESEL);
    	
    	return true;
    }
    
    ProvaText::ProvaText()
    {
    	
    }
    codice:
    /*      wxProva.rc              */
    
    
    #include "wx/msw/wx.rc"
    quindi prova ad eseguire...se tutto va bene ti appare un rudimentale editor di testo a più finestre

    Sun Certified Java Programmer

    EUCIP Core Level Certified

    European Certification of Informatics Professionals

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.