Other objects - radio buttons, checkboxes, drop down menus, etc LiveCode Controls (Objects) and Their Properties 1. Buttons - for performing actions Styles = Push, Square, Rounded Rectangle, Transparent, Opaque and Shadow - to perform an action Use: Usually, you have script on the button to detect when it has been pushed i.e. on mouseUp. But if you have many buttons on a card, you can use the "hilite" property in another handler on mouseUp note: This is good because all your code and ligic is in one place (on the card) and not scattered across many buttons C - Radio Buttons - for making 1 choice of many Properties: But if you have many buttons on a card, you can use the "hilite" property in another handler on mouseUp D - Checkbox Buttons - for checking on/off (true or false) Properties: Styles = Radio button and Check Box - to make choices (the radio buttons are usually used in groups) But if you have many buttons on a card, you can use the "hilite" property in another handler on mouseUp E - Menu Buttons - for selecting one of many choices Use: getting the choice 2. Fields - to display or enter text Name = Field, Label Field, Scrolling, Scrolling List, Table text, list, table fields) Use: Data Grids - for displaying data in obth grid and form view as well as custom layouts with other LiveCode objects. Best for large data sets. 4. LiveCode Shortcuts - the "ID", the "short name" , the "name" and the "long name" LiveCode has ways to identify objects: The "ID", the "short name", and the "long name" 1. ID - The ID is the number of that object. ID's are always assigned by LiveCode and are always unique. No 2 objects will have the same ID. (You use this when you skin buttons - you use the ID for the icon. e.g. 1004 2. short name - The "short name" is the name of the object. e.g. "box" or "enemy" 3. name or abbrev name - The "name" or abbreviated name is the type and name of the object. e.g. button "box" 4. long name - The long name is the complete description (or location) of the object (the card and stack that it is in) e.g. button "box" of card "myCard" of stack "My Stack" For You To Try 1. Make a new card, put a button on it and call the button "box. Then add the following code to the button: on mouseUp When you click on it, you will see (in order) 1004 (or whatever the ID # is of that object) In the long name, notice every object has a "type" and a "name" - button "box", card "card id 1002", stack "untitled") 2. Delete that code on the button and add the following code to the CARD script: on mouseUp now drag any objects from the "Tools Palette" to your card and click on them one by one. You will see what each is. You can refer to the object using any of them: hide button ID theID 5. When would we use this? - answer: when you have a large number of buttons, etc Good question. Let's say you were making something with many buttons - a calculator, a keyboard, a memory game or anything else with many buttons. It would be tedious putting the same code on every button or object. Then if you would make a change, you would have to edit each one at a time. Wouldn't it be easier just putting 1 copy of the code on the card script and have it see which button was pressed? Yes, for instance a calculator. You would have 10 buttons for the numbers (0 to 9) and normally would put code on each one. On button "B1" - the button with the "1" on it on mouseUp On button "B2" - the button with the "2" on it on mouseUp (note: we used "B1" for the name and "1" for the label. It is not a good idea to name any object with just a number. LiveCode does not know id you mean the ID or the name of the object. So instead we include a "B" before each number - as the name) Instead, you can just do one script on the card on the CARD Script on mouseUp A little more complicated (not really if you understand it) but a lot less work. You are done. You do not have to do any more scripts ...more to come |