MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Type-Ahead Searches in a Manipulate or Dynamic Module

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125639] Re: Type-Ahead Searches in a Manipulate or Dynamic Module
  • From: A Retey <awnl at gmx-topmail.de>
  • Date: Sat, 24 Mar 2012 02:02:16 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jkh5gk$jsv$1@smc.vnet.net>

Am 23.03.2012 07:33, schrieb Gregory Lypny:
> Hello everyone,
>
> I'm cleaning data and prototyping rudimentary databases in
> Mathematica.  I have a few data arrays, consisting of a few thousand
> lines each.  I'd like to be able to search the arrays for lines
> (lists) containing search strings by typing into a text field and having
> the hits appear as I'm typing the search string, sort of like
> Spotlight on the Mac does.  This may be something as simple as using
> Select within the Manipulate combined with ControlActive.  Has anyone
> tinkered with something like this?

this is not really optimized, but I'd give it a try and see if it will 
just work. It should be simple enough to serve as a starting point for a 
more specialized version:

data={{"hello",1},{"test",2},{"something else",3}};

str="";

InputField[Dynamic[str],String,ContinuousAction->True]

Dynamic[If[StringLength[str]>0,
   Grid[Select[data,StringMatchQ[#[[1]],str~~__]&]],
   ""
]]

the real trick is the ContinuousAction option, everything else should be 
pretty straightforward...

hth,

albert



  • Prev by Date: calculation error in series
  • Next by Date: Re: Different Color in ToString
  • Previous by thread: Type-Ahead Searches in a Manipulate or Dynamic Module
  • Next by thread: GConf errors when running from cron