A second tutorial: Part 6 Add
Predefined Code
This tutorial makes a simple
wxWidgets program to edit XPM format files
Insert Code
blocks
Common code is needed to do regular
tasks; and patterns are provided in the Insert | Code menu. The
code is automatically inserted at the correct place in the .cpp and
.h files, together with any extra include files needed
Try these now:
- use the CommandLine Parser to
handle situations like xpmedit
myxpmfile.xpm, which might arise
from double clicking in windows explorer or from a linux command
line
- Make sure the
xpmedit.cpp file is highlighted
- Choose Insert Code |
wxCmdLineParser
- Amend the code from:
/*
strVal = parser.GetParam(iParams);
frame->DoOpenFile(strVal);
*/
to
strVal = parser.GetParam(iParams);
frame->myBitmap = wxBitmap(wxImage(strVal));
frame->canvas->Refresh();
- You can also set a status bar, add
recently used files to the menu, add accelerators, etc
Next
Back
wxHatch
Home 