UDN
Search public documentation:
CLIKCheckBoxCH
English Translation
日本語訳
한국어
Interested in the Unreal Engine?
Visit the Unreal Technology site.
Looking for jobs and company info?
Check out the Epic games site.
Questions about support via UDN?
Contact the UDN Staff
日本語訳
한국어
Interested in the Unreal Engine?
Visit the Unreal Technology site.
Looking for jobs and company info?
Check out the Epic games site.
Questions about support via UDN?
Contact the UDN Staff
如何获得并设置一个复选框数值
概述
该教程向您展示如何从一个复选框中设置或得到一个数值。
获得一个复选框的数值
假设您的复选框已经在"aCheckBox"的Flash中有一个实例名,或假设您已经对该复选框使用了一个CLIK控件,则以下虚幻脚本可以让您获得复选框的数值。
var GFxClikWidget MyCheckBox; var bool MyOption; event bool WidgetInitialized(name WidgetName, name WidgetPath, GFxObject Widget) { switch(WidgetName) { case ('aCheckBox'): MyCheckBox = GFxClikWidget(Widget); if (MyCheckBox != None) { MyCheckBox.AddEventListener('CLIK_select', OnMyCheckBoxChange); } break; default: break; } return true; } function OnMyCheckBoxChange(GFxClikWidget.EventData ev) { MyOption = MyCheckBox.GetBool("_selected"); `log("aCheckBox has been set to: "@MyOption); } defaultproperties { WidgetBindings.Add((WidgetName="aCheckBox",WidgetClass=class'GFxClikWidget')) }
MyOption = MyCheckBox.GetBool("_selected");
设置一个复选框的数值
从虚幻脚本中设置复选框
MyCheckBox.SetBool("selected", true); // or false
SetMyCheckBox(true); // true or false function SetMyCheckBox(bool b) { ActionScriptVoid("SetMyCheckBox"); // passes the boolean value stored in 'b' to the AS function SetMyCheckBox }
function SetMyCheckBox(checked:Boolean) { aCheckBox.selected = checked; }