Mercurial > dwindows
diff mac/dw.m @ 1795:9304241b7b33
Added new dw_window_set_focus() function and attempted to fix...
Intial focus after a subsequent dw_window_show() on Mac.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 24 Sep 2012 23:24:25 +0000 |
parents | b0bdec1b820c |
children | aedf5903db0a |
line wrap: on
line diff
--- a/mac/dw.m Mon Aug 13 06:18:30 2012 +0000 +++ b/mac/dw.m Mon Sep 24 23:24:25 2012 +0000 @@ -8240,6 +8240,7 @@ { DWWindow *window = handle; NSRect rect = [[window contentView] frame]; + id defaultitem = [window initialFirstResponder]; if([window isMiniaturized]) { @@ -8286,6 +8287,11 @@ [window setAutorecalculatesContentBorderThickness:NO forEdge:NSMinYEdge]; [window setContentBorderThickness:0.0 forEdge:NSMinYEdge]; } + if(defaultitem) + { + /* If there is a default item set, make it first responder */ + [window makeFirstResponder:defaultitem]; + } } return 0; } @@ -8487,10 +8493,26 @@ } /* + * Sets the current focus item for a window/dialog. + * Parameters: + * handle: Handle to the dialog item to be focused. + * Remarks: + * This is for use after showing the window/dialog. + */ +void API dw_window_set_focus(HWND handle) +{ + id object = handle; + + [[object window] makeFirstResponder:object]; +} + +/* * Sets the default focus item for a window/dialog. * Parameters: * window: Toplevel window or dialog. * defaultitem: Handle to the dialog item to be default. + * Remarks: + * This is for use before showing the window/dialog. */ void API dw_window_default(HWND handle, HWND defaultitem) {