Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Just another Perl shrine
 
PerlMonks  

Zinc ejecting type effect(maybe clipping is the right word).

by Anonymous Monk
on Jul 06, 2006 at 06:27 UTC ( [id://559536]=perlquestion: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi all...

Looking for a simple example of an ejecting type effect(using zinc), for an "options window", so as to make it look like, say from the slide part of the/a window - something would open(eject) so that you can then see the options section.

# Am on Windows XP Home

# With ActiveState ActivePerl 5.8.7 Build 815

# Also use EnginSite Perl Editor LITE

  • Comment on Zinc ejecting type effect(maybe clipping is the right word).

Replies are listed 'Best First'.
Re: Zinc ejecting type effect(maybe clipping is the right word).
by shmem (Chancellor) on Jul 06, 2006 at 09:29 UTC
    Ejecting type effect? hmm, maybe you mean the "clay tablet printer" (from the pink camel book) used by Job to generate his reports about daughters and camels? but then, using Zinc? (Zn, 65.409 g/mol)

    What's the "slide part" of a window? what window? may I guess "a browser window"? "would open(eject)" to see the options section from what?

    After some minutes of wild guessing I come to the conclusion that you mean something like "hiermenus" in JavaScript. But then, maybe not.

    Please read How do I post a question effectively?.

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
      I think Tk::Zinc is meant with Zinc...
Re: Zinc ejecting type effect(maybe clipping is the right word).
by zentara (Cardinal) on Jul 06, 2006 at 11:26 UTC
    Well this can get very complicated in a hurry, because you are very vague in the question, but here is a start on what I "think" you want. I hard-coded the font size in this example, so you may need to work on that aspect. Just move your mouse over the orange bar on the left.
    #!/usr/bin/perl use warnings; use strict; use Tk; use Tk::Zinc; my $mw = MainWindow->new; $mw->geometry("700x600"); my $zinc = $mw->Zinc(-width => 700, -height => 565, -backcolor => 'black', -borderwidth => 3, -relief => 'sunken', )->pack; my $closebutton = $mw->Button(-text => 'Exit', -command => sub{Tk::exi +t(0)}) ->pack; $zinc->fontCreate( "fonta", -family => 'arial', -size => -30, -weight => 'normal' ); my $menugroup = $zinc->add('group',1, -visible=>1, -sensitive =>1, -tags => ['menu'], ); #move off screen leaving a slight visible bar $zinc->translate($menugroup,-25 ,0 ); my $menubox = $zinc->add('rectangle',$menugroup, [[0, 0], [35,700] ], -filled => 1, -fillcolor => 'orange', -linewidth => 2, -linecolor => '#000000', -priority => 1, -tags => ['menu'], ); my %menuitems; my $y = 5; for my $item ('a'.. 'm'){ $menuitems{$item}{'item'} = $zinc->add( 'text', $menugroup, -position => [ 5, $y ], -text => $item, -font => 'fonta', -tags => ['menuitem','menu',$item] ); $menuitems{$item}{'location'} = $y; $y += 40; $zinc->bind('menuitem', '<1>', sub {&Selected()}); } $zinc->bind( 'menu', '<Enter>', sub {&Slide_open()}); $zinc->bind( 'menu', '<Leave>', sub {&Slide_close()}); MainLoop; sub Slide_open{ $zinc->translate($menugroup, 25 ,0 ); } sub Slide_close{ $zinc->translate($menugroup, -25 ,0 ); } sub Selected { my $curr_object = $zinc->find('withtag','current'); my @list =(); my $item; if(defined $curr_object){ # print "curr->",@$curr_object,"\n"; #array dereference (@list) = $zinc->gettags($curr_object); ($item) = grep /\b\w{1}\b/g, @list; print "item->$item\n"; } else {return} }

    I'm not really a human, but I play one on earth. Cogito ergo sum a bum
Re: Zinc ejecting type effect(maybe clipping is the right word).
by zentara (Cardinal) on Jul 06, 2006 at 12:18 UTC
      Thanks zentara...

      If you remember me, it's for my rotatable gismo's window(the window/**** that is rotated by the gismo).

      Will go through you script soon... Thanks again.

        Hi, it dawned on me that you may be looking for "balloons" on Zinc. Balloons are little windows that "pop up" when your mouse is over an item. There is a trick to making them work on Zinc, so if you are after "balloons", let me know and I'll post a few examples.

        I'm not really a human, but I play one on earth. Cogito ergo sum a bum

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://559536]
Approved by GrandFather
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.