Page 1 of 1

delete item from option menu

Posted: Mon Sep 28, 2015 8:01 am
by kevin007
Hi All,

I am beginner in LiveCode, I have an option menu it's contains some items (path of txt files), How I delete item from option menu,
is it possible delete item using mouse right up ? :cry:

Thanks
Kevin

Re: delete item from option menu

Posted: Mon Sep 28, 2015 8:41 am
by jmburnod
Hi Kevin,
How I delete item from option menu

Code: Select all

on deleteOneItemFromMyMenu pMyMenu,pNumMenu
   get the text of btn pMyMenu
   delete line pNumMenu of it
   set the text of btn pMyMenu to it
end deleteOneItemFromMyMenu
is it possible delete item using mouse right up ?
I think there is a way to do that but that will be a little bit more complicate
Best regards
Jean-Marc

Re: delete item from option menu

Posted: Mon Sep 28, 2015 2:34 pm
by dunbarx
Hi.

I am not sure how you want to delete the item, but you might try this in the script of a combo (or any hierarchal button). Make a combo box and place several lines of menuItems in it. Note that buttons are containers, and their contents become the menuItems.

Code: Select all

put "aaa" & return & "bob" & return  & "ccc" & return & "ddd" into button "yourCombo"
Then all you need in the button script, assuming, say, that you wanted to delete the menuItem "ccc":

Code: Select all

on menuPick pItemName
   switch pItemName
     case  "ccc" 
         delete line lineOffset(pItemName,me) of me
     break
end switch
end menuPick
I did not break this out into several steps that might make it much more readable. Write back if you need me to do this.

Craig Newman