ElAdnan / gtkdialog

Automatically exported from code.google.com/p/gtkdialog
GNU General Public License v2.0
0 stars 0 forks source link

Save selection on TREE widget #64

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi Thunor,

It's possible to allow tree and table widgets, save selected data on file?

At this moment, this widgets can save all data in a file.

Regards!

Original issue reported on code.google.com by matiasba...@gmail.com on 16 Jan 2013 at 9:46

GoogleCodeExporter commented 8 years ago
Sorry for my english:

Corrected question:

It's possible to allow tree and table widgets, save selected data to the ouput 
file?

Original comment by matiasba...@gmail.com on 16 Jan 2013 at 9:51

GoogleCodeExporter commented 8 years ago
Hi matiasbatero.mdq

The tree and table widgets' variables contain a list of the selected items.

Example:

------------------------------------------------------------------------
#!/bin/sh

MAIN_DIALOG='
<window>
    <vbox>
        <tree selection-mode="3" exported-column="2">
            <variable>TREE</variable>
            <label>x0|x1|x2|x3</label>
            <item>"y0x0|y0x1|y0x2|y0x3"</item>
            <item>"y1x0|y1x1|y1x2|y1x3"</item>
            <item>"y2x0|y2x1|y2x2|y2x3"</item>
        </tree>
        <hbox homogeneous="true">
            <button use-stock="true" label="gtk-save">
                <action>echo "$TREE" > output.txt</action>
            </button>
            <button use-stock="true" label="gtk-quit"></button>
        </hbox>
    </vbox>
</window>
'
export MAIN_DIALOG

gtkdialog --program=MAIN_DIALOG
------------------------------------------------------------------------

Only the exported-column is saved though, not all columns.

Regards,
Thunor

Original comment by thunor...@hotmail.com on 18 Jan 2013 at 12:22

GoogleCodeExporter commented 8 years ago
It works perfectly! Thanks!!!

When i tried to do it, i used the <ouput file>file</ouput> and then, a button 
with action <action>save:TREE</action>. But always de ouput file contains all 
widget data (no the selection).
So I thought that it might be a limitation.

Regards,
Matías Gastón

Original comment by matiasba...@gmail.com on 21 Jan 2013 at 1:16

GoogleCodeExporter commented 8 years ago
Good :)

Remember that if you give a widget a variable name then the variable will 
contain the widget's data which could be text or selected rows or a true/false 
state depending on the widget. These variables are exported to the shell when 
any signal is emitted so you can reference these variables inside an action. 
<output file> is another faster way to access a widget's data but it generally 
dumps all of it.

I'll close this issue now.

Cheers,
Thunor

Original comment by thunor...@hotmail.com on 23 Jan 2013 at 1:54