summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-06-26 20:20:00 -0400
committerPietro Gagliardi <[email protected]>2014-06-26 20:20:00 -0400
commit5c002e3d0f0b873d6ca29dfa9e97c09dead54494 (patch)
tree41e49640a2b63b08c67180fa520e851e02f0ccd7
parent700fef758ba004facd408b3919466d196c1132a0 (diff)
Allowed tab stops on Windows; see http://blogs.msdn.com/b/oldnewthing/archive/2003/10/21/55384.aspx. Fixes #13
-rw-r--r--sysdata_windows.go8
-rw-r--r--todo.md1
-rw-r--r--uitask_windows.go10
3 files changed, 16 insertions, 3 deletions
diff --git a/sysdata_windows.go b/sysdata_windows.go
index caac1c1..f3ecffe 100644
--- a/sysdata_windows.go
+++ b/sysdata_windows.go
@@ -87,10 +87,11 @@ var classTypes = [nctypes]*classData{
name: toUTF16("STATIC"),
// SS_NOPREFIX avoids accelerator translation; SS_LEFTNOWORDWRAP clips text past the end
// controls are vertically aligned to the top by default (thanks Xeek in irc.freenode.net/#winapi)
- style: _SS_NOPREFIX | _SS_LEFTNOWORDWRAP | controlstyle,
+ // also note that tab stops are remove dfor labels
+ style: (_SS_NOPREFIX | _SS_LEFTNOWORDWRAP | controlstyle) &^ _WS_TABSTOP,
xstyle: 0 | controlxstyle,
// MAKE SURE THIS IS THE SAME
- altStyle: _SS_NOPREFIX | _SS_LEFTNOWORDWRAP | controlstyle,
+ altStyle: (_SS_NOPREFIX | _SS_LEFTNOWORDWRAP | controlstyle) &^ _WS_TABSTOP,
},
c_listbox: &classData{
name: toUTF16("LISTBOX"),
@@ -110,7 +111,8 @@ var classTypes = [nctypes]*classData{
},
c_progressbar: &classData{
name: toUTF16(x_PROGRESS_CLASS),
- style: _PBS_SMOOTH | controlstyle,
+ // note that tab stops are disabled for progress bars
+ style: (_PBS_SMOOTH | controlstyle) &^ _WS_TABSTOP,
xstyle: 0 | controlxstyle,
doNotLoadFont: true,
},
diff --git a/todo.md b/todo.md
index 52f9bf1..c6164db 100644
--- a/todo.md
+++ b/todo.md
@@ -2,6 +2,7 @@ ALL:
- vertical alignment of labels still has some flaws
- gtk+: currently requires labels to be filling for this to work: grids don't do this by default, for instance
- won't cause any issues, just an inconvenience that should be addressed
+- make sure tab stop behavior for Areas makes sense, or provide a handler function
MAC OS X:
- NSComboBox scans the entered text to see if it matches one of the items and returns the index of that item if it does; find out how to suppress this so that it returns -1 unless the item was chosen from the list (like the other platforms)
diff --git a/uitask_windows.go b/uitask_windows.go
index f4ce50d..1075b5b 100644
--- a/uitask_windows.go
+++ b/uitask_windows.go
@@ -91,7 +91,9 @@ func ui(main func()) error {
var (
_dispatchMessage = user32.NewProc("DispatchMessageW")
+ _getActiveWindow = user32.NewProc("GetActiveWindow")
_getMessage = user32.NewProc("GetMessageW")
+ _isDialogMessage = user32.NewProc("IsDialogMessageW")
_postQuitMessage = user32.NewProc("PostQuitMessage")
_sendMessage = user32.NewProc("SendMessageW")
_translateMessage = user32.NewProc("TranslateMessage")
@@ -119,6 +121,14 @@ func msgloop() {
if r1 == 0 { // WM_QUIT message
return
}
+ // this next bit handles tab stops
+ r1, _, _ = _getActiveWindow.Call()
+ r1, _, _ = _isDialogMessage.Call(
+ r1, // active window
+ uintptr(unsafe.Pointer(&msg)))
+ if r1 != 0 {
+ continue
+ }
_translateMessage.Call(uintptr(unsafe.Pointer(&msg)))
_dispatchMessage.Call(uintptr(unsafe.Pointer(&msg)))
}