Notifications
Clear all
[Closed] Searchable Combo Box
May 19, 2007 9: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
2 Replies
May 19, 2007 9:34 am
Very cool…i was thinking of writing something similar to this a while ago, but didn’t know where to begin. Good job.
May 19, 2007 9:34 am
if you make it a multilistbox then you can select multiple things
-Colin