Steve: I believe I looked at Glade a couple of years ago. Seems it kept crashing on me so I just went back to the old manual method.
Thanks for the sample code. James On Thu, Jan 29, 2015 at 12:28 PM, Steve Cookson - gmail < steveco.1...@gmail.com> wrote: > Hi James, > > I've replied to the list as well because I feel it needs a bit of loving! > > On 28/01/15 18:23, James Lynes wrote: > >> Hi Steve: >> >> How's your project rollout going? >> > Very kind of you to ask. The launch went very well, since then we have > been dealing with the manufacturer and we are working to a delivery of the > first batch to Brazil by the end of March. Our Brazilian salesman is > confident that he will sell all the first batch without too much difficulty. > >> What's the accepted method to shutdown an application? >> >> I can use die, but there must be a WX call that should be used. I don't >> want to leave a frame open on the screen that has to be closed manually. >> >> Example using die is attached. (Wrapper around a command line application) >> > > The short answer to your question is probably "exit(0);" called from an > exit button. > > However, the longer answer is did you ever see wxGlade? > > I don't know whether wxGlade was ever converted to 3.0.x, but it did work > on 2.8 and I thought 2.9. It's a wonderful way to get started with all the > Wx paradigms. I used it extensively at the beginning. > > I re-wrote the OnInit subroutine as below. It uses Wx::BoxSizer and > Wx::Events, both of which will help your application. I also used > Wx::FilePickerCtrl as a control to get the .pdf file. > > Have fun with it. > > Best regards > > Steve. > > > sub OnInit { > > my $parent = shift; > > > my $frame = Wx::Frame->new(undef, wxID_ANY, "", wxDefaultPosition, > wxDefaultSize ); > > $parent->SetTopWindow($frame); > > #Create controls > # Fields > my $pdfLabel=Wx::StaticText->new($frame, wxID_ANY,"PDF file", > wxDefaultPosition, wxDefaultSize); > my $pdfFilePicker=Wx::FilePickerCtrl->new($frame, wxID_ANY, "", "Pick > a folder","*.pdf",wxDefaultPosition, [200,-1], > wxDIRP_DIR_MUST_EXIST|wxDIRP_CHANGE_DIR|wxDIRP_USE_TEXTCTRL); > $pdfFilePicker->SetPath("/home/image/"); > my $cropLabel=Wx::StaticText->new($frame, wxID_ANY,"crop string", > wxDefaultPosition, wxDefaultSize); > my $cropStringText=Wx::TextCtrl->new($frame, wxID_ANY,"crop string", > wxDefaultPosition, [200,-1]); > # Buttons > my $okButton = Wx::Button->new($frame, wxID_OK, "", wxDefaultPosition, > wxDefaultSize); > my $cancelButton = Wx::Button->new($frame, wxID_CANCEL, "", > wxDefaultPosition, wxDefaultSize); > > # Create sizers. > my $verticalSizerFrame = Wx::BoxSizer->new(wxVERTICAL); > $frame->SetSizer($verticalSizerFrame); > my $verticalSizerControls = Wx::BoxSizer->new(wxVERTICAL); > my $horizontalSizerButtons = Wx::BoxSizer->new(wxHORIZONTAL); > # Lay 'em out. > $verticalSizerFrame->Add($verticalSizerControls,0,0,0); > $verticalSizerFrame->Add($horizontalSizerButtons,0,0,0); > > $verticalSizerControls->Add($pdfLabel,0,0,0); > $verticalSizerControls->Add($pdfFilePicker,0,0,0); > $verticalSizerControls->Add($cropLabel,0,0,0); > $verticalSizerControls->Add($cropStringText,0,0,0); > > $horizontalSizerButtons->Add($okButton,0,0,0); > $horizontalSizerButtons->Add($cancelButton,0,0,0); > > # Event handlers > Wx::Event::EVT_BUTTON($frame, $okButton, sub { > my ($self, $event) = @_; > exit (0); > }); > > $verticalSizerFrame->Layout(); > > $frame->Show(1); > > } > > >> Thanks, >> James >> > >