I want to insert a drop down menu (like in a web browser) into Director for a user form. Is there an Xtra or some code that can do this?
Actually you won't need to buy a thing. If you have Internet
Explorer 4 or greater and ActiveX installed, then you are ready to go.
Director's ActiveX Xtra is great for a lot of add-on functionality, but can
be a bit frustrating. You need to have the proper program installed, and
then play with the ActiveX control until you figure out how to get it to function
properly. IE has a built in ActiveX component to do just what you are
looking for. On a PC, open Director and choose Insert>Control>ActiveX.
From there a dialog box will open asking you to pick a component. Choose
the MS Forms 2.0 ComboBox control and click OK. (Fig. 1)
Fig.1
Now you get a list of parameters you can modify. For now
we will leave these alone. Click OK and move the new cast member to a
score channel. We are going to use an on beginSprite handler to make the
list, so for testing, try to avoid putting it in the first frame. Now
we create a behavior to populate the list. Note that there is no parameter
to hold all of this from the onset, so we have to build the list as soon as
the sprite is active. Here is the basic behavior...
property startText, choiceList, whatDo, spriteNum
on getPropertyDescriptionList me
return [#startText : [#format : #string, #default : "DefaultText",
#comment : "Default text in drop-box."], #choiceList : [#format
: #string, #comment : "List of choices separated by (;)", #default
: "Choice 1;Choice 2;Choice 3"]]
end
on beginSprite me
the itemDelimiter = ";"
repeat with x = 1 to choiceList.item.count
addItem(sprite spriteNum, choiceList.item[x])
end repeat
(sprite spriteNum).text = startText
end
on getBehaviorDescription me
describe = "Combo box startUp script. Requires the MS Forms
Combo Box Active X." & return & "Drop this behavior
on a Microsoft ComboBox ActiveX sprite. This will build and populate
the dropdown list. To retrieve the property just get the text of
sprite X property for the ActiveX Sprite."
return describe
end
We drag this to the sprite, type in the default test, and
then add the list of items separated by a ";" but no extra spaces.
If you look through the behavior you can see that we are taking the "list"
which is just a string and separating it by the itemDelimiter, which we have
set to ";". Then we just take each item and use the ActiveX
component's "addItem" handler to add each item. From here we
can get the user's chosen value at any time by calling the text of sprite property
of the ActiveX Sprite. (put sprite(1).text).
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA