Article View: borland.public.cppbuilder.nativeapi
Article #17228Tab Control, Child Dialogs, and Initial Focus
From: Gary Setter
Date: Sun, 30 Mar 2003 00:20
Date: Sun, 30 Mar 2003 00:20
23 lines
2045 bytes
2045 bytes
Hi, I had a problem with the initial focus of a dialog. I'm making a dialog with the tabbed control and child dialogs. For each tab of the tabbed control I defined a child dialog in the RC file with the controls that must be displayed for that tab. When the container dialog is created, I create the child dialogs and then change the parent of each of the controls to the container dialog. The initial focus was going to the first control of the child dialog. Explicitly calling SetFocus on the Ok button was ineffective. The Kernel was changing focus back to the first child control after setup. I found that I could set the focus where I wanted it by changing the Z-Order of the Ok button like this: SetWindowPos(GetDlgItem(hWnd,IDOK),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); Anyone know if this is the "right" way of the handling the problem or if there is a better way? Also, I found that I had to reverse the creation order of the child dialog controls from normal so that the tab order is as expected.
Technical Details
Message-ID:
<3e86e9fb@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!iad-peer.news.verio.net!news.verio.net!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,2d32558cb52e080,start X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-03-30 05:16:17 PST From: "Gary Setter" <setterg@worldnet.att.net> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Tab Control, Child Dialogs, and Initial Focus Date: Sat, 29 Mar 2003 18:20:30 -0600 Lines: 24 MIME-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 12.84.32.11 Message-ID: <3e86e9fb@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1049029115 12.84.32.11 (30 Mar 2003 04:58:35 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!iad-peer.news.verio.net!news.verio.net!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail