Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • CreatiCode
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

CreatiCode Scratch Forum

  1. CreatiCode Forum
  2. 知识库
  3. 二维积木
  4. 文本框控件

文本框控件

Scheduled Pinned Locked Moved 二维积木
1 Posts 1 Posters 769 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    creaticodeteacher2-mail
    wrote on last edited by admin
    #1

     

    先修科目

    • 标签控件
    • 设置控件上的文字

     

    介绍

    利用文本框可以让用户输入文本,比如评论、聊天消息、数字。 .

     

    添加文本框

     

    参数

    • 中心位置:文本框中心的x坐标、y坐标。
    • 尺寸:文本框的宽度和高度。注意,文本框的尺寸不能超过舞台,舞台宽度480、高度360。
    • 边距:文本的左右边距。
    • 行数模式:是只有一行还是可以多行。如果是单行,文字将位于文本框中间,当用户在文本框输入时忽略回车键。
    • 滚动模式:如果文本有多行,是否有滚动条可以竖直滑动文本框。
    • 输入模式:用户能否在文本框输入,还是只读。
    • 文本框名称:名称必须唯一,之后用名称引用该文本框。

     

    读取文本框

    可以用这个积木读取文本框内容:

     

    参数

    • 控件名称:选择要读取值的控件。对于文本框,“值”就是文本内容。

     

    事件:当值变化

    你可以监听事件——控件的值发生变化。对于文本框而言,当其中的文本发生变化,就会触发该事件。

     

    参数

    • 控件名称:选择监听哪个文本框的变化事件。

     

    范例

    在这个项目中,我们添加一个文本框和一个标签。当我们在文本框中输入内容,其值发生变化 ,当该事件被触发,我们把标签的文本设置为文本框的内容。

     

    亲自尝试:

    https://play.creaticode.com/projects/b71c2eef25e72eadcf22ab94

    1 Reply Last reply
    0

    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

    With your input, this post could be even better 💗

    Register Login
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • CreatiCode