Page 1 of 1

building a menu ?

Posted: 15 Apr 2018 11:13
by yusef88
hi , my problem is the menu will only return the first extension
if I choose video menu. the echo will return mp4
any suggestion to fix this please?

Code: Select all

  $menu = <<<MENU
   Video;*.mp4;*.avi
   Audio;*.mp3;*.wav
   MENU;
  $s = popupmenu("$menu");if !($s) { end 1==1; };
  echo $s

Re: building a menu ?

Posted: 15 Apr 2018 11:34
by PeterH
In the expression Video;*.mp4;*.avi ";" is the separator "sep_item", so:
Video = caption
*.mp4 = data
*.avi = icon

You didn't mean it this way, I think.

Re: building a menu ?

Posted: 15 Apr 2018 12:26
by yusef88
PeterH wrote:In the expression Video;*.mp4;*.avi ";" is the separator "sep_item", so:
Video = caption
*.mp4 = data
*.avi = icon

You didn't mean it this way, I think.
you are right. I guess quoting "*.mp4;*.avi" will make it work
thanks

Re: building a menu ?

Posted: 15 Apr 2018 12:33
by highend
Then you get a quoted string...

The better way (as Peter already indicated) is:

Code: Select all

  $menu = <<<MENU
   Video|*.mp4;*.avi
   Audio|*.mp3;*.wav
   MENU;
  $s = popupmenu($menu, 7:="|");
  if !($s) { end true; };
  echo $s;
or you use a different separator for the extensions in the first place...

Re: building a menu ?

Posted: 15 Apr 2018 12:50
by yusef88
dear highend
Do you know how wonderful you are? :biggrin: Thank you :tup: