Click here to Skip to main content
15,886,860 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi is possible insert inside of gui created in zenity the combobox for choice what i want ?

What I have tried:

i try to code but not work
Bash
#!/bin/bash

# Definisce la dimensione della finestra
width=800
height=900

# Array contenente le opzioni del menu a tendina
options=("USDT" "BTC" "BUSD" "EUR" "ETH" "BNB" "DAI" "GUSD" "UST" "VAI" "HUSD" "USDN" "TUSD" "PAX" "USDC" "IL_RESTO")

# Mostra il menu a tendina per selezionare una crypto base
selected=$(zenity --forms --title="Aggiungi Amico" \
        --text="Seleziona una crypto base dal menu a tendina:" \
        --add-combo="Crypto Base" --combo-values="${options[@]}" \
        --add-list --title="Contenuto della tabella $table" --text="Ecco il contenuto della tabella $table:" --column="Simbolo" --column="Valore Medio (%)" --column="Quantità è Zero?" --column="Valore che si ripete di +" $formatted_content --width=$width --height=$height \
        --separator="," \
        --width=$width --height=$height)

# Aggiunge i valori inseriti dal'utente nel file csv
echo "$selected" >> addr.csv

# Verifica lo stato di uscita di zenity e stampa un messaggio di conseguenza
if [ "$?" -eq 0 ]; then
    echo "Amico aggiunto."
elif [ "$?" -eq 1 ]; then
    echo "Nessun amico aggiunto."
else
    echo "Si è verificato un errore inaspettato."
fi
Posted
Updated 21-Mar-23 5:41am
v2

A quick look at the manual at Forms Dialog[^] shows that the forms dialog does not include the options --add-combo or --add-list.
 
Share this answer
 
look help nanual in shell and you see :
zenity --help-all
Usage:
  zenity [OPTION…]

Help Options:
  -h, --help                                        Show help options
  --help-all                                        Show all help options
  --help-general                                    Show general options
  --help-calendar                                   Show calendar options
  --help-entry                                      Show text entry options
  --help-error                                      Show error options
  --help-info                                       Show info options
  --help-file-selection                             Show file selection options
  --help-list                                       Show list options
  --help-notification                               Show notification icon options
  --help-progress                                   Show progress options
  --help-question                                   Show question options
  --help-warning                                    Show warning options
  --help-scale                                      Show scale options
  --help-text-info                                  Show text information options
  --help-color-selection                            Show color selection options
  --help-password                                   Show password dialog options
  --help-forms                                      Show forms dialog options
  --help-misc                                       Show miscellaneous options
  --help-gtk                                        Show GTK+ Options

General options
  --title=TITLE                                     Set the dialog title
  --window-icon=ICONPATH                            Set the window icon
  --width=WIDTH                                     Set the width
  --height=HEIGHT                                   Set the height
  --timeout=TIMEOUT                                 Set dialog timeout in seconds
  --ok-label=TEXT                                   Set the label of the OK button
  --cancel-label=TEXT                               Set the label of the Cancel button
  --extra-button=TEXT                               Add an extra button
  --modal                                           Set the modal hint
  --attach=WINDOW                                   Set the parent window to attach to

Calendar options
  --text=TEXT                                       Set the dialog text
  --day=DAY                                         Set the calendar day
  --month=MONTH                                     Set the calendar month
  --year=YEAR                                       Set the calendar year
  --date-format=PATTERN                             Set the format for the returned date

Text entry options
  --text=TEXT                                       Set the dialog text
  --entry-text=TEXT                                 Set the entry text
  --hide-text                                       Hide the entry text

Error options
  --text=TEXT                                       Set the dialog text
  --icon-name=ICON-NAME                             Set the dialog icon
  --no-wrap                                         Do not enable text wrapping
  --no-markup                                       Do not enable Pango markup
  --ellipsize                                       Enable ellipsizing in the dialog text. This fixes the high window size with long texts

Info options
  --text=TEXT                                       Set the dialog text
  --icon-name=ICON-NAME                             Set the dialog icon
  --no-wrap                                         Do not enable text wrapping
  --no-markup                                       Do not enable Pango markup
  --ellipsize                                       Enable ellipsizing in the dialog text. This fixes the high window size with long texts

File selection options
  --filename=FILENAME                               Set the filename
  --multiple                                        Allow multiple files to be selected
  --directory                                       Activate directory-only selection
  --save                                            Activate save mode
  --separator=SEPARATOR                             Set output separator character
  --confirm-overwrite                               Confirm file selection if filename already exists
  --file-filter=NAME | PATTERN1 PATTERN2 ...        Set a filename filter

List options
  --text=TEXT                                       Set the dialog text
  --column=COLUMN                                   Set the column header
  --checklist                                       Use check boxes for the first column
  --radiolist                                       Use radio buttons for the first column
  --imagelist                                       Use an image for the first column
  --separator=SEPARATOR                             Set output separator character
  --multiple                                        Allow multiple rows to be selected
  --editable                                        Allow changes to text
  --print-column=NUMBER                             Print a specific column (Default is 1. 'ALL' can be used to print all columns)
  --hide-column=NUMBER                              Hide a specific column
  --hide-header                                     Hide the column headers
  --mid-search                                      Change list default search function searching for text in the middle, not on the beginning

Notification icon options
  --text=TEXT                                       Set the notification text
  --listen                                          Listen for commands on stdin
  --hint=TEXT                                       Set the notification hints

Progress options
  --text=TEXT                                       Set the dialog text
  --percentage=PERCENTAGE                           Set initial percentage
  --pulsate                                         Pulsate progress bar
  --auto-close                                      Dismiss the dialog when 100% has been reached
  --auto-kill                                       Kill parent process if Cancel button is pressed
  --no-cancel                                       Hide Cancel button
  --time-remaining                                  Estimate when progress will reach 100%

Question options
  --text=TEXT                                       Set the dialog text
  --icon-name=ICON-NAME                             Set the dialog icon
  --no-wrap                                         Do not enable text wrapping
  --no-markup                                       Do not enable Pango markup
  --default-cancel                                  Give Cancel button focus by default
  --ellipsize                                       Enable ellipsizing in the dialog text. This fixes the high window size with long texts
  --switch                                          Suppress OK and Cancel buttons

Warning options
  --text=TEXT                                       Set the dialog text
  --icon-name=ICON-NAME                             Set the dialog icon
  --no-wrap                                         Do not enable text wrapping
  --no-markup                                       Do not enable Pango markup
  --ellipsize                                       Enable ellipsizing in the dialog text. This fixes the high window size with long texts

Scale options
  --text=TEXT                                       Set the dialog text
  --value=VALUE                                     Set initial value
  --min-value=VALUE                                 Set minimum value
  --max-value=VALUE                                 Set maximum value
  --step=VALUE                                      Set step size
  --print-partial                                   Print partial values
  --hide-value                                      Hide value

Text information options
  --filename=FILENAME                               Open file
  --editable                                        Allow changes to text
  --font=TEXT                                       Set the text font
  --checkbox=TEXT                                   Enable an I read and agree checkbox
  --html                                            Enable HTML support
  --no-interaction                                  Do not enable user interaction with the WebView. Only works if you use --html option
  --url=URL                                         Set an URL instead of a file. Only works if you use --html option
  --auto-scroll                                     Auto scroll the text to the end. Only when text is captured from stdin

Color selection options
  --color=VALUE                                     Set the color
  --show-palette                                    Show the palette

Password dialog options
  --username                                        Display the username option

Forms dialog options
  --add-entry=Field name                            Add a new Entry in forms dialog
  --add-password=Field name                         Add a new Password Entry in forms dialog
  --add-calendar=Calendar field name                Add a new Calendar in forms dialog
  --add-list=List field and header name             Add a new List in forms dialog
  --list-values=List of values separated by |       List of values for List
  --column-values=List of values separated by |     List of values for columns
  --add-combo=Combo box field name                  Add a new combo box in forms dialog
  --combo-values=List of values separated by |      List of values for combo box
  --show-header                                     Show the columns header
  --text=TEXT                                       Set the dialog text
  --separator=SEPARATOR                             Set output separator character
  --forms-date-format=PATTERN                       Set the format for the returned date

Miscellaneous options
  --about                                           About zenity
  --version                                         Print version

GTK+ Options
  --class=CLASS                                     Program class as used by the window manager
  --name=NAME                                       Program name as used by the window manager
  --gdk-debug=FLAGS                                 GDK debugging flags to set
  --gdk-no-debug=FLAGS                              GDK debugging flags to unset
  --gtk-module=MODULES                              Load additional GTK+ modules
  --g-fatal-warnings                                Make all warnings fatal
  --gtk-debug=FLAGS                                 GTK+ debugging flags to set
  --gtk-no-debug=FLAGS                              GTK+ debugging flags to unset

Application Options:
  --calendar                                        Display calendar dialog
  --entry                                           Display text entry dialog
  --error                                           Display error dialog
  --info                                            Display info dialog
  --file-selection                                  Display file selection dialog
  --list                                            Display list dialog
  --notification                                    Display notification
  --progress                                        Display progress indication dialog
  --question                                        Display question dialog
  --warning                                         Display warning dialog
  --scale                                           Display scale dialog
  --text-info                                       Display text information dialog
  --color-selection                                 Display color selection dialog
  --password                                        Display password dialog
  --forms                                           Display forms dialog
  --display=DISPLAY                                 X display to use

zenity --help-all
thanks 4 support
 
Share this answer
 
Comments
Richard MacCutchan 21-Mar-23 12:04pm    
I suggest you ask the owners of zenity why their manual is not up to date.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900