Do a search of control behaviour

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
trevix
Posts: 1077
Joined: Sat Feb 24, 2007 11:25 pm
Contact:

Do a search of control behaviour

Post by trevix » Wed May 06, 2020 10:15 am

I had to change the name of my main stack, where I stored my buttons with script behaviour.
So, each control that had a behaviour like
button id 1120 of stack "MainStackX"
had to be changed to
button id 1120 of stack "MainStackY"
.
Unfortunately there are a lot of controls as such, often nested inside groups, and doing a search for "MainStackX", with ALL the check of the Find and Replace panel turned to on, does not search the word in the inspectors.

Is there any other way to do it?
Trevix
OSX 14.6.1 xCode 15 LC 10 RC1 iOS 15> Android 7>

Klaus
Posts: 14193
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Do a search of control behaviour

Post by Klaus » Wed May 06, 2020 11:38 am

Make a nested loop over your cards and controls! 8)

Code: Select all

...
repeat with i = 1 to the num of cds
  repeat with k = 1 to the num of controls of cd i
    put the behavior of control k of cd i into tBehav
      if tBehav = EMPTY then
         next repeat
      end if
    ## Do your check and neccessary changes here if the behavior is the one you are looking for
    ## ...
  end repeat
end repeat
...

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10045
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Do a search of control behaviour

Post by FourthWorld » Wed May 06, 2020 4:46 pm

Wouldn't the built-in Find/Replace do the job? Good to practice scripting skills, but is that necessary for this task?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

trevix
Posts: 1077
Joined: Sat Feb 24, 2007 11:25 pm
Contact:

Re: Do a search of control behaviour

Post by trevix » Wed May 06, 2020 4:50 pm

The build-in Find apparently does not search the behaviour link
Trevix
OSX 14.6.1 xCode 15 LC 10 RC1 iOS 15> Android 7>

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10045
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Do a search of control behaviour

Post by FourthWorld » Wed May 06, 2020 5:32 pm

trevix wrote:
Wed May 06, 2020 4:50 pm
The build-in Find apparently does not search the behaviour link
Ah, right.

Hmmm...I can appreciate the challenge of adding properties to the Find/Replace stack, but as one of the two hard problems of computer science* this comes up often enough that it's worth making a tool for.

Anyone care to make a plugin for this? I'd do it but with my client workload right now I wouldn't be able to get to it until summer.


* "There are only two hard things in Computer Science: cache invalidation and naming things." - Phil Karlton
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

kdjanz
Posts: 300
Joined: Fri Dec 09, 2011 12:12 pm

Re: Do a search of control behaviour

Post by kdjanz » Wed May 06, 2020 7:08 pm

You could also use ScriptTracker to take all the scripts out to text files and make the change in your favourite text editor...

Brian Milby - https://github.com/bwmilby/scriptTracke ... /README.md

trevix
Posts: 1077
Joined: Sat Feb 24, 2007 11:25 pm
Contact:

Re: Do a search of control behaviour

Post by trevix » Wed May 06, 2020 7:33 pm

In my case, Klaus solution was fast and solved (but I manually modified the behaviour links. Did not have time to handle this too)
I used the script adding to it a repeat for stacks
Trevix
OSX 14.6.1 xCode 15 LC 10 RC1 iOS 15> Android 7>

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7391
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Do a search of control behaviour

Post by jacque » Thu May 07, 2020 6:07 pm

For next time, couldn't you name your stack whatever you want and set its label to whatever the user should see? That saves a lot of trouble.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

trevix
Posts: 1077
Joined: Sat Feb 24, 2007 11:25 pm
Contact:

Re: Do a search of control behaviour

Post by trevix » Fri May 08, 2020 8:09 am

I tell you what happened:
My App, after a in depth research, was called "Segnapunti". I searched the App stores, I bought the domain, I prepared all the help, documentation, privacy, email and developed the App (it was created with 1 Main stack and ten or more sub-stacks). The main stack was holding most of the common script and a card with all the behaviour buttons (around 20) and images.
When I started on the App Store Connect, Apple did not accept my App name. Probably used by someone else without having published their App.
The only fact of registering a name on App Store Connect, for a TestFlight, somehow reserve that name "forever".

I had to choice:
- ask Apple to retain my name, that I repeat wasn't available on a search on the App Store, and start a uncertain complicate dispute.
- change the name of the App

There it is. It took me 2 days to change everything.
Trevix
OSX 14.6.1 xCode 15 LC 10 RC1 iOS 15> Android 7>

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7391
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Do a search of control behaviour

Post by jacque » Fri May 08, 2020 5:41 pm

Sorry you had to spend two days fixing it. I think you could have just changed the stack label, I do most of my apps that way. My current project's mainstack is named "FPMobile" and its label is the real name.

In standalone settings you can change the default name to use the real name and that is what Apple sees. LC always uses the stack name to resolve behaviors, so all my behaviors still work because they are looking for a stack named FPMobile. But in the App Store it will be listed as The Real Name.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply