Operating System - HP-UX
1825805 Members
2127 Online
109687 Solutions
New Discussion

Wanted: TK admin menu example

 
SOLVED
Go to solution
Craig A. Sharp
Super Advisor

Wanted: TK admin menu example

I would like to create a menu system for my servers for doing administrative stuff using TK. I have an ascii menu but want something a bit more user friendly. I would like to have the menu choices and descriptions of each choice,etc.
Does anyone have an example of what I am looking for?
12 REPLIES 12
H.Merijn Brand (procura
Honored Contributor

Re: Wanted: TK admin menu example

TK, or Perl/Tk?
I have a perl/Tk menu system (X11). Is that an option?

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
spex
Honored Contributor

Re: Wanted: TK admin menu example

Craig,

Hope these links help...

Tk::Menu in perl 5.6.1:
http://perl.enstimac.fr/perl5.6.1/site_perl/5.6.1/sun4-solaris/Tk/Menu.html

Perl/Tk FAQ:
http://www.lns.cornell.edu/~pvhp/ptk/ptkFAQ.html

Various Tcl software:
http://hpux.connect.org.uk/hppd/hpux/Tcl/

Useful ITRC thread:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=184217

Also consider doing a web-based front-end instead.

PCS
Craig A. Sharp
Super Advisor

Re: Wanted: TK admin menu example

Sorry I meant perl/tk...
H.Merijn Brand (procura
Honored Contributor

Re: Wanted: TK admin menu example

Spex, that Tk::Menu link is about a widget, not an application. That type of widget is used to build menu-bar entries in a window/screen

I can ask my boss if I can release my Tk Menu program as Open Source

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
spex
Honored Contributor

Re: Wanted: TK admin menu example

These all contain menu examples...

Writing GUI Applications in Perl/Tk:
http://www.perl.com/pub/a/2001/03/gui.html

Perl/Tk Menus: Past, Present and Future:
http://www.developer.com/lang/other/article.php/615201

Perl and the Tk Extension:
http://www.lehigh.edu/~sol0/ptk/tpj1.html

PCS
Craig A. Sharp
Super Advisor

Re: Wanted: TK admin menu example

Procura, that would be awesome...in the meantime, I will review the suggested links.
H.Merijn Brand (procura
Honored Contributor

Re: Wanted: TK admin menu example

OK, green light.

Several options now.

1. You give me points :)
2. I give you the current state, which still has some TODO items
3. You wait till I packaged it and put it on CPAN. That may take a while though

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Craig A. Sharp
Super Advisor

Re: Wanted: TK admin menu example

Ok, points given....Thanks to both for your help. Please send the code as is and maybe I can also help with the todo's!

H.Merijn Brand (procura
Honored Contributor
Solution

Re: Wanted: TK admin menu example

I see no given point (yet), but I have finished my first stab at open-sourcing this menu program.

http://www.xs4all.nl/~procura/cshmen-3.50.tgz

NO warranty
It will be available on CPAN (user ID HMBRAND) once PASUE has synced up

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Craig A. Sharp
Super Advisor

Re: Wanted: TK admin menu example

Whoops I did not hit submit...only reply..
Craig A. Sharp
Super Advisor

Re: Wanted: TK admin menu example

There we are....thank you for the code...I will give it a try!

Craig
H.Merijn Brand (procura
Honored Contributor

Re: Wanted: TK admin menu example

http://www.xs4all.nl/~hmbrand/cshmen-3.50_01.tgz

I forgot to package the README. Rather important in this stage, as the package has neither a configure nor a Makefile.PL

Please assign points to *all* answers. no points is better than not assign at all. This will inform other readers how useful an answer was.

--8<--- README
=head1 NAME

cshmen, xamen - Basic menu application in curses or perl/Tk

=head1 SYNOPSYS

# cshmen [-?] [-a] [-e] [-d] [-v] [-n] [-m dir] [menu]

# xamen [-?] [-a] [-e] [-d] [-v] [-n] [-m dir] [menu]

=head1 DESCRIPTION

cshmen is a low level recursive menu program using curses.
xamen is the perl/Tk translation for cshmen

=head1 INSTALLATION

As this was built for internal use only, there are no serious
attempts yet made to create a working environment for building
and installing.

$ make

Should build cshmen in the current folder. You might need to
change #include to #include and maybe
some lines in the Makefile too.

=head1 DOCUMENTATION

This is seriously missing in this dist, as the only available
documentation is written in Uniplex. In Dutch. Both pretty
useless for the OpenSource community.

=head1 Menu format

=head2 The menu files

A menu file consists of menu lines. Each line looks like

ID:MenuText:Command:State[:HelpFile]

=over 4

=item ID

Two ID's are required: "H" for Header, and "Q" for Footer. In these
two cases, the State is ignored (but still required).

The H-line will be used to display the menu title. The command may
optionally define a different environment for this menu (and all
the descendants).

The Q-line will be shown on the last line and is a placeholder for
the action. Text is shown, but Command is ignored.

For all the other lines ID denotes the line to display this item
on, optionally followed by a letter to use instead (default is the
line number). Lines 10 though 16 are indicated by 'A' through 'F'.

H:Home menu ::1
1:Text for line 1:echo line 1:1
3=F:Fortune :fortune:2
B:Test menu :M test_menu:1
Q:Stop ::1

=item MenuText

Free text to show in the menu. The colon is forbidden. and the
underscores are translated to space.

=item Command

The command to be invoked
A command can be a series of commands seperated by ' ; '. Whitespace
matters. Each command can have optional command line arguments,
redirection and a execution folder. Arguments can be questions.

Commands that start with 'M ' call a menu. No ' ; ' allowed. If you
*do* have a command 'M', use 'env'.

proc @Directory 1>/tmp/proc-1.log 2>>/tmp/proc-2.log -
?0QuestText[,[DefaultValue][,[Prefix][,[Options][,[HelpFile]]]]

=item State

0 = Not shown (hidden). Item cannot be selected
1 = Normal, active
2 = Normal, but wait after execution finishes with a user prompt

=item HelpFile

Optional help description for this item

=back

=head1 TODO

* Documentation: pod, manual page or serious readme. NO info!
* A better Makefile
* Some sort of install procedure
* example menu's
* See top of xamen

=head1 AUTHOR

H.Merijn Brand,

=head1 COPYRIGHT AND LICENSE

Copyright (C) 1986-2006 H.Merijn Brand, PROCURA B.V.

it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

=cut
-->8---

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn