delete item from option menu

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
kevin007
Posts: 40
Joined: Mon Sep 21, 2015 7:46 am

delete item from option menu

Post by kevin007 » Mon Sep 28, 2015 8:01 am

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
--
Thanks
Kevin

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: delete item from option menu

Post by jmburnod » Mon Sep 28, 2015 8:41 am

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
https://alternatic.ch

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: delete item from option menu

Post by dunbarx » Mon Sep 28, 2015 2:34 pm

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

Post Reply