แบบสำรวจการวิจัย: บอกให้เราทราบเกี่ยวกับประสบการณ์การใช้งาน Blockly
เริ่มแบบสำรวจ
อินพุตในบรรทัดกับอินพุตภายนอก
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
โดยจะแสดงอินพุตในบรรทัดหรือภายนอกก็ได้ ซึ่งจะควบคุมว่าตัวเชื่อมต่อสำหรับอินพุตค่าจะแสดงภายในบล็อก (อินไลน์) หรือที่ขอบด้านนอก (ภายนอก) รวมถึงจะแสดงอินพุตในแถวเดียวกันหรือแถวที่ต่างกัน

คำจำกัดความของบล็อกสามารถระบุบูลีนที่ไม่บังคับเพื่อควบคุมว่าอินพุต
จะอยู่ในบรรทัดหรือไม่
JSON
{
// ...,
"inputsInline": true
}
JavaScript
init: function() {
// ...
this.setInputsInline(true);
}
เมื่อตั้งค่าบูลีนนี้เป็น true
(อินพุตแบบอินไลน์)
- ตัวเชื่อมต่อสำหรับการป้อนค่าจะแสดงภายในบล็อก
- อินพุตของคำสั่งจะแสดงในแถวของตัวเอง
- อินพุตดัมมี่ อินพุตท้ายแถว และอินพุตค่าจะแสดงในแถวเดียวกัน ยกเว้น
อินพุตที่ตามหลังคำสั่งหรืออินพุตท้ายแถวจะแสดงใน
แถวใหม่
เมื่อตั้งค่าเป็น false
(อินพุตภายนอก)
- ตัวเชื่อมต่อสำหรับอินพุตค่าจะแสดงที่ขอบด้านนอกของบล็อก
- อินพุตทั้งหมดจะแสดงในแถวของตัวเอง ยกเว้นอินพุตท้ายแถว
ที่ตามหลังอินพุตจำลองจะแสดงในแถวเดียวกับอินพุตจำลอง
หากคุณมีปัญหาในการแสดงภาพนี้ ให้สร้างบล็อกในเครื่องมือสำหรับนักพัฒนาซอฟต์แวร์ Blockly แล้วเลือกการตั้งค่าต่างๆ สำหรับเมนูแบบเลื่อนลง inputs
(automatic
, external
, inline
)
หากไม่ได้กำหนดบูลีนนี้ Blockly จะใช้ฮิวริสติกบางอย่างเพื่อคาดเดาว่าโหมดใดดีที่สุด หาก Blockly เลือกได้อย่างถูกต้อง การปล่อยให้ฟิลด์นี้ไม่ได้กำหนดไว้
จะดีกว่าเนื่องจากการแปลภาษาต่างๆ จะมี
โหมดที่แตกต่างกันโดยอัตโนมัติ ดูตัวอย่างของ "set %1 to %2"
(อินพุตภายนอก) และ
"put %2 in %1"
(อินพุตในบรรทัด) ในลำดับโทเค็นการประมาณค่า
ใช้การป้อนข้อมูลในบรรทัดเมื่อบล็อกมีแนวโน้มที่จะมีอินพุตขนาดเล็ก เช่น ตัวเลข
ผู้ใช้สามารถเปิด/ปิดตัวเลือกนี้ผ่านเมนูตามบริบท
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[],[],null,["# Inline vs. external inputs\n\nInputs can be rendered **inline** or **externally**. This controls whether the\nconnectors for value inputs are rendered inside the block (inline) or on the\noutside edge (external), as well as whether inputs are rendered in the same or\ndifferent rows.\n\nThe block definition can specify an optional boolean controlling whether inputs\nare inline or not. \n\n### JSON\n\n {\n // ...,\n \"inputsInline\": true\n }\n\n### JavaScript\n\n init: function() {\n // ...\n this.setInputsInline(true);\n }\n\nWhen this boolean is set to `true` (inline inputs):\n\n- The connectors for value inputs are rendered inside the block.\n- Statement inputs are rendered on their own row.\n- Dummy, end-of-row, and value inputs are all rendered in the same row, except that any input following a statement or end-of-row input is rendered on a new row.\n\nWhen it is set to `false` (external inputs):\n\n- The connectors for value inputs are rendered on the outside edge of the block.\n- All inputs are rendered in their own row, except that an end-of-row input that follows a dummy input is rendered in the same row as the dummy input.\n\nIf you're having trouble visualizing this, construct blocks in the\n[Blockly Developer Tools](https://google.github.io/blockly-samples/examples/developer-tools/index.html) and choose different settings for the\n`inputs` dropdown (`automatic`, `external`, `inline`).\n\nIf this boolean is not defined then Blockly will use some heuristics to guess\nwhich mode is\nbest. Assuming Blockly makes the right choice, leaving this field undefined\nis preferable since different language translations can automatically have\ndifferent modes. See the example of `\"set %1 to %2\"` (external inputs) and\n`\"put %2 in %1\"` (inline inputs) in [Interpolation token\norder](/blockly/guides/create-custom-blocks/define/structure-json#interpolation_token_order).\n\nUse inline inputs when a block is likely to have small inputs such as numbers.\nThe user can toggle this option through the context menu."]]