調査アンケート: Blockly のご利用体験についてお聞かせください
アンケートを開始
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
ブロックする >[変数] >createVariableButtonHandler
「変数を作成」ハンドル[変数] をクリックします。ユーザーは変数名の入力を求められます。ワークスペースの変数で名前がすでに使用されている場合は、再プロンプトが表示されます。
カスタム ボタンハンドラはこの関数に委任して、変数の型や作成後の処理を許可します。より複雑なカスタマイズ(変数タイプのプロンプトなど)は、この関数の範囲外です。
署名:
export declare function createVariableButtonHandler(workspace: Workspace, opt_callback?: (p1?: string | null) => void, opt_type?: string): void;
パラメータ
パラメータ |
型 |
説明 |
ワークスペース |
Google Workspace |
変数を作成するワークスペース。 |
opt_callback |
(p1?: string | null) =>無効 |
(省略可)コールバック。許容される新しい変数名が渡されます。変更を中止する場合は null(キャンセル ボタン)、既存の変数が選択された場合は未定義が渡されます。 |
opt_type |
文字列 |
(省略可)「int」、「string」、「string」などの変数の型。デフォルトは特定のタイプである '' です。 |
戻り値:
void
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2024-09-09 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2024-09-09 UTC。"],[[["`createVariableButtonHandler` facilitates the creation of new variables within a Blockly workspace, managing user prompts for variable names and handling potential naming conflicts."],["This function can be used by custom button handlers, offering flexibility for defining variable types and incorporating post-creation actions."],["While offering basic variable creation functionality, `createVariableButtonHandler` is not designed for complex customizations like prompting for variable type."],["The function takes the workspace, an optional callback for processing the new variable name, and an optional variable type as parameters."]]],[]]