Sunday, September 13, 2009

[Level 2] Shell Interactive With Zenity Episode 9 -- text-info (Finished)

If you want to show a multi-line text info, you can use the option "--text-info". Ths Synopsis as below:

     zenity --text-info [--title=title] [--window-icon=path]  [--width=width]   [--height=height]   [--timeout=seconds]   [--filename=path] [--editable]

Just like "--calendar", if you press "ESC" key or click button "Cancel", the return code will be "1". If you select one option and click "OK", zenity will response the option and return the code will be "0". And also the same effect about the options "--title", "--timeout"...etc, for saving your time, please refer to the previous post "[Level 2] Shell Interactive With Zenity Episode 1 -- calendar", too.

The command that you can try is "zenity --text-info". Ex.
# zenity --text-info

In above case, the text column is not editable, and when you click the button "Close" the terminal won't show any response.

If you want the user to modify it, you can use the option "--editable". Ex.
# zenity --text-info --editable
Hello world!

After you key in "Hello world!" in the column and click the button "Close", the ternimal will respose the the words you type.

If you want the text-info diagram to show the content of file, you have two way to implement it.
Ex 1.
# cat /etc/system | zenity --text-info
Ex 2.
# zenity --text-info --filename=/etc/system

Wish this helps.

Stanley Huang