The story so far...

anyway, here is my first attempt on all of this. I was successful at sending text to the screen. As I am sure there is a better way to do all of this, Comments, suggestions, jokes, are welcomed, even invited.

#!/usr/bin/perl use strict; use warnings; use 5.010001; use Wx; my $last_id = 0; my $curr_id = 0; my @id_list = (undef) x 3; package MyFrame; use base 'Wx::Frame'; use Wx::Event qw(EVT_BUTTON EVT_TIMER); sub new { #use X11::GUITest qw/:ALL/; use X11::GUITest qw/GetInputFocus SetInputFocus SendKeys/; my $ref = shift; my $self= $ref->SUPER::new( undef, #Parent Window -1, #Window ID (-1 means any) 'wxPerl', #Window Title [-1, -1], #Default Position [171, 30], #size ); #create panel my $panel = Wx::Panel->new( $self, #parent window -1, #id ); #create send key button my $button = Wx::Button->new( $panel, # Parent Panel -1, # id 'Send Hello', # label [85, 1], # position [-1, -1], # default size ); # create Quit button my $button_quit = Wx::Button->new( $panel, # Parent Panel -1, # id 'Quit', # label [1, 1], # position [-1, -1], # default size ); my $timer = Wx::Timer->new( $self, # Parent Frame -1, # Timer ID ); $timer->Start(1); EVT_TIMER $self, $timer,\&do_stuff; #send key button EVT_BUTTON $self, $button, \&on_click_button; #send key click quit EVT_BUTTON $self, $button_quit, \&on_click_quit; return $self; } sub do_stuff { my $this_id = GetInputFocus; if ($this_id != $id_list[2]){ print STDOUT $this_id . "\n"; shift @id_list; push @id_list, $this_id; } else { #do nothing for now } } sub on_click_quit { my ($self, $event) = @_; $self->quit; } sub on_click_button { my ($self, $event) = @_; say @id_list; SetInputFocus $id_list[0]; print STDOUT "sent to: $id_list[0], last: $id_list[1], $id_list[2] +\n"; # SendKeys QuoteStringForSendKeys("%N"); SendKeys ('hello'); $self->SetTitle( 'Clicked'); } package MyApp; use base 'Wx::App'; sub OnInit { my $frame = MyFrame->new; $frame->Show(1); } package main; my $app = MyApp->new; $app->MainLoop;

In reply to Re: Quick-Buttons Toolbar by PyrexKidd
in thread Quick-Buttons Toolbar by PyrexKidd

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.