Select A Directory c++

On occasion a directory needs to be selected programmatically.  The code snippet below offers sound solution. [codesyntax lang=”cpp”] std::string bcsGui::SelDir(string initDir) { string selDir; wxDirDialog dlg(NULL, “Choose input directory”, initDir, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST); if (dlg.ShowModal() == wxID_OK) { selDir = dlg.GetPath().ToStdString(); return selDir; } dlg.Destroy(); } [/codesyntax] Include the target class into the project. [codesyntax […]

wxDialog Usage

Initialization of the process is described below. [codesyntax lang=”cpp”] void grailsGenFrame::OnmenOpt1Selected(wxCommandEvent& event) { db.listDatabases(); db.selDB(); } [/codesyntax] The definition for db is described below. [codesyntax lang=”cpp”] zDB01 db; [/codesyntax] The dialog must be initiated. [codesyntax lang=”cpp”] #ifndef ZDB01_H #define ZDB01_H #include <mysql++.h> #include <wx/arrstr.h> class zDB01 { public: zDB01(); virtual ~zDB01(); void listDatabases(); wxArrayString dbn; […]

Creating Mainline Dialog

When developing a wxWidges application ocassionally a need arises that requires a single dialog to become the processing mainline. [codesyntax lang=”cpp”] dlgDe2 dlg(this, wxID_ANY); dlg.ShowModal(); dlg.Destroy(); wxCommandEvent event; OnQuit(event); [/codesyntax] Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

Install wxWidgets

Traverse to and download the latest version of wxWidgets. Save the archive to the ~/apps sub directory then extract the contents to ~/apps/. Change directory to ~/apps/wxWidgets-3.1.5/build and issue the commands as follows: [codesyntax lang=”php”] ../configure make -j4 sudo make install [/codesyntax] Follow all prompts during the install. Mr. Arch Brooks, Software Engineer, Brooks […]

Automation for Linux

A major consideration when using a Linux distribution is the lack of a GUI for many of the system administration tasks.  Programmers are pretty much relegated to the command line without some fairly sophisticated tools. A c++ program issues sudo command to execute shell commands while routing the output to a text file and subsequently […]

Decompose File Specification c++

A process for file specification decomposition is often required.  To achieve decomposition goals we employ a structure and a method. The structure is as follows. [codesyntax lang=”cpp”] struct filespecification_area { string Path; string File; }; [/codesyntax] Establish a pointer to the structure by declaring the following. [codesyntax lang=”cpp”] filespecification_area fs; [/codesyntax] The associated method is […]

Add Existing Dialog to CodeBlocks Project

There are those occasions when it is necessary to add an existing dialog from a CodeBlocks project.  This tool adds a dialog the user selects to an existing project by copying the project and the dialog into memory.  The CodeBlocks project is renamed to a .pbk file.  The dialog file is then added to the […]

Add Popup Menu wxWidgets

Activate the appropriate resource and prepare to edit the .wxs file. On the Tools, tab select the “menu” component.  Once the menu is created set the desired name (“pumFlist”) and add a menu item in the resources GUI. Add the required mouse event handler as depicted below. [codesyntax lang=”cpp”] lbxRecs->Connect(lbxRecs->GetId(), wxEVT_RIGHT_UP, wxMouseEventHandler(pDocFrame::OnpanRecsRightUp), NULL, this); [/codesyntax] […]