Changeset 440
- Timestamp:
- 02/29/2008 15:30:06 (6 months ago)
- Files:
-
- 1 modified
-
trunk/lib/shoes/help.rb (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/shoes/help.rb
r432 r440 279 279 The App itself, in slot/box terminology, is a flow. See the ''Slots'' section for more, but this just means that any elements placed directly at the top-level will flow. 280 280 281 === close() === 282 283 Closes the app window. If multiple windows are open and you want to close the entire application, use the built-in method `exit`. 284 281 285 === location() » String === 282 286 … … 469 473 Shoes has a wide variety of elements, many cherry-picked from HTML. This page describes how to create these elements in a slot. See the Elements section of the manual for more on how to modify and use these elements after they have been placed. 470 474 475 === animate(fps) { |frame| ... } » Shoes::Animation === 476 477 Starts an animation timer, which runs parallel to the rest of the app. The `fps` is a number, the frames per seconds. This number dictates how many times per second the attached block will be called. 478 479 The block is given a `frame` number. Starting with zero, the `frame` number tells the block how many frames of the animation have been shown. 480 481 {{{ 482 #!ruby 483 Shoes.app do 484 @counter = para "STARTING" 485 animate(24) do |frame| 486 @counter.replace "FRAME #{frame}" 487 end 488 end 489 }}} 490 491 The above animation is shown 24 times per second. If no number is give, the `fps` defaults to 10. 492 471 493 === background(pattern) » Shoes::Background === 472 494 … … 495 517 '''PLEASE NOTE:''' Like Backgrounds, Borders are actual elements, not styles. HTML treats backgrounds and borders like styles. Which means every box can only have one borders. Shoes layers border and background elements, along with text blocks, images, and everything else. 496 518 519 === button(text) { ... } » Shoes::Button === 520 521 Adds a push button with the message `text` written across its surface. An optional block can be attached, which is called if the button is pressed. 522 497 523 === caption(text) » Shoes::Caption === 498 524 499 525 Creates a Caption text block. Shoes styles this text to 14 pixels high. 500 526 527 === check() » Shoes::Check === 528 529 Adds a check box. 530 501 531 === code(text) » Shoes::Code === 502 532 … … 507 537 Creates a Del text fragment (short for "deleted") which defaults to text with a single strikethrough in its middle. 508 538 539 === edit_box(text) » Shoes::EditBox === 540 541 Adds a large, multi-line textarea to this slot. The `text` is optional and should be a string that will start out the box. An optional block can be attached here which is called any type the user changes the text in the box. 542 543 {{{ 544 #!ruby 545 Shoes.app do 546 edit_box 547 edit_box "HORRAY EDIT ME" 548 edit_box "small one", :width => 100, :height => 160 549 end 550 }}} 551 552 === edit_line(text) » Shoes::EditLine === 553 554 Adds a single-line text box to this slot. The `text` is optional and should be a string that will start out the box. An optional block can be attached here which is called any type the user changes the text in the box. 555 509 556 === em(text) » Shoes::Em === 510 557 511 558 Creates an Em text fragment (short for "emphasized") which, by default, is styled with italics. 512 559 560 === every(seconds) { |count| ... } » Shoes::Every === 561 562 A timer similar to the `animation` method, but much slower. This timer fires a given number of seconds, running the block attached. So, for example, if you need to check a web site every five minutes, you'd call `every(300)` with a block containing the code to actually ping the web site. 563 513 564 === image(path) » Shoes::Image === 514 565 515 566 Creates an Image element for displaying a picture. PNG, JPEG and GIF formats are allowed. 516 567 568 === imagesize(path) » [width, height] === 569 570 Quickly grab the width and height of an image. The image won't be loaded into the cache or displayed. 571 517 572 === ins(text) » Shoes::Ins === 518 573 … … 529 584 The default LinkHover style is also single-underlined with a #039 (dark blue) stroke. 530 585 586 === list_box(:items => [strings, ...]) » Shoes::ListBox === 587 588 Adds a drop-down list box containing entries for everything in the `items` array. An optional block may be attached, which is called if anything in the box becomes selected by the user. 589 590 {{{ 591 #!ruby 592 Shoes.app do 593 stack :margin => 10 do 594 para "Pick a card:" 595 list_box :items => ["Jack", "Ace", "Joker"] 596 end 597 end 598 }}} 599 600 Call `ListBox#text` to get the selected string. See the `ListBox` section under `Native` controls for more help. 601 602 === progress() » Shoes::Progress === 603 604 Adds a progress bar. 605 531 606 === para(text) » Shoes::Para === 532 607 533 608 Create a Para text block (short for "paragraph") which Shoes styles at 12 pixels high. 534 609 610 === radio() » Shoes::Radio === 611 612 Adds a radio button. 613 535 614 === strong(text) » Shoes::Strong === 536 615 … … 552 631 553 632 Creates a Tagline text block. Shoes styles this text to 18 pixels high. 633 634 === timer(seconds) { ... } » Shoes::Timer === 635 636 A one-shot timer. If you want to schedule to run some code in a few seconds (or minutes, hours) you can attach the code as a block here. 637 638 To display an alert box five seconds from now: 639 640 {{{ 641 #!ruby 642 Shoes.app do 643 timer(5) do 644 alert("Your five seconds are up.") 645 end 646 end 647 }}} 554 648 555 649 === title(text) » Shoes::Title === … … 630 724 Each style setting also has a method, which can be used to grab that particular setting. (So, 631 725 like, the `width` method returns the width of the slot in pixels.) 726 727 === gutter() » a number === 728 729 The size of the scrollbar area. When Shoes needs to show a scrollbar, the scrollbar may end up covering up some elements that touch the edge of the window. The `gutter` tells you how many pixels to expect the scrollbar to cover. 730 731 This is commonly used to pad elements on the right, like so: 732 733 {{{ 734 #!ruby 735 stack :margin_right => 20 + gutter do 736 para "Insert fat and ratified declaration of 737 independence here..." 738 end 739 }}} 632 740 633 741 === height() » a number ===
