diff options
| author | Pietro Gagliardi <[email protected]> | 2014-02-10 17:10:47 -0500 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-02-10 17:10:47 -0500 |
| commit | bcc8751c8ba5f54d5da74aa7e38741dadd62fea8 (patch) | |
| tree | 0f93fc6d94256fddb017219ae9192365b8e6f6dc | |
| parent | 2231c339546e15e4125bac269526d728763ba3e5 (diff) | |
Added a checkbox to the example window.
| -rw-r--r-- | main.go | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -26,6 +26,7 @@ const ( IDC_EDIT IDC_LIST IDC_LABEL + IDC_CHECK ) var varCombo, fixCombo, edit, list HWND @@ -68,14 +69,20 @@ func wndProc(hwnd HWND, msg uint32, wParam WPARAM, lParam LPARAM) LRESULT { } // TODO get text from index + checkState, err := IsDlgButtonChecked(hwnd, IDC_CHECK) + if err != nil { + fatalf("error getting checkbox check state: %v", err) + } + MessageBox(hwnd, fmt.Sprintf("button state: %s\n" + "variable combo box text: %s\n" + "fixed combo box text with WM_GETTEXT: %s\n" + "fixed combo box current index: %d\n" + "edit field text: %s\n" + - "list box current index: %d\n", - buttonclick, varText, fixTextWM, fixTextIndex, editText, listIndex), + "list box current index: %d\n" + + "check box checked: %v\n", + buttonclick, varText, fixTextWM, fixTextIndex, editText, listIndex, checkState == BST_CHECKED), "note", MB_OK) } @@ -232,6 +239,16 @@ func main() { fatalf("error creating label: %v", err) } + _, err = CreateWindowEx( + 0, + "BUTTON", "Checkbox", + BS_AUTOCHECKBOX | controlStyle, + 140, 110, 100, 20, + hwnd, HMENU(IDC_CHECK), hInstance, NULL) + if err != nil { + fatalf("error creating checkbox: %v", err) + } + _, err = ShowWindow(hwnd, nCmdShow) if err != nil { fatalf("error showing window: %v", err) |
