March 2010 Archives

Learning to use wxOSX

| 0 Comments
I've been putting the necessary things in place to make one of my wxPerl applications more Mac friendly. The first thing I discovered was the availability of automatic spell checker access for Wx::TextCtrl. By default, this is not switched on but you can switch on and off globally in your application with:

Wx::SystemOptions::SetOptionInt("mac.textcontrol-use-spell-checker", $bool);

You can also control individual Wx::TextCtrl instances by

$textctrl->MacCheckSpelling($bool);

Now all I need is spell checking for wxGTK and wxMSW.

I also sorted out the application menu, which had been irritating me. A full explanation is at the wxWidgets wiki but in short:

$app->->SetExitOnFrameDelete(0);

prevents your application closing when all top level windows are closed. Use the identifiers; wxID_ABOUT, wxID_EXIT, wxID_PREFERENCES for the appropriate Wx::MenuItem id's and name your 'Help' menu 'Help'. You can add a Wx::MenuBar with these items in to your application with:

Wx::MenuBar::MacSetCommonMenuBar( $mymenubar );

and this menubar will be used when no top level windows are open. Unfortunately, MacSetCommonMenuBar is not wrapped in the current Wx CPAN release (0.9701) but it is in SVN so should make the next release.

About this Archive

This page is an archive of entries from March 2010 listed from newest to oldest.

February 2010 is the previous archive.

April 2010 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Categories