in reply to Re: iPad bells and whistles
in thread iPad bells and whistles

Hi Ken,

Thanks very much for this idea.

I just tried to run your code, as I've been using wxPerl, I needed to install Tk, but I got:

C:/msys/mingw/bin/gcc.exe -c -I.. -I.. -I../pTk/mTk/xlib -I. -Ibitmap +s -I.. -I. ./pTk/mTk/xlib -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCR +YPT -DUSE_ SITECUSTOMIZE -DPRIVLIB_LAST_IN_INC -DPERL_IMPLICIT_CONTEXT -DPERL_IMP +LICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX -DHASATTRIBUTE -fno-strict-aliasing + -mms-bitf ields -DPERLDLL -O2 -DVERSION=\"804.029\" -DXS_VERSION=\ +"804.029\" "-IC:\Perl\lib\CORE" -Wall -Wno-implicit-int -Wno-comment -Wno-unu +sed -D__US E_FIXED_PROTOTYPES__ xutil.c rc -fo tk.res -r -i . -i mTk\win\rc mTk\win\rc\tk.rc 'rc' is not recognized as an internal or external command, operable program or batch file. dmake.exe: Error code 129, while making 'tk.res' dmake.exe: Error code 255, while making 'pTk\libpTk.a' SREZIC/Tk-804.029.tar.gz C:\Perl\site\bin\dmake.exe -- NOT OK Running make test Can't test without successful make Running make install Make had returned bad status, install seems impossible Failed during this command: SREZIC/Tk-804.029.tar.gz : make NO
I'm going to check it out, but I wanted you to know that I'm on the case.

Regards

Steve

Replies are listed 'Best First'.
Re^3: iPad bells and whistles
by kcott (Archbishop) on Nov 24, 2010 at 00:39 UTC

    Perl/Tk has had its fair share of installation problems (see the CPAN Testers Matrix). Having said that, I'm running it successfully on Windows XP and Cygwin using Perl 5.12.0 on both; although, I probably needed to do a manual install in both cases. I'm using Strawberry Perl for MSWindows; I believe ActivePerl provides Tk as part of their default distribution. If you get past the make stage and make test fails, try jumping straight to make install - others on this site have said that works for them.

    I aimed to keep newer Perl features out of the prototype code so, while I developed it using 5.12.0, I don't think there's anything that isn't available on 5.8.x versions.

    Of course, rather than messing around with Tk, you may decide to just port the code to wxPerl. Most of the code is fairly standard Perl much of which I imagine you could retain as is; the GUI-specific parts are:

    • A main (top-level) window for the application (with geometry described above):
      my $mw = MainWindow->new(-title => 'Mouse Gesture Test'); $mw->geometry('1200x900+50+50');
    • A Text widget for testing (although any widget with scrolling capabilities should work) - adding scrollbars is a handy visual aid when developing:
      my $w_text = $mw->Scrolled('Text', -scrollbars => 'osoe', -wrap => 'none', )->pack(-fill => 'both', -expand => 1);
    • An event handler to call when mouse movement occurs:
      $w_text->bind('<Motion>', [\&mouse_gesture, Ev('x'), Ev('y')]);
    • An Exit button:
      $mw->Button(-text => q{Exit}, -command => sub { exit })->pack();
    • A means of scrolling the widget programmatically:
      $w->xviewScroll($xpos < $x ? 1 : -1, q{units}); ... $w->yviewScroll($ypos < $y ? 1 : -1, q{units});
    • Enough content in the widget so there's something to actually scroll - here I'm adding 500 lines each with a little over 500 characters:
      $w->insert('end', "This is line $_. It's really long ... $long_string\n" );

    -- Ken