Search Option (also using iGUI)

Hello,

Im creating an iPhone/Android application and I’ve been using iGUI for most of it.

So far I’ve created a massive amount of buttons and when the button is clicked a Label will appear then if the button is clicked again the Label will disappear.

How would I create a “Search Option” field, so that the end user can start typing a word and if any of the Labels contain that word the Label will appear?

or what would be the best way to go to create some kind of search option for an application like this. I’ll take any and all ideas.

I’ve uploaded a small part of the application as a web build so you can get a good idea of what Im doing and hopefully you may have some ideas as to how I would go about creating a search option.

Web Build:
Click Here

There are 6 little icon buttons at the bottom Click on Sections > General Overview > Then any of the 1.1 index’s (and you’ll see how the Buttons Labels work) Then Click the back button when finished.

Where the 6 little icon buttons are at the bottom the last one to the far right is Search and this is where I plan on putting the Search Options field but Im not quite sure where to start.

Sincerely,
Michael

Searches really aren’t difficult. Just loop through all of the searchable items and compare the search string with each one.

Example

searchString = GUILayout.TextField(searchString);
for (int i = 0; i < items.Count; i++)
{
   if (string.IsNullOrEmpty(searchString) || items[i].text.ToUpper().Contains(searchString.ToUpper()))
   {
      GUILayout.Label(items[i]);
   }
}

where “items” is a List. If the search string is empty, it will show all of the items, but once you start typing it will only display items that contain the search string. Remove the ToUpper()'s to make it case-sensitive.

I tried to import IGUI on unity 4.0 but a have this eror !!!

ArgumentException: set_left can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don’t use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
UnityEngine.RectOffset…ctor (Int32 left, Int32 right, Int32 top, Int32 bottom)
exGUIBorder…ctor ()

plzzzzzzzzzz help