Fixed tab order on Windows.
This commit is contained in:
parent
f396496c3b
commit
6e4845f11f
|
@ -41,6 +41,11 @@ struct uiSizingSys {
|
|||
int baseX;
|
||||
int baseY;
|
||||
LONG internalLeading;
|
||||
|
||||
// This is the window handle to pass to the hWndInsertAfter parameter of SetWindowPos().
|
||||
// You should set this to your own window handle when done.
|
||||
// Controls made with uiWindowsMakeControl() do this for you; you only need to do this if you are implementing uiControlResize() yourself.
|
||||
HWND InsertAfter;
|
||||
};
|
||||
// Use these in your preferredSize() implementation with baseX and baseY.
|
||||
#define uiWindowsDlgUnitsToX(dlg, baseX) MulDiv((dlg), baseX, 4)
|
||||
|
|
|
@ -147,6 +147,9 @@ static HRESULT resize(uiContainer *cc, RECT *r)
|
|||
if (ReleaseDC(c->hwnd, dc) == 0)
|
||||
return logLastError("error releasing DC in resize()");
|
||||
|
||||
// the first control gets the topmost z-order and thus the first tab stop
|
||||
sys.InsertAfter = HWND_TOP;
|
||||
|
||||
d.xPadding = uiWindowsDlgUnitsToX(winXPadding, sys.baseX);
|
||||
d.yPadding = uiWindowsDlgUnitsToY(winYPadding, sys.baseY);
|
||||
d.sys = &sys;
|
||||
|
@ -316,8 +319,9 @@ static void containerResize(uiControl *cc, intmax_t x, intmax_t y, intmax_t widt
|
|||
{
|
||||
struct container *c = (struct container *) (cc->Internal);
|
||||
|
||||
if (MoveWindow(c->hwnd, x, y, width, height, TRUE) == 0)
|
||||
if (SetWindowPos(c->hwnd, d->sys->InsertAfter, x, y, width, height, SWP_NOACTIVATE | SWP_NOOWNERZORDER) == 0)
|
||||
logLastError("error resizing uiContainer in containerResize()");
|
||||
d->sys->InsertAfter = c->hwnd;
|
||||
// under some circumstances this might not be sufficient
|
||||
// example: check the Spaced checkbox; inside boxes will have been resized already before they get a chance to update their padded
|
||||
SendMessageW(c->hwnd, msgUpdateChild, 0, 0);
|
||||
|
|
|
@ -55,8 +55,9 @@ static void singleResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width, i
|
|||
{
|
||||
struct singleHWND *s = (struct singleHWND *) (c->Internal);
|
||||
|
||||
if (MoveWindow(s->hwnd, x, y, width, height, TRUE) == 0)
|
||||
if (SetWindowPos(s->hwnd, d->sys->InsertAfter, x, y, width, height, SWP_NOACTIVATE | SWP_NOOWNERZORDER) == 0)
|
||||
logLastError("error moving control in singleResize()");
|
||||
d->sys->InsertAfter = s->hwnd;
|
||||
}
|
||||
|
||||
static int singleVisible(uiControl *c)
|
||||
|
|
Loading…
Reference in New Issue