Tk::Help - Simple widget for creating a help system for Perl/Tk applications |
Tk::Help - Simple widget for creating a help system for Perl/Tk applications
use Tk::Help; my $help = $main->Help(-variable => \@array);
This is an answer to a personal need to be able to create help systems for my Perl/Tk applications. Originally, I just created a really big dialog and formatted all the text, which was tedious and clumsy. I wanted to create something that looked 'similar' to the Windows help. This is by no means as featured or fluid as the Windows help, but it should provide a (somewhat) simple means to create a help dialog where all someone should need to do is create the array with their help content.
white
.
10
.
8
.
black
otherwise.
9
.
black
otherwise.
0
.
40
.
30
for Windows
and 40
otherwise.
(Tk::NORMAL_BG)
.
0
.
hand2
cursor. To use the OS's
default cursor, set -listcursor => 'default'
.
8
.
black
otherwise.
-listbackground
is set to.
blue
.
HList
.
25
.
0
.
'Help'
.
use Tk; use Tk::Help;
my $main = MainWindow->new(-title => "My Application"); $main->configure(-menu => my $menubar = $main->Menu); my $filemenu = $menubar->cascade(-label => "~File", -tearoff => 0); my $helpmenu = $menubar->cascade(-label => "~Help", -tearoff => 0); $filemenu->command(-label => "E~xit", -command => sub{$main->destroy}); $helpmenu->command(-label => "~Help Contents", -command => sub{showhelp()});
MainLoop; 1;
sub showhelp { my @helparray = ([{-title => "My Application", -header => "My Application Help", -text => "This is a description of my application for the help."}], [{-title => "Section 1", -header => "\n\nSection 1 Help", -text => ""}, {-title => "1st Feature", -header => "The 1st Feature", -text => "This is the text describing the 1st feature of section 1."}, {-title => "2nd Feature", -header => "The 2nd Feature", -text => "This is the text describing the 2nd feature of section 1."}], [{-title => "Section 2", -header => "\n\nSection 2 Help", -text => ""}, {-title => "1st Feature", -header => "The 1st Feature", -text => "This is the text describing the 1st feature of section 2."}, {-title => "2nd Feature", -header => "The 2nd Feature", -text => "This is the text describing the 2nd feature of section 2."}]);
my $helpicon = $main->Photo(-file => "/path/to/some/gif/or/bmp"); my $help = $main->Help(-icon => \$helpicon, -title => "My Application - Help", -variable => \@helparray); }
- Bind mouse events to the list items to create a mouseover and mouseout effect. - Figure out how to remove the dashed line around a selected item in the list. - Add individual font family switches for each text group.
Tk::Toplevel, Tk::HList, Tk::Tree
help
Doug Gruber <dougthug@cpan.org> http://www.dougthug.com/
Copyright (c) 2005 Doug Gruber. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Tk::Help - Simple widget for creating a help system for Perl/Tk applications |