The time now is Tue 26 Jan 2021, 02:41
All times are UTC - 4 |
Author |
Message |
simargl
Joined: 11 Feb 2013 Posts: 572
|
Posted: Thu 02 May 2013, 06:47 Post subject:
|
|
.
Last edited by simargl on Sun 01 Sep 2013, 11:05; edited 1 time in total
|
Back to top
|
|
 |
thunor

Joined: 14 Oct 2010 Posts: 350 Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
|
Posted: Thu 02 May 2013, 11:33 Post subject:
|
|
This is the eventbox inside another eventbox border trick using some of the code from Sigmund's menu prototype just to illustrate what you can do (it might be of interest to somebody, it might not):
Code: | #!/bin/sh
[ -z $GTKDIALOG ] && GTKDIALOG=gtkdialog
## ---------------------------------------------------------------------
## Local Functions
## ---------------------------------------------------------------------
## Create a custom GTK+ 2 style for specific widgets.
funcgtkrcCreate() {
echo '
style "styleExterior" {
bg[NORMAL] = "#000000"
}
widget "*Exterior" style "styleExterior"
' > "$TMPDIR"/.gtkrc-2.0
GTK2_RC_FILES="$TMPDIR"/.gtkrc-2.0:~/.gtkrc-2.0
export GTK2_RC_FILES
}
## Create a custom GTK+ 3 style for specific widgets.
funcgtkcssCreate() {
echo '
#Exterior {
background-color: #000000
}
#Interior {
background-color: #ffffff
}
' > "$TMPDIR"/gtk.css
EXTRA_ARGS="$EXTRA_ARGS --styles $TMPDIR/gtk.css"
}
## ---------------------------------------------------------------------
## Main
## ---------------------------------------------------------------------
TMPDIR=/tmp/gtkdialog/examples/"`basename $0`"
mkdir -p "$TMPDIR"
EXTRA_ARGS=
case `$GTKDIALOG -v` in
*"GTK+ 3"*) funcgtkcssCreate ;;
*) funcgtkrcCreate ;;
esac
MAIN_DIALOG='
<window decorated="false" window-position="1">
<eventbox name="Exterior">
<eventbox name="Interior" border-width="5">
<vbox spacing="2">
<hbox spacing="0">
<pixmap height-request="20" icon-size="1"
space-expand="false" space-fill="false">
<input file stock="gtk-add"></input>
</pixmap>
<button height-request="20" xalign="0" can-focus="no" relief="2">
<label>" This could have been a nice ADD menuitem, but menu is too narrow"</label>
</button>
</hbox>
<hbox spacing="0">
<pixmap height-request="20" icon-size="1"
space-expand="false" space-fill="false">
<input file stock="gtk-add"></input>
</pixmap>
<button height-request="20" xalign="0" can-focus="no" relief="2">
<label>" Another nice ADD menuitem"</label>
</button>
</hbox>
</vbox>
</eventbox>
</eventbox>
</window>
'
export MAIN_DIALOG
case $1 in
-d | --dump) echo "$MAIN_DIALOG" ;;
*) $GTKDIALOG --space-expand=true --space-fill=true --program=MAIN_DIALOG $EXTRA_ARGS ;;
esac |
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 6629 Location: Valåmoen, Norway
|
Posted: Thu 02 May 2013, 11:41 Post subject:
|
|
Nifty
_________________ Stardust resources
|
Back to top
|
|
 |
thunor

Joined: 14 Oct 2010 Posts: 350 Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
|
Posted: Thu 02 May 2013, 12:36 Post subject:
|
|
zigbert wrote: | Nifty  |
Instead of painting the background to a specific colour, you could tile it with a black square 50% opaque so for the most part this would give the impression of a border regardless of theme.
The gtkrc and gtk.css code for bitmaps is:
Code: | GTK+ 2:
pixmap_path "/image/folder"
style "styleBgPixmap" {
bg_pixmap[NORMAL] = "myblacksquare.png"
}
widget "*BgPixmap" style "styleBgPixmap"
GTK+ 3:
#BgPixmap {
background-image: url("/image/folder/myblacksquare.png")
} |
Anyway, since the eventbox interior in gtk2 appears to be solid by default and in gtk3 transparent by default you might have to override the user's theme.
I'm just throwing stuff in.
|
Back to top
|
|
 |
guraknugen
Joined: 19 May 2013 Posts: 1
|
Posted: Sun 19 May 2013, 06:32 Post subject:
Using variables in dialogue Subject description: How do you do that…? |
|
I am not sure if this is the right place to ask this, but I didn't find anywhere else to go…
Let's say that I create a window with a few items on it. One of them is a text field (I think it's called ”editor” in Gtkdialog language…) and there are also two combo boxes and an ”add button”.
Now, as a user, I want to select something in the combo boxes, let's say a name, like ”John Doe”, and a musical instrument like ”Guitar”. The next thing the user is expected to do is to click Add.
The Add button is supposed to add some text to the text field (”Editor”), keeping the window open for further actions. In this case, the text added could be something like:
The idea is to fill the field with text by clicking combo boxes and also being able to edit the text manually directly in the text field. For instance, if I click like suggested above, I might manually want to edit the text to:
Anyway, I just can't figure out how to do this. I'm trying to using that Variable tag thing, but I can't find a way for them to expand. Is this possible at all or am I better off learning Python and PyGTK instead…? I do some C programming (not very advanced), but I never worked with GTK+, so I guess there's a lot to learn, so I thought that gtkdialog could be a ”shortcut” to obtain simple things like this…
If someone know a better place to ask questions like this, please give me a link or something…
|
Back to top
|
|
 |
DocSalvage

Joined: 30 Jun 2012 Posts: 11 Location: Tallahassee, FL, USA
|
Posted: Sun 19 May 2013, 16:21 Post subject:
Line continuation within tags |
|
I've discovered some unexpected behavior. (at least under bash 4.1.0(1) as of gtkdialog 0.8.4 r503M) and am posting for feedback...
PROBLEM
In coding GtkDialog, attributes often extend far more than a comfortable screen width.
Having many attributes off-screen, accessible only by scrolling, is error-prone and the editor's word-wrapping may not improve readability.
Using the bash backslash (\) for line-continuation introduces perceptional "noise" that some find distracting.
Using an editor, such as Geany, set to strip trailing spaces leaves no spaces between attributes and thus generates an error. (Indentation tabs and spaces apparently are ignored.)
SOLUTIONS
However, experimentation has revealed that there are actually several options for achieving line-continuation in tags.
As is documented and used in several standard examples, no line-continuation characters are needed for the common case of assigning the string of code to an environment variable as in...
Code: | export MAIN_DIALOG='
<entry
file-monitor="true"
fs-action="file"
fs-folder=""
fs-filters-mime="text/plain|text/html"
fs-title="File Select"
space-expand="true"
space-fill="true">'
|
However, if the editor is set to strip trailing spaces, echoing the code fails...
Code: | echo '
<entry
file-monitor="true"
fs-action="file"
fs-folder=""
fs-filters-mime="text/plain|text/html"
fs-title="File Select"
space-expand="true"
space-fill="true">' >>gtk_code_file
|
ERROR : gtkdialog: Error in line ___, near token 'string': syntax error
• The well-known bash backslash (\) works as expected as long as it is preceded by a space to separate the attributes, as in...
Code: |
echo ' \
<entry \
file-monitor="true" \
fs-action="file" \
fs-folder="" \
fs-filters-mime="text/plain|text/html" \
fs-title="File Select" \
space-expand="true" \
space-fill="true">' >>gtk_code_file
|
• But experiments reveal that 3-dot-ellipsis (...), comas (,), and probably other characters also work and may be less distracting. It's possible that some extraneous characters are being tolerated and ignored, thus leading to this behavior.
Code: |
echo '<entry ...
file-monitor="true" ,
fs-action="file" ,
fs-folder="" .
fs-filters-mime="text/plain|text/html" ,
fs-title="File Select" ,
space-expand="true" ,
space-fill="true">' >>gtk_code_file
|
• The most portable solution is probably to just turn off the stripping of trailing spaces in the editor and insuring each line ends with at least one space ("_" below indicates the invisible trailing space)...
Code: |
echo '<entry _
file-monitor="true"_
fs-action="file"_
fs-folder=""_
fs-filters-mime="text/plain|text/html"_
fs-title="File Select"_
space-expand="true"_
space-fill="true">' >>gtk_code_file
|
RESOURCES
_________________ DocSalvager (a.k.a. DocSalvage)
www.docsalvage.info, www.softwarerevisions.net
|
Back to top
|
|
 |
don570

Joined: 10 Mar 2010 Posts: 5524 Location: Ontario
|
Posted: Mon 10 Jun 2013, 20:08 Post subject:
|
|
I have built an app that does a simple right click copy of a
file or folder, but I found a strange bug.
Reference:
copy-fast-1.4.pet
I believe that there is
an incompatibility with pwidgets and 'visible' tag
I use an invisible entry box to form the 'Add' button.
Here is the code. See 'visible="false"'
When I tested on Precise NOP note that the invisible entry box
is visible . The app can still be used.
__________________________________________________
|
Back to top
|
|
 |
scsijon
Joined: 23 May 2007 Posts: 1600 Location: the australian mallee
|
Posted: Mon 10 Jun 2013, 22:41 Post subject:
|
|
@don570, same result with the latest wary and racy. (Extra box appearing.)
|
Back to top
|
|
 |
don570

Joined: 10 Mar 2010 Posts: 5524 Location: Ontario
|
Posted: Tue 11 Jun 2013, 16:38 Post subject:
|
|
Hmmm, I tested on Wolx which is Wary 5 (I believe) but has the
openbox window manager and it worked. I assumed that there wasn't
a problem with Wary5
Drat! A lot more work.
________________________________________
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1538 Location: Ukraine
|
Posted: Wed 12 Jun 2013, 05:59 Post subject:
|
|
Dear Don,
Just so you know. Your v. 1.4 works fine with Lucid and Thunor's latest gtkdialog. No invisible window showing for me, but then my gtk theme fills the background with a stippled pixbuf, so my observation regarding visibility/invisibility may not be too universal.
With thanks and kind regards,
vovchik
|
Back to top
|
|
 |
don570

Joined: 10 Mar 2010 Posts: 5524 Location: Ontario
|
Posted: Wed 12 Jun 2013, 19:31 Post subject:
|
|
I tested on wary 5.4.9 and it's fine.
(see image)
That's why I think pwidgets is involved.
__________________________________________
|
Back to top
|
|
 |
scsijon
Joined: 23 May 2007 Posts: 1600 Location: the australian mallee
|
Posted: Thu 13 Jun 2013, 01:27 Post subject:
|
|
don570 wrote: | I tested on wary 5.4.9 and it's fine.
(see image)
That's why I think pwidgets is involved.
__________________________________________ |
ahah! and 1.6 is found where please? I was using 1.4, what I thought was the latest in a message just 6 above.
EDIT: just found it, it's in the same topic. I shall download and test.
No, still there. Moving the problem to copyfast thread.
|
Back to top
|
|
 |
simargl
Joined: 11 Feb 2013 Posts: 572
|
Posted: Fri 14 Jun 2013, 04:34 Post subject:
|
|
.
Last edited by simargl on Sun 01 Sep 2013, 11:15; edited 1 time in total
|
Back to top
|
|
 |
DocSalvage

Joined: 30 Jun 2012 Posts: 11 Location: Tallahassee, FL, USA
|
Posted: Sat 27 Jul 2013, 13:10 Post subject:
GtkDialog Variables Subject description: Order of Processing |
|
Thunor,
I love GtkDialog 0.8.3 and am working on a fairly large conversion application using it.
In the process, I'm putting together documentation regarding variable passing and was hoping you could confirm if the following statement is correct and straighten me me out if not?
"On startup, GtkDialog processes all <input> and <output> directives for all widgets before processing any <action> directives for any widgets."
If this is all covered somewhere, I haven't been a able to find it. It has taken several days of trial and error to reach this point.
Happy Coding!
_________________ DocSalvager (a.k.a. DocSalvage)
www.docsalvage.info, www.softwarerevisions.net
|
Back to top
|
|
 |
recobayu

Joined: 15 Sep 2010 Posts: 389 Location: indonesia
|
Posted: Wed 21 Aug 2013, 05:25 Post subject:
|
|
Hi All,
I want to ask a question. Now I make a simple menu, but i have a problem in adding button. Can I add 4 buttons when I input "4" in entrybox and press enter?
Something trick I do is close gtkdialog and then show new window that has 4 buttons. But, do anyone know something better?
Thank you.
|
Back to top
|
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|