Project Folders
Teacher Resources
Student Resources
How Do I?
Site Map
Our Team

MWForum Message [Date Index] [Threads] [Authors] [Attachments] [Subscribe]

[Thread Prev] [Thread Next]

To: Rotem Kimchi <rotemk2@xxxxxxxxxxxxxxxx>
Subject: Re: dropbox
From: Alain Tougas <alain@xxxxxxx>
Date: Sat, 23 Apr 2011 08:59:55 -0400

From MW online help:

A drop down menu is a list of options in a floating menu.

You can select any of these options, but only one option per menu can be selected at a time. If you select a second option, the first one becomes unselected. The name of the drop down menu can be used as a reporter to report the position of the current selection in the menu. The position is reported as a number. You can also use getlabel to report the text of the current selection, instead of its position in the list.

Drop down menus can be used directly on a page or it can be placed inside a dialog box This section covers the use of drop down menus on pages. Also see the section on Dialog Boxes.

Creating a Drop Down Menu

Choose New Drop Down in the Objects menu. The drop down menu dialog box appears. In this example, the name is set to ColSelect. The name is a reporter that reports which item is currently selected in the menu. It must be a one word name, with no spaces.

Type Red as the first label. Labels are the text items that appear in the menu.

Click on Insert to add this label to the list.

Do this for other colors. The labels are displayed in the larger area:

If you make a mistake, select the item and click on Delete. You can use the Up and Down buttons to rearrange the order of the items in the box.

Whatever item of the list is selected when you close this dialog box will be pre-selected when the Drop down menu is first displayed. If you want none of the choices pre-selected, click on Unselect. The default value is also the item that is selected when the Drop down menu is inside a dialog box and the dialog box is reset. SeeDialog Boxes.

You can set these other options:

  • Show Name - when checked, the name is visible at the bottom of the drop down menu.
  • Visible - if unchecked, the drop down menu will not be visible.

Click OK to create the drop down menu:

Using a Drop Down Menu

Type this in the Command Center:

show colselect 

No item has been selected yet. Click on one of the items and type the same instruction (the result is just an example)

show colselect 

Use the word colselect to control something on the page. Create a turtle and type this procedure in the turtle's Procedures Tab.

to trace 
if colselect = 1 [setc "red] 
if colselect = 2 [setc "blue] 
if colselect = 3 [setc "green] 
fd 2 wait 1 
rt random 360 

In the turtle's Rules Tab, type trace in the OnClick instruction line and set its mode to Forever.

In the turtle's State Tab, put the turtle's pen down.

Then click on the turtle to make it draw. As the turtle moves, select different colors in the drop down menu.

You can also use getlabel to report the actual words used as labels instead of the position number of the selection in the list.

show getlabel "colselect 

Type this procedure in another turtle's Procedures Tab:

to trace 
setc getlabel "colorset 
fd 5 wait 1 
rt random 360 

Important: If you plan to use labels (reported by getlabel) instead of position numbers, you should use one-word labels. The example above would not work if the label was, for example, "fire red" because getlabel "colorset would report fire red and this is not accepted as an input for setc.

Related Primitives: newdropdownsetget

Le 2011-04-23 à 07:31, Rotem Kimchi a écrit :

Hi everyone
I want to create a dropbox or combobox form which I could choose from different options
could someone direct me how to start?
thanks in advance and happy holyday
MWForum mailing list

  • Previous by thread: dropbox
  • Next by thread: MIA, Ask an Expert: Dreamhouse project...

  • To save an attachment to your computer, PC users should right-click (Mac users, click and hold the mouse button) on the link and then choose 'save target as' from the pop-up menu. A window will then pop up in which you can choose a location for the file.

    © copyright 2001 - 2008