Find the answer to your Linux question:
Results 1 to 2 of 2
hi, In my project i cannot determine the number of check list initially... I will know dynamically during execution... so How to specify the number of check list dynamically in ...
  1. #1
    Just Joined!
    Join Date
    Apr 2009
    Posts
    5

    Arrow Dymically determing the number of check list in Zenity, How?

    hi,
    In my project i cannot determine the number of check list initially... I will know dynamically during execution... so How to specify the number of check list dynamically in zenity
    Although i can use case..........

    case "$n" in
    1) ans=$(zenity --list --text "Tick to Restore....?" --checklist --column "Pick" --column "options" TRUE "$1" --separator=":") ;;
    2) ans=$(zenity --list --text "Tick the IP that U want to Restore....?" --checklist --column "Pick" --column "options" TRUE "$1" TRUE "$2" --separator=":") ;;
    3) ans=$(zenity --list --text "Tick the IP that U want to Restore....?" --checklist --column "Pick" --column "options" TRUE "$1" TRUE "$2" TRUE "$3" --separator=":") ;;
    4) ans=$(zenity --list --text "Tick the IP that U want to Restore....?" --checklist --column "Pick" --column "options" TRUE "$1" TRUE "$2" TRUE "$3" TRUE "$4" --separator=":") ;;
    0) zenity --info --text "No Duplicate IP Restored....\!"
    esac

    ----I want to avoid " case" because checklist may go up to 15 or 20

  2. #2
    Just Joined!
    Join Date
    May 2009
    Posts
    1
    How about this:

    options=`echo $* | sed -e 's/^/ /' -e 's/ / TRUE /g'`
    ans=$(zenity --list --text "Tick the IP that U want to Restore....?" --checklist --column "Pick" --column "options" $options --separator=":")

    What this will do is take your command-line args, insert a space at the beginning (so that even arg1 has a leading space), and then replace those spaces with the word TRUE surrounded by spaces. The result of this substitution is stored in $options, which can then be part of the zenity command.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...