The following script is an basic attempt at simulating a Windows 8 (WinRT, Metro, etc...) application GUI.
The main features are fullscreen only, no chrome, and a top and bottom app bar that are displayed when the cursor (or finger on touch screens) is at the top/bottom of the screen, and hidden otherwise.

I have used text labels on the "app bars" for demonstration purposes, a real app would have buttons that do things in place of the text labels.

#!/usr/bin/perl use warnings; use strict; use Tk; #create a new MainWindow my $mw = MainWindow->new( -background => 'black' ); #fullscreen $mw->geometry($mw->screenwidth.'x'.$mw->screenheight); #remove window chrome $mw->overrideredirect(1); #create a Tk::Frame to act as the top app bar hotspot. my $top_appbar = $mw->Frame( -background => $mw->cget(-background), -h +eight => 10 )->pack( -side => 'top', -fill => 'x' ); $top_appbar->bind('<Any-Enter>' => sub { \&AppBar($top_appbar, 'show', + 'top'); } ); $top_appbar->bind('<Any-Leave>' => sub { \&AppBar($top_appbar, 'hide', + 'top'); } ); #create a Tk::Frame to act as the bottom app bar hotspot my $bottom_appbar = $mw->Frame( -background => $mw->cget(-background), + -height => 10 )->pack( -side => 'bottom', -fill => 'x' ); $bottom_appbar->bind('<Any-Enter>' => sub { \&AppBar($bottom_appbar, ' +show', 'bottom'); } ); $bottom_appbar->bind('<Any-Leave>' => sub { \&AppBar($bottom_appbar, ' +hide', 'bottom'); } ); #create a Tk::Frame to hold the application's content my $content = $mw->Frame( -background => $mw->cget(-background), -heig +ht => $mw->screenheight-20 )->pack( -fill => 'x' ); $content->Label( -text => 'This is where the application content is di +splayed (buttons, images, etc...)', -background => $mw->cget(-backgro +und), -foreground => 'gray' )->pack(); sub AppBar { my $self = shift; my $method = shift; my $name = shift; if ($method eq 'show'){ #change the appbar's height and color to make it visable and u +seable $self->configure( -background => 'gray' ); $self->configure( -height => 50) if $name eq 'top'; if ( $name eq 'top' ){ $top_appbar->{label1} = $top_appbar->Label( -text => 'The +navigation bar, or top app bar, is the recommended place to put navig +ation controls that let the user access other areas of the app (butto +ns).', -background => 'gray', -foreground => 'black' )->pack( -side = +> 'left' ); } elsif ( $name eq 'bottom' ){ $bottom_appbar->{label1} = $bottom_appbar->Label( -text => + 'The bottom app bar is the recommended place to put commands (button +s).', -background => 'gray', -foreground => 'black' )->pack( -side = +> 'left' ); $self->configure( -height => 50); $mw->configure( -height => $mw->screenheight-60 ); } } elsif ($method eq 'hide'){ #change the appbar's height and color to make it hidden and no +t useable $self->configure( -background => $mw->cget(-background) ); $self->configure( -height => 10) if $name eq 'top'; if ( $name eq 'top'){ $top_appbar->{label1}->packForget(); } elsif ( $name eq 'bottom' ){ $bottom_appbar->{label1}->packForget(); $self->configure( -height => 10 ); $mw->configure( -height => $mw->screenheight-20 ); } } $mw->update(); } $mw->MainLoop();

In reply to Re: WinRT, Metro, Windows 8 by bcarroll
in thread WinRT, Metro, Windows 8 by bcarroll

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.