LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   zenity editable list help (https://www.linuxquestions.org/questions/programming-9/zenity-editable-list-help-821461/)

technononsense 07-22-2010 06:34 AM

zenity editable list help
 
I'm trying to use zenity in a bash script to display a .csv file using '--list' to allow the user to edit some of the values.

I can display it fine but i'm unsure how to edit the data? all i can get is whichever line is highlited when hitting ok on the zenity dialog to print.

the data in the csv is arranged:
<prod>,<disc>,<qty>,<type>,<location>

Can anyone point me in the right direction?

tonyfreeman 07-22-2010 08:36 PM

You need to use the '--print-column=ALL' option in order to print out the entire line you made edits to.

I suggest adding a hidden column that will act as a key and using the --seperator=, because you are using a CSV file.

Your user cannot edit the key, so that way when you get the output on the command line, you can use that key as a common denominator with your CSV file to replace values.

Example:

Code:

zenity --list --editable --print-column=ALL --hide-column=1 --separator=, --column=key --column=prod --column=disc --column=qty --column=type --column=location 000 a ca ca ac ca 001 b cb cb cb cb 002 c cc cc cc cc
I do my edits by adding a bunch of z's to the b (or 001) row and click the OK button to get this:

Code:

001,bzzzz,cbzzzz,cbzzz,cbzzz,cbzzz
You can then use the 001 to search your CSV and replace the values.


All times are GMT -5. The time now is 07:33 AM.