PDA

View Full Version : Searchable Combo Box


thatoneguy
05-19-2007, 08:34 AM
I have created a super handy new combo box (or at least I think it's super handy). You can search the contents of the box and use the conventional * designator for a wildcard. It should act almost exactly like bringing up the object selection dialog only you can only select one thing at a time (since it's a combo box and not magic) :D.

Global stuff = #("There is a Variety 1234","There is a lack of Virtuosity 1234", "Captain Picard says \"Make it so\"!", "Test Data", "123456789", "Search your feelings Luke!", "Engage")
insertitem "" stuff 1
rollout searchboxroll "Search and be Amazed!" height:160 width:250
(
edittext data width:210 pos:[6,33]
combobox stuffbox "Things:" items:stuff height:8 pos:[9,15]
fn searchbox input =
(
if data.text.count > 0 then
(
list = #()
list[1] = input
temp = input
temp = (input+"*") as string
for i = 1 to stuff.count do
(
test = (matchpattern stuff[i] pattern:temp) as string
if test == "true" then (append list stuff[i])
)
sort list
stuffbox.items = list
stuffbox.selection = 1
)
else
(
stuffbox.items = stuff
)
)

on data changed true do
(
searchbox data.text
)
)
createdialog searchboxroll

Hobbs
05-21-2007, 03:38 PM
Very cool...i was thinking of writing something similar to this a while ago, but didn't know where to begin. Good job. :thumbsup:

MoonDoggie
05-21-2007, 07:25 PM
if you make it a multilistbox then you can select multiple things ;)

-Colin

CGTalk Moderation
05-21-2007, 07:25 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.