ScratchData LogoScratchData
Back to WidgetFarmer1's profile

Widget - Combo Box

WIWidgetFarmer1•Created May 5, 2008
Widget - Combo Box
1
0
123 views
View on Scratch

Description

Combo Box widget by AddZero. From original project: Combo boxes are selectors you often see in website forms and applications. They make it easy to select information. I made this combo box for a tutorial system and other projects I'm working on. I wanted it to be all-in-one so it's easy to drop into projects. It's pretty easy to modify, just change the costumes. If you change the number of choices or location, change the values above the script then double-click to run it. -----Feel free to use this in your projects. Please let me know if you improve it HOW IT WORKS: Everything is in one sprite. There are costumes for each of the options, There's also a check-mark and a blue selection highlight costume. When clicked, it stamps so that the current option stays at the bottom, then it moves up, changes costumes and stamps for each of the options. So that it draws all of the options. then moves to and stamps a check mark at the current selection. The sprite then changes to the blue highlight, and turns on the ghost effect so it's partially transparent. While the cursor is still over the menu, it moves at 16px increments up and down. so that it highlights an option. If the blue selection costume is clicked, it changes the "value" variable of the combo box to the current selection and broadcasts "changed" When the combo box is done, it clears the screen. For the calculator: There's a script waiting for the "changed" broadcast. When it receives that, it does the math based on the values in the combo boxes. KNOWN ISSUES: If you move your mouse far after clicking, it can break or select the wrong thing. It's hard coded to 16 pixels tall. Because it stamps the menu, it will be behind objects in the way. Some of the code is hackish, I don't know the cleanest/best way to do it. I've never done this before! I'm open to suggestions!

Project Details

Project ID157430
CreatedMay 5, 2008
Last ModifiedMay 5, 2008
SharedMay 5, 2008
Visibilityvisible
CommentsAllowed

Remix Information

Parent ProjectView Parent
Root ProjectView Root