# TextBox

## TextBox

클라이언트에서 사용되는 Widget TextBox 객체.

### **이벤트**

<br>

| **EndTextBoxEditEvent** |
| ----------------------- |

textBox의 입력 내용이 변경될때 호출.\
연결함수 내용 입력후 Enter키를 누르거나, 입력 포커스가 TextBox 밖으로 바뀔 때로 간주.

\-- 샘플 --

```lua
local TextBox = Workspace.ScreenUI.TextBox

local function ChangedText(editText)
   print("텍스트 박스의 내용이 " .. editText .. "로 변경되었어요.")
end
TextBox.EndTextBoxEditEvent:Connect(ChangedText)
```

### **함수**

<br>

| **void SetText(number Value)** |
| ------------------------------ |

(X.0 , X) 값은 모두 X로 반환되서 출력됩니다. X.0을 출력하고 싶으면 tostring으로 변환후 이용해주세요\
위젯의 텍스트를 주어진 실수로 변경해요. (변경할 실수 값)

<br>

| **void SetText(string InText)** |
| ------------------------------- |

위젯의 텍스트를 주어진 문자열로 변경해요. (변경할 문자열)

\-- 샘플 --

```lua
local textBox = Workspace.ScreenUI.TextBox
textBox:SetText("Hello World!") --텍스트 UI에 내용을 표시해요.
```

<br>

| **string GetText()** |
| -------------------- |

위젯에 설정된 텍스트를 얻을 수 있어요.

\-- 샘플 --

```lua
local textBox = Workspace.ScreenUI.TextBox
print(textBox:GetText())
```

<br>

| **void SetHintText(string InText)** |
| ----------------------------------- |

위젯의 힌트텍스트를 주어진 문자열로 변경해요. (변경할 문자열)

\-- 샘플 --

```lua
local textBox = Workspace.ScreenUI.TextBox
textBox:SetHintText("내용을 입력하세요.")
```

<br>

| **string GetHintText()** |
| ------------------------ |

위젯에 설정된 힌트텍스트를 얻을 수 있어요.

\-- 샘플 --

```lua
local textBox = Workspace.ScreenUI.TextBox
print(textBox:GetHintText())
```

<br>

| **void SetTextColor(Color color)** |
| ---------------------------------- |

텍스트의 색을 설정할 수 있어요. (변경할 [Color](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/color) 값)

\-- 샘플 --

```lua
local textBox = Workspace.ScreenUI.TextBox
textBox:SetTextColor(Color.new(0, 255, 0, 255)) --텍스트 UI의 글자 색상을 변경해요.
```

<br>

| **Color GetTextColor()** |
| ------------------------ |

텍스트의 색을 가져올 수 있어요.

\-- 샘플 --

```lua
local textBox = Workspace.ScreenUI.TextBox
print(textBox:GetTextColor())
```

<br>

| **void SetBackgroundColor(Color color)** |
| ---------------------------------------- |

위젯의 텍스트 배경 색을 설정할 수 있어요. (변경할 색)

\-- 샘플 --

```lua
local textBox = Workspace.ScreenUI.TextBox
textBox:SetBackgroundColor(Color.new(0, 0, 255, 255)) --프레임 UI의 바탕 색상을 변경해요.
```

<br>

| **Color GetBackgroundColor()** |
| ------------------------------ |

위젯의 텍스트 배경 색을 가져올 수 있어요.

\-- 샘플 --

```lua
local textBox = Workspace.ScreenUI.TextBox
print(textBox:GetBackgroundColor())
```

\ <br>

## **사용 가능한 부모 오브젝트 기능들**

### **속성**

| **이름**                                                                                         | **설명**                                   |
| ---------------------------------------------------------------------------------------------- | ---------------------------------------- |
| [**Location**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/client/widgetbase)    | **위젯의 위치를 변경할 수 있어요. (X좌표 값, Y좌표 값, 0)** |
| [**Rotation**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/client/widgetbase)    | **위젯의 회전을 설정할 수 있어요. (설정할 값)**           |
| [**Scale**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/client/widgetbase)       | **위젯의 스케일을 설정할 수 있어요. (설정할 값)**          |
| [**Size**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/client/widgetbase)        | **위젯의 크기를 설정할 수 있어요. (가로값, 세로값, 0)**     |
| [**ZOrder**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/client/widgetbase)      | **위젯의 그리는 순서를 설정할 수 있어요.**               |
| [**Visible**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/client/widgetbase)     | **UI 위젯의 표시 여부를 설정할 수 있어요. (위젯 표시 여부)**  |
| [**Interaction**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/client/widgetbase) | **UI 위젯의 반응 여부를 설정할 수 있어요. (위젯 반응 여부)**  |
| [**Opacity**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/client/widgetbase)     | **위젯의 투명 값을 설정할 수 있어요. (설정할 값)**         |
| [**AnchorType**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/client/widgetbase)  | **위젯의 고정 여부를 설정할 수 있어요. (설정할 타입)**       |
| [**IsFill**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/client/widgetbase)      | **위젯의 채우기를 설정할 수 있어요.**                  |

### **이벤트**

| **이름**                                                                                               | **설명**                                                                                                                                                                                   |
| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [**OnVisibleEvent**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/client/widgetbase)    | <p><strong>widget이 보여질 때 호출되는 이벤트에요.</strong><br><strong>연결함수 형식은 function(widget), widget 은 보여지는 widget 객체 입니다.</strong></p>                                                            |
| [**OnInVisibleEvent**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/client/widgetbase)  | <p><strong>widget이 안 보여질 때 호출되는 이벤트에요.</strong><br><strong>연결함수 형식은 function(widget), widget 은 안 보여지는 widget 객체 입니다.</strong></p>                                                        |
| [**OnBeginDragEvent**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/client/widgetbase)  | <p><strong>widget의 드래그가 시작 될 때 호출되는 이벤트에요.</strong><br><strong>연결함수 형식은 function(widget, vector2D), widget은 클릭한 객체, vector2D는 마우스 위치에요.</strong></p>                                     |
| [**OnCancelDragEvent**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/client/widgetbase) | <p><strong>widget의 드래그가 취소될 때 호출되는 이벤트에요.</strong><br><strong>연결함수 형식은 function(widget, vector2D), widget은 클릭한 객체, vector2D는 마우스 위치에요.</strong></p>                                      |
| [**OnEndDragEvent**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/client/widgetbase)    | <p><strong>widget의 드래그가 드랍될 때 호출되는 이벤트에요.</strong><br><strong>연결함수 형식은 function(widget, vector2D, dragwidget), widget은 드랍한 객체, vector2D는 마우스 위치, dragwidget는 드래그한 widget에요.</strong></p> |

### **함수**

| **이름**                                                                                             | **설명**                                        |
| -------------------------------------------------------------------------------------------------- | --------------------------------------------- |
| [**AddChildUIScene**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/client/widgetbase) | **(deprecate) AddChildUIWidget 함수로 이용하세요.**   |
| [**AddChildWidget**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/client/widgetbase)  | **자식 UI 위젯을 추가할 수 있어요. (자식으로 추가할 UI 위젯)**     |
| [**SetParentWidget**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/client/widgetbase) | **부모 UI 위젯을 설정할 수 있어요. (부모로 설정할 UI 위젯)**      |
| [**Delete**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/client/widgetbase)          | **위젯을 제거할 수 있어요.**                            |
| [**GetTypeString**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/client/widgetbase)   | **위젯의 타입을 문자열로 얻을 수 있어요.**                    |
| [**GetType**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/client/widgetbase)         | **위젯의 타입을 Enum 형식으로 얻을 수 있어요.**               |
| [**SetDragWidget**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/client/widgetbase)   | **위젯의 DragEvent 발생 시 복사되어 보여질 widget을 세팅해요.** |
| [**SetDragOffset**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/client/widgetbase)   | **위젯의 DragWidget에 적용될 Offset 이에요.**           |
