# Command Handler

## Giới Thiệu

Command Handler là chức năng giúp 1 thành phần trên giao diện GUI có thể xử lý sự kiện khi được nhấn vào.

Ví dụ 1 nút bấm có thể cài đặt command handler để có thể nhận sự kiện click.

## Thiết Lập Command Handler

Command Handler nhận vào 3 tham số

<table><thead><tr><th width="166">Tham Số</th><th>Mô Tả</th></tr></thead><tbody><tr><td>Window</td><td>Cửa sổ chứa nút/thành phần muốn nhận sự kiện</td></tr><tr><td>Command</td><td>ID của thành nút/thành phần muốn nhận sự kiện, sử dụng thông qua function <a href="/pages/VGxb5JvIMH2J7BAzXCXp">GetDlgCtrlID</a></td></tr><tr><td>Window Command Handler</td><td>Đặt tên cho function xử lý sự kiện, function nhận vào 2 tham số đó là cửa sổ và id của nút/thành phần nhận sự kiện</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.taiamk.pro/gui/window/command-handler.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
