wiki:PadrePluginCookbook01

Version 4 (modified by bowtie, 4 years ago) (diff)

--

Padre::Plugin::Cookbook01

  • This page complements Padre::Plugin::Cookbook01, it is not meant to be installable, just an aid, with a suggested layout, enjoy. More detail will follow in subsequent Cookbooks.
  • Cookbook01.zip in Attachments.

Step 1 - Create Skeleton

  • Assumption you are building in your copy of Padre trunk.
    • for me this is, /src/Padre/Padre == http://svn.perlide.org/padre/trunk/Padre
    • thus for me, Cookbook01 is located in /src/Padre/Padre-Plugin-Cookbook01, checkout some other Plugins to see for your self.
  • FBP/fbp directories, follow current Padre trunk Naming convention
Padre-Plugin-Cookbook01/
├── fbp
│   └── MainFB.fbp
├── lib
│   └── Padre
│       └── Plugin
│           ├── Cookbook01
│           │   ├── FBP
│           │   │   └── MainFB.pm
│           │   └── Main.pm
│           └── Cookbook01.pm
└── t

Step 2 Create MainFB.fbp (xml)

  • Use wxFormBuilder, v3.1.70
  • Create in following order of table below.
  • save to plug-in root/fbp/MainFB.fbp as above.
wxWidgetPropertiesEvents
IconTypenamelabel/titlepublicothertypevalue

wxWidget project

Project

Cookbook01

n/a

n/a

n/a

n/a

n/a

wxWidget dialog

Dialog

Padre::Plugin::Cookbook01::FBP::MainFB

Main

n/a

wxRESIZE_BORDER

n/a

n/a

wxWidget bsizer

wxBoxSizer

bSizer1

n/a

n/a

n/a

n/a

n/a

wxWidget static_text

wxStaticText

m_staticText1

Hello World

n/a

wxALIGN_CENTER

n/a

n/a

  • Dialog must start with Padre::Plugin for Step 3 to work.
  • wxRESIZE_BORDER lets you grab lower left hand corner.
  • wxALIGN_CENTER centers text

Step 3 Padre::Plugin::FormBuilder

  • Use generator to create MainFB.pm from MainFB.fbp
    • Tip have Padre::Plugin::Cookbook01.pm Open before running generator.

Step 4 Perl Plug-in Code

  • Read POD for Padre::Plugin
  • Read POD for Cookbook01.pm and Main.pm
  • Run Tests, note results, critiques welcome.

Step 5 Run

  • perl dev -a -die
  • You should now have Cookbook01 in your Tools menu, enjoy.

Foot Notes

Why Main

Well I needed a convention that I could expand upon. Which made sense to me, so here goes:

  • MainFB.fbp is generated by wxFormBuilder,
  • MainFB.pm is geneated from previous by Padre::Plugin::FormBuilder.

The FB tells me it's nought to do with me.

  • Main.pm is the event handler for MainFb.pm.

__END__

Attachments (5)

Download all attachments as: .zip