All custom functions require FileMaker Advanced to implement in a file. FileMaker Advanced has many features that make it well worth the added cost for anyone that is doing more than design the most basic simple database solutions.
What you want isn't all that easy to achieve.
A calculation field with substitute could be used to display the text in your text field with the matching text highlighted, but substitute is case sensitive so even with that approach, you have to check for each possible capitalization to highlight the matching text.
Substitute ( YourTextField ; [ gSearchText ; TextstyleAdd ( gSearchText ; HighlightYellow ) ] ; [ Proper ( gSearchText ) ; TextstyleAdd ( Proper ( gSearchText ) ; HighlightYellow ) ] ; [ Upper ( gSearchText ) ; TextstyleAdd ( Upper ( gSearchText ) ; HighlightYellow ) ] ; [ Lower ( gSearchText ) ; TextstyleAdd ( Lower ( gSearchText ) ; HighlightYellow ) ] )
Please note that this highlights typical capitalizations of your search text, not all possible capitalizations.
Wasn't sure how to do this then found http://forums.filemaker.com/posts/85218a53b2 and merged the two instructions together.
Only thing is if the word is at the beginning of the field the whole field is highlighted in yellow. However, strangely, if you click into the TextFieldBld then only the search term is highlighted again. Apart from that, Great workaround :)))
Wow that was an old chestnut that you dug up. Comment used to be active here, very knowledegable.
But I see no reason why the above substitute function would highlight more than the specified words with the specified capitalization patterns.
I did this:
Let's give your fields some names:
Define TextFieldBld as a calculation field: Substitute ( YourTextField ; [ gSearchText ; TextstyleAdd ( gSearchText ; HighlightYellow ) ] ; [ Proper ( gSearchText ) ; TextstyleAdd ( Proper ( gSearchText ) ; HighlightYellow ) ] ; [ Upper ( gSearchText ) ; TextstyleAdd ( Upper ( gSearchText ) ; HighlightYellow ) ] ; [ Lower ( gSearchText ) ; TextstyleAdd ( Lower ( gSearchText ) ; HighlightYellow ) ] )
Place TextFieldBld on your layout, and try entering different text values into gSearchText. (You will probably want gSearchText to be a global field.)
It does revert to only highlighting the word in the gSearchText if you click into the TextFieldBld field. Either way, for the functionality and timesaving the solution gives to me, I have already forgotten about it, and very happy to have added your suggestion to my FM :)
I'm more concerned about what others may encounter when they try this. I can't reproduce what you describe. In the following screen shot, you see a list view of 3 records with different text in the text field but all start with the same text, "test". I then entered "test" into the global search field and go the result shown. I did not need to click back into the text field to get the result shown.
I'll get a screen shot up too, asap. The one thing that I noticed was that there is a colour change when you click into the field to change it back to just highlighting the search word
Might you have the "delineate" option specified in Layout setup? If so, clear the check box.
Has anyone else noticed that trying to do a textStyleAdd(xxxx,;highlightYellow) function in FMGo does not seem to work. I can get the other styles I have tried to work fine, but for some reason hilightYellow won't....
Are you saying that this is an easy task in Advanced in which you don't need the code you supplied- that you can do it the hard way with supplied code? or if you have Advanced you can add this code to make it work?
If I understand your question designpro, you need FM Advanced to import custom functions. However if you open a database in Pro that already has custom functions you can use them-you just can't edit them.
With almost all custom functions, except those using recursion, you can copy the code and paste it into a calculation box and they should work.