How to build graphical interface using shell scripts and ncurses library ?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to build graphical interface using shell scripts and ncurses library ?
# 1  
Old 04-02-2009
How to build graphical interface using shell scripts and ncurses library ?

Hi,

(please don't move this question, as it refers to graphical animation solution, using shell scripts and a number of known graphical objects
and using of foreground and background process switch control shell scripts to get objects with refresh/ animation effect).

I will provide you with more details, describing the problem.

I am trying to learn and build graphical user interface for a Unix system,
accessed from MS Vista OS via putty opened terminal session, using shell scripts and box widgets from dialog.

One good example I am just testing is Unix dialog widgets

I attach below help file of dialog, to let you know, what widgets or boxes are already available.

I have already contacted Thomas. The problem is dialog project is 15 years old and no more maintained.
Based on ncurses library.

The key idea is
"
Usage: dialog <options> { --and-widget <options> }
where options are "common" options, followed by "box" options
"
So with --and-widget syntax, in theory, I can use more than 1 widget box
on a screen, and move between boxes, using tab.
In theory.
In practice such objects should be run in background to be kept alive for all the time, or a shell script displaying boxes should loop box objects to get animation, data refresh effect.


As only one object is run in background
tailboxbg
there is an excellent example
how to write a shell script, opening 3 widgets (boxes ) on a screen
and using tab to swap between boxes.

Example :
dialog --keep-window --begin 2 2 --yesno "" 0 0 \
--and-widget --keep-window --begin 4 4 --yesno "" 0 0 \
--and-widget --keep-window --begin 6 6 --yesno "" 0 0

I get 3 yesno windows on a screen.
Unfortunately clicking on yes in first box opens 2nd box and clicking yes in 2nd box, forces 3rd box to open.

The above process is called chaining or otherwise.

And I cannot use tab to switch between boxes, as clicking on yes, closes
widget application and what is seen is --keep-window (graphics only, not a object).

So my idea is to put each object into seperate shell script
and find out a solution and procedure, to run some shell scripts in background and have --keep-window for and in each shell script on.

I don't know how to set shell script as a background process & ?
And switch between background and foreground to get refresh effect.

Exactly. I am looking shell script solution, as dialog widgets use examples come as shell scripts.

I can't expect to write new boxes on myself in due time, as c + ncurses code looks really complicated.

thanks

Jack
------
dialog help
[admin@oo root]$ dialog
cdialog (ComeOn Dialog!) version 1.1-20080819
Copyright 2000-2007,2008 Thomas E. Dickey
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

* Display dialog boxes from shell scripts *

Usage: dialog <options> { --and-widget <options> }
where options are "common" options, followed by "box" options

Special options:
[--create-rc "file"]
Common options:
[--ascii-lines] [--aspect <ratio>] [--backtitle <backtitle>]
[--begin <y> <x>] [--cancel-label <str>] [--clear] [--colors]
[--column-separator <str>] [--cr-wrap] [--default-item <str>]
[--defaultno] [--exit-label <str>] [--extra-button]
[--extra-label <str>] [--help-button] [--help-label <str>]
[--help-status] [--ignore] [--input-fd <fd>] [--insecure]
[--item-help] [--keep-tite] [--keep-window] [--max-input <n>]
[--no-cancel] [--no-collapse] [--no-kill] [--no-label <str>]
[--no-lines] [--no-ok] [--no-shadow] [--nook] [--ok-label <str>]
[--output-fd <fd>] [--output-separator <str>] [--print-maxsize]
[--print-size] [--print-version] [--quoted] [--separate-output]
[--separate-widget <str>] [--shadow] [--single-quoted] [--size-err]
[--sleep <secs>] [--stderr] [--stdout] [--tab-correct] [--tab-len <n>]
[--timeout <secs>] [--title <title>] [--trace <file>] [--trim]
[--version] [--visit-items] [--yes-label <str>]
Box options:
--calendar <text> <height> <width> <day> <month> <year>
--checklist <text> <height> <width> <list height> <tag1> <item1> <status1>...
--dselect <directory> <height> <width>
--editbox <file> <height> <width>
--form <text> <height> <width> <form height> <label1> <l_y1> <l_x1> <item1> <i_y1> <i_x1> <flen1> <ilen1>...
--fselect <filepath> <height> <width>
--gauge <text> <height> <width> [<percent>]
--infobox <text> <height> <width>
--inputbox <text> <height> <width> [<init>]
--inputmenu <text> <height> <width> <menu height> <tag1> <item1>...
--menu <text> <height> <width> <menu height> <tag1> <item1>...
--mixedform <text> <height> <width> <form height> <label1> <l_y1> <l_x1> <item1> <i_y1> <i_x1> <flen1> <ilen1> <itype>...
--mixedgauge <text> <height> <width> <percent> <tag1> <item1>...
--msgbox <text> <height> <width>
--passwordbox <text> <height> <width> [<init>]
--passwordform <text> <height> <width> <form height> <label1> <l_y1> <l_x1> <item1> <i_y1> <i_x1> <flen1> <ilen1>...
--pause <text> <height> <width> <seconds>
--progressbox <height> <width>
--radiolist <text> <height> <width> <list height> <tag1> <item1> <status1>...
--tailbox <file> <height> <width>
--tailboxbg <file> <height> <width>
--textbox <file> <height> <width>
--timebox <text> <height> <width> <hour> <minute> <second>
--yesno <text> <height> <width>

Auto-size with height and width = 0. Maximize with height and width = -1.
Global-auto-size if also menu_height/list_height = 0.
---
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Need a graphical interface on AIX server to create database

Hello, Please suggest me the ways how to get graphical interface on AIX server.I need to create oracle database for which I need graphical access. Best regards, Vishal (4 Replies)
Discussion started by: Vishal_dba
4 Replies

2. Debian

Problem with graphical interface

Hi, i have problems with an installation of Debian i386 505 in a pc. The hardware it is a mother soyo with a chipset via. When i install the xorg, the installation it`s succesfull, but when i type startx, the pc don`t respond. I am from Argentina and my English it isn`t good. Sorry. (0 Replies)
Discussion started by: Kritar
0 Replies

3. Ubuntu

no graphical interface after installation

Hello everyone, After installing Ubuntu 8.10 from DVD the Operating System boots into text mode. How do I get the graphical user environment to load. The DVD includes a live/install that holds Intrepid Ibex (8.10) Thanks in advance for the help, Dirk (1 Reply)
Discussion started by: Dirk_
1 Replies

4. UNIX for Dummies Questions & Answers

ncurses not in library?

I tried to complile a text-based messenger program but, while configuring, got a message saying that ncurses wasn't found. Though it appears to be there... This is the program: http://sourceforge.net/project/showfiles.php?group_id=110124&package_id=119574&release_id=373164 I get the error... (5 Replies)
Discussion started by: riwa
5 Replies

5. Programming

ncurses and usb library conflict

Hi I am writing a piece of code using gcc-3.4.4 which uses usb library (-lusb) to interact with a small robot, getting inputs from sensors and sending commands back to motors. Now my problem is that when I use ncurses library in my code to get use of keyboard functionalities, the usb inputs do... (1 Reply)
Discussion started by: omoallemi
1 Replies

6. BSD

Graphical interface programming in FreeBSD

Hi ! I have a question... how can I make a program with a graphical interface in C ? I googled a little bit to see how can I do it, but I realised that almost everything (Qt, KDE, etc) is using C++ for graphical programming. Is there any chance to programm a user interface in C ? If it is, please... (3 Replies)
Discussion started by: Sergiu-IT
3 Replies

7. Shell Programming and Scripting

How to change the GRUB command line to graphical interface?

Hi, I am i new Unix linux user. I've installed the linux 9 and i uninstall it. the first time i install the linux, the GRUB show the graphical interface. But after i reinstall it again, the GRUB change to command line. I can't boot my comp now. What should I do? And i don't know how to deal with... (1 Reply)
Discussion started by: lee_chongeu
1 Replies

8. UNIX for Dummies Questions & Answers

Graphical Interface

While trying to install mandrake I click graphical install and the screen turns black ... why is it doing this? Here is what is going on ... I downloaded caldera, but i didn't know how to install it so I borrowed mandrake disks from a friend. I installed mandrake but in the middle there was... (11 Replies)
Discussion started by: OOnegative
11 Replies

9. UNIX for Advanced & Expert Users

graphical interface via remote login

I use telent or netterm to remotely login onto a linux sever, but I could only use the command-line interface. I want to know how can I use the graphical interface such as KDE or GNOME. Thanks a lot.:p (3 Replies)
Discussion started by: guanglei_li
3 Replies

10. Programming

curses (ncurses) library question

Hi again. I'm using the curses functions simply to output data to the screen in certain areas. Very simple, just using the full screen, no windows. The problem is that I'm calling mvprintw from within several child processes in the same session, and the output is going bananas. ie, no... (1 Reply)
Discussion started by: TelePlayer
1 Replies
Login or Register to Ask a Question