Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- displayNum = 3;
- list = {"a", "abc", "abcd", "abcde"};
- Only = Function[{list, n}, Take[list, Min[Length[list], n]]];
- i = 0;
- CellPrint[
- Cell[BoxData[TagBox[GridBox[{{
- TagBox[
- InputFieldBox[Dynamic[$CellContext`x], String,
- ContinuousAction -> True],
- EventHandlerTag[{"MouseUp" :> (
- Null;
- ), PassEventsDown -> Automatic, PassEventsUp -> True}]
- ]
- }, {
- MakeBoxes@Dynamic@Column[
- Map[Function[
- EventHandler[
- #, {"MouseClicked" :> (x = #)}
- ]
- ],
- Select[list, StringMatchQ[#, x ~~ ___] &]~Only~displayNum ]
- ]
- }
- },
- GridBoxAlignment -> {"Columns" -> {{Left}}},
- GridBoxItemSize -> {"Columns" -> {{Automatic}},
- "Rows" -> {{Automatic}}}],
- "Column"]], "Output"]
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement