Page 1 of 1

How to use a GTK horizontal scroll bar for a progress bar?

Posted: Mon 12 Oct 2009, 06:22
by sunburnt
I wrote a script to track the percent of a file that has been copied.
Now I need a graphical display, a horizontal scroll bar is the easiest way.
I need the scroll bar to popup and it`s position controlled by my script.

I`ve looked at GTK before and couldn`t make any sense of it.
I couldn`t get anything to work in GTK from a Bash script.
This will be a good way to begin my understanding of how to use GTK.

In Visual Basic this is a snap to do, I would even make an ActiveX of it.

Posted: Mon 12 Oct 2009, 12:33
by MU

Code: Select all

#!/bin/bash

percent=0
(
while test $percent != 110
do
echo $percent
percent=`expr $percent + 10`
sleep 1
done
) |
Xdialog --title "Gauge works!" --gauge "This is how a gauge appears on the command line" 10 60 0
greets, Mark (currently 1 week in holiday, so not posting much)

Posted: Tue 13 Oct 2009, 04:35
by Pizzasgood
Just a small point: that works fine as a script, but if you wanted to actually type those commands into the terminal and run it that way, the string with the exclamation mark in it would need to use single-quotes rather than double-quotes (or be omitted). Otherwise it gives an error.

Works fine as a script though.

Posted: Tue 13 Oct 2009, 21:06
by sunburnt
Thanks Pizzasgood; Man this is a cool forum... I love it!

MU; I completely forgot about the xDialog gauge control.
I didn`t think there was one... Got a nice CL copy working with a GUI.

Now I`m thinking a full blown file browser like WinExplorer.
So I`m looking at gtkDialog controls and I can`t see how the tree works.
It has sub nodes, but I don`t see how they`re controlled, really odd...
xDialogs treeview is easy to control, it`s a little weird but that`s xDialog.

Posted: Tue 13 Oct 2009, 21:17
by sunburnt
Seems that the gtkDialog-2 tree sub branches the item if it`s the same as the last item.
But it does not seem to have any method of control over the branch`s structure.
The original tree_multicolumn control has 2 levels of branches.
But if I modify it then there`s only 2 levels, really odd...

I asked zigbert and he didn`t know... Any ideas anyone???