Re: gtkdialog again (sorry) – How to use variables inside gtkdialog?

Johnny Rosenberg gurus.knugum at gmail.com
Thu Apr 25 21:59:37 UTC 2013


2013/4/22 Johnny Rosenberg <gurus.knugum at gmail.com>:
> I just can't figure it out. I saw an example (I think) but now I can't find it:
> Let's say that I have three combo boxes in a dialogue:
>
> blah blah
>
> <comboboxentry>
>     blah blah
>     <variable>y</variable>
>     blah blah
> </comboboxentry>
>
> <comboboxentry>
>     blah blah
>     <variable>x</variable>
>     blah blah
> </comboboxentry>
>
> <comboboxentry>
>     blah blah
>     <variable>z</variable>
>     blah blah
> </comboboxentry>
>
> Then I have an editable text box:
> <edit>
>     blah blah
>     <variable>Text</variable>
>     blah blah
> </edit>
>
> And finally an add button:
> <button label="Add">
>     blah blah
> </button>
>
> blah blah
>
> What I want to do is to select some combo box entries and click the
> add button. A new line should then be added to the editable text box,
> for instance (expressed in bash syntax):
> Text="${Text}\n${x}: ${y} – ${z}"
>
> I have tried the most obvious things, but nothing made me happy so far…
>
> I figured out how to copy the text (if I enter it manually directly to
> the box) to a file using the <output file> tag, but not how to get the
> text INTO the box without typing it manually…
>
> Sorry for bothering so much the last few days.
>
>
>
> Johnny Rosenberg


Okay, maybe too much text, who would ever care to read all that…?
So I just faked an image that maybe displays what I want to do:

http://ubuntuone.com/4yHWyFSSoJBKvafE8NHzHY

The dialogue labels are in Swedish, but that shouldn't matter much.
Here are some translations:
Instrument – (Musical) instrument
Utövare – Performer
Inspelningsplats – Recording location
Datum – Date
Lägg till – Add
Avbryt – Cancel
OK – OK

Stenungsund and Vänersborg are two Swedish municipalities, don't
bother about that…

Anyway, what I want to happen is, when I selected something in the
three combo boxes (and the three number fields representing a date)
and hit Add (Lägg till), I want a new line to be created in the Edit
field. When I have all the lines that I want, I will hit OK and the
dialogue should return all the lines as a string. The returning thing
works, but I still haven't figured out how to copy the contents of
those fields to a new line of the edit field. Is this possible at all?
I guess I need to use the variables somehow, but I just don't seem to
be able to use them inside the dialogue…

By the way, a Date widget would be nice, like the one in Zenity or Yad.


Thanks for all possible help, links and clues or whatever, that helps
me reach the next step.


Johnny Rosenberg




More information about the ubuntu-users mailing list