delete all field

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
link76
Posts: 99
Joined: Fri Nov 04, 2011 1:52 pm

delete all field

Post by link76 » Thu Aug 20, 2015 9:31 am

Hello,
I would like to delete all field that contain the word "ora" in the name,

Code: Select all

repeat for the number of field in this card
      if the name of fld contains "ora" then
        delete fld ...
      end if
   end repeat
thanks

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: delete all field

Post by bn » Thu Aug 20, 2015 10:52 am

Hi Link76,

try

Code: Select all

on mouseUp
   repeat with i = the number of fields down to 1
      if the short name of field i contains "ora" then delete field i
   end repeat
end mouseUp
note that you have to go down with your repeat counter because deleting a control will change the number of controls and you will try to delete a control that does not exist by that number anymore. Best to try it on a small example stack to see what happens.

Oh, and if you want to delete many fields you might want to lock screen and lock messages too.

Kind regards

Bernd

link76
Posts: 99
Joined: Fri Nov 04, 2011 1:52 pm

Re: delete all field

Post by link76 » Thu Aug 20, 2015 11:01 am

thanks ! :wink:

Post Reply