- is https://metacpan.org/pod/Wx::Perl::BrowseButton the answer to write this part more elegant "$inputfile = Win32::GUI::GetOpenFileName" ? (just yes or no is enough, I didn't investigate that part too much yet)

Hi. Direct equivalent is Wx::FileSelector()

#!/usr/bin/perl -- use strict; use warnings; use Wx qw[ :everything ]; Main( @ARGV ); exit( 0 ); sub Main { my $frame = Wx::Frame->new( undef, -1, __FILE__ ); $frame->{text} = Wx::TextCtrl->new( $frame, -1, '', [ -1, -1 ], [ -1, -1 ], Wx::wxTE_MULTILINE() ); MakeMenuBar( $frame ); $frame->Show( 1 ); $frame->SetIcon( Wx::GetWxPerlIcon() ); ## to end Demo Wx::Event::EVT_CLOSE( $frame, sub { Wx::Exit() } ); Wx::SimpleApp->new->MainLoop; } sub MakeMenuBar { my( $frame ) = @_; my $bar = Wx::MenuBar->new; my $menu = Wx::Menu->new; Wx::Event::EVT_MENU( $frame, $menu->Append( -1, "&Demo!\tCtrl-D", "Launch Wx::Demo!" ), \&LaunchDemo ); Wx::Event::EVT_MENU( $frame, $menu->Append( -1, "&About!\tCtrl-A", "About BOX!" ), \&OnAbout ); $frame->{info} = Wx::AboutDialogInfo->new; $frame->{info}->AddDeveloper( 'Anonymous Monk' ); for my $letter ( qw/ B C/, 'E' .. 'I' ) { my $item = "&$letter$letter$letter \tCtrl-$letter"; my $id = Wx::NewId(); $menu->Append( $id, $item, ); Wx::Event::EVT_MENU( $frame, $id, \&SayWhat ); } Wx::Event::EVT_MENU( $frame, $menu->Append( -1, "&Open!\tCtrl-O", "Launch Wx::Demo!" ), \&GetOpenFileName, ); $bar->Append( $menu, "&Lively" ); my $submenu = Wx::Menu->new(); $submenu->Append( -1, "submenu A" ); $submenu->Append( -1, "submenu B" ); $submenu->AppendSeparator(); $submenu->Append( -1, "submenu C" ); $submenu->Append( -1, "submenu D" ); $submenu->AppendSeparator(); $submenu->Append( -1, "submenu E" ); $submenu->Append( -1, "submenu F" ); $menu->AppendSubMenu( $submenu, "&Submenu" ); Wx::Event::EVT_MENU( $frame, $_, \&SayWhat ) for $submenu->GetMenu +Items; $frame->SetMenuBar( $bar ); return $bar; } sub LaunchDemo { my( $frame, $event ) = @_; $frame->{text}->AppendText( join ' ', "In 3", "\n" ); SayWhat( @_ ); $frame->{text}->AppendText( join ' ', "In 2", "\n" ); require Wx::Demo; $frame->{text}->AppendText( join ' ', "In 1", "\n" ); $frame->{demo} ||= !! Wx::Demo->new; } sub SayWhat { my( $frame, $event ) = @_; my $id = $event->GetId; my $hi = $frame->GetMenuBar->GetLabel( $id ); $frame->{text}->AppendText( join ' ', $id, $hi, "\n" ); } sub GetOpenFileName { my( $frame, $event ) = @_; SayWhat( @_ ); $frame->{text}->AppendText( join "\n", Wx::FileSelector( '$message' ) , "\n" ); } sub OnAbout { my( $frame, $event ) = @_; Wx::AboutBox( $frame->{info} ); } __END__

In reply to Re: some general question / Wx related question by Anonymous Monk
in thread some general question / Wx related question by Luk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.