- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Help with dtksh
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2001 06:20 AM
03-14-2001 06:20 AM
I am not familar with dtksh, so it appears a very scary thing to me. =)
I am hoping to find/create a dtksh script that creates a static GUI widget with buttons that can change color based on the state of file/flags.
Example: a gui widget pops up with 3 buttons. one button labeled "process A" is red, other button labeled "process B" is yellow, and button "process C" is green. processA's button is red because the script read in a flag_state from a file...
Any ideas or script alreay out there similar to this logic ?
Thanks In Advance for Any/All Help !
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2001 08:59 AM
03-14-2001 08:59 AM
Re: Help with dtksh
I once looked at dtksh to see how it worked, and wrote a very little script that displays 3 buttons and exits when pressing on them, but I prefer perl/Tk :o) :
--snip--
#!/usr/dt/bin/dtksh
alias BUTTON_1_CB=exit
alias BUTTON_2_CB=exit
alias BUTTON_3_CB=exit
XtInitialize TOPLEVEL my_form "My form" "$@"
XmCreateForm FORM $TOPLEVEL main_form width:320 height:150
XmCreatePushButton BUTTON_1 $FORM button_1 labelString:"Process 1" x:10 y:100 width:100 height:40
XtAddCallback $BUTTON_1 activateCallback BUTTON_1_CB
XmCreatePushButton BUTTON_2 $FORM button_2 labelString:"Process 2" x:110 y:100 width:100 height:40
XtAddCallback $BUTTON_2 activateCallback BUTTON_2_CB
XmCreatePushButton BUTTON_3 $FORM button_3 labelString:"Process 3" x:210 y:100 width:100 height:40
XtAddCallback $BUTTON_3 activateCallback BUTTON_3_CB
XtManageChildren $BUTTON_1 $BUTTON_2 $BUTTON_3
XtManageChildren $FORM
XtRealizeWidget $TOPLEVEL
XtMainLoop
--snip--
I found an example script (font_chooser.dtksh - see in attachment) that may help you (about different widgets that can be created and so on). If you know the X API, then dtksh shouldn't be a problem for you.
Wishing you luck,
Best regards.
Fred.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2001 08:18 AM
03-15-2001 08:18 AM
Re: Help with dtksh
I have attached an example that reads values from a file and sets different widget colors for different value ranges.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2001 01:38 PM
03-20-2001 01:38 PM
Re: Help with dtksh
Mike,
In dtksh, how would I re-read the input file automatically in the script, say every 300 seconds, and force the values to be revaluated, and change colors if values changed ?
Or should I reference the *.dtksh file from a normal shell script that is in a loop, destroying and remaking the window every 5 min ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2001 10:02 AM
03-21-2001 10:02 AM
SolutionThe example uses an associative array to keep track of which label widget represents each name from the status file. That is a nice ksh93 feature that uses a string as an array index. You can read more about that and other ksh93 features using "man ksh93" on HP-UX 10.20 or "man -M /usr/dt/share/man ksh" on HP-UX 11.00.
The example only accumulates widgets, so a status name that is removed from the file will continue to have a label. You could use XtDestroyWidget to remove names that no longer appear in the status file.