Adsense code (2021-10-05)

Showing posts with label wxSmith. Show all posts
Showing posts with label wxSmith. Show all posts

Monday, August 25, 2014

Code::Blocks + wxWidgets + wxSmith, to open text file with wxFileDialog

This video show steps to create wxWidgets project in Code::Blocks, using wxSmith, to open text file with wxFileDialog.



The only programmatic code is in wxTextFileFrame::OnMenuOpenSelected() of the file wxTextFileMain.cpp.
void wxTextFileFrame::OnMenuOpenSelected(wxCommandEvent& event)
{
    wxTextFile file;
    wxString text;

    int result;
    result = FileDialog1->ShowModal();
    if(result==wxID_OK){
        SetTitle(FileDialog1->GetPath());

        file.Open(FileDialog1->GetPath());
        for(size_t i=0; i<file.GetLineCount(); i++){
            text << file.GetLine(i) << _T("\r\n");
        }
        file.Close();
        TextCtrl1->SetValue(text);
    }

}


And also include wx/textfile.h.
#include <wx/textfile.h>


Sunday, August 24, 2014

Hello World of Code::Blocks with wxSmith

"wxSmith plugin is not loaded, can not continue" in Code::Blocks

If you try to New a wxWidgets Project in Code::Blocls, with GUI Builder of wxSmith; may be you will be complained with error of "wxSmith plugin is not loaded, can not continue".



You have to install codeblocks-contrib, it is a contrib plugins for Code::Blocks IDE. To install it on Ubuntu, enter the command:

$ sudo apt-get install codeblocks-contrib

And then restart Code::Blocks.