Notifications
Clear all
[Closed] Dynamic Dropdownlist
Page 2 / 2
Prev
Jun 03, 2011 4:25 pm
Why not set that as your first item in the array and set your selected item back to the base entry? Then in your SelectedItemChanged event do a test if the selected item is 0 do nothing, else execute your code.
-Eric
Jun 03, 2011 4:25 pm
Thanks for that idea. I’m going to go ahead an do it that way then.
JokerMartini
Jun 03, 2011 4:25 pm
try(destroyDialog ::rlScriptList)catch()
(
local directory = "$scripts/Startup/" -- Targeted scripts folder
local sFiles = getFiles (directory + "\\*.ms*")
local ScriptsArray = #()
local thisScript = 1
local ScriptName = ""
sort sFiles
rollout rlScriptList "Scripts"
(
dotNetControl dlScriptsList "System.Windows.Forms.ComboBox" text:"Scripts List:" height:20 width:160 pos:[10,10]
fn fnUpdateList = -- collects scripts and sorts them
(
-- Collect the scripts into an array
ScriptsArray = for file in sFiles collect
(
local fIndex = findItem sFiles file
local fbName = "b" + (fIndex as string)
(getFIleNameFile file)
)
-- Clear the ComboBox list
dlScriptsList.items.clear()
insertItem "Scripts List:" ScriptsArray 1
-- Build a new ComboBox list using the view array
dlScriptsList.items.addrange ScriptsArray
)
on dlScriptsList open do (fnUpdateList()) --Fill on open
on dlScriptsList DropDown do (fnUpdateList()) --Fill on expanding the list
on dlScriptsList SelectedIndexChanged do
(
--Command to execute on selecting the entry
ScriptName = dlScriptsList.text
print ScriptName
dlScriptsList.SelectedIndex = 0-- alternate = dlScriptsList.text = "Scripts List:"
)
)
createDialog rlScriptList 180 40
)
Jun 03, 2011 4:25 pm
Just for kicks, I posted a fully hosted dotnet script browser a while back, you can get it at my site here –
There’s a few interesting bits to note – the CUIUpdater class for retrieving the max UI colours in a dot net assembly (or in max for dotnetcontrols)
Jun 03, 2011 4:25 pm
Alright, I’ll be sure to check this out. It’s a great idea.
Thanks Pete.
Page 2 / 2
Prev