populating a drop down list...

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
TheBigDuck
Posts: 23
Joined: Tue Nov 11, 2008 5:52 pm
Contact:

populating a drop down list...

Post by TheBigDuck » Fri Nov 14, 2008 8:24 pm

I am getting a variable from a shell command.

for example I want a list of files in a folder

do shell("cd /Applications/") <<Note, this doesn't seem to work
put shell ("PWD") into field "Result"
put shell ("ls") after field "Result"

So I get a list of files... and I want those files to be translated to a drop down list.

(This has nothing to do with files, I am actually getting a list from a shell command and I want that list to be a CHOICE in my drop down)

Any pointers?

Obleo
Posts: 174
Joined: Mon Apr 10, 2006 10:35 pm
Contact:

Post by Obleo » Sat Nov 15, 2008 6:12 am

do shell("cd /Applications/") <<Note, this doesn't seem to work
put shell ("PWD") into field "Result"
put shell ("ls") after field "Result"
I tied the exact same script you had above but replaced the field with a option menu button.

I just replaced field "Result" with button "resultMenu" and it worked, The change I made is below.

Code: Select all

do shell("cd /Applications/") -- Note, this doesn't seem to work 
put shell ("PWD") into button "ResultMenu" 
put shell ("ls") after button "ResultMenu" 
If you trying to add this to the menu bar, it is also just a button.

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Sat Nov 15, 2008 12:52 pm

Yep, "shell" is a function and not a handler.

And you can simply put text "into btn xyz", where the button should be some kind of menu. This is a shortcut for "set the text of btn xyz to mystring"

Therefore it is pretty easy to manipulate the contens of a menubutton, since this is just a "normal" string/text operation!


Best

Klaus

Post Reply