{"id":3360,"date":"2015-12-21T15:28:50","date_gmt":"2015-12-21T07:28:50","guid":{"rendered":"http:\/\/blog.qdac.cc\/?p=3360"},"modified":"2015-12-21T15:29:36","modified_gmt":"2015-12-21T07:29:36","slug":"%e6%95%99%e7%a8%8b-%e8%ae%a9%e4%b8%80%e4%b8%aa%e5%90%8e%e5%8f%b0-ttabsheet-%e4%b8%8a%e7%9a%84%e6%8e%a7%e4%bb%b6%e5%88%87%e6%8d%a2%e5%88%b0%e5%89%8d%e5%8f%b0%e5%b9%b6%e8%8e%b7%e5%be%97%e7%84%a6","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=3360","title":{"rendered":"[\u6280\u5de7] \u8ba9\u4e00\u4e2a\u540e\u53f0 TTabSheet \u4e0a\u7684\u63a7\u4ef6\u5207\u6362\u5230\u524d\u53f0\u5e76\u83b7\u5f97\u7126\u70b9"},"content":{"rendered":"<p>\u5b9e\u9645\u4e0a\uff0c\u8fd9\u4e2a\u51fd\u6570\u5e76\u4e0d\u53ea\u80fd\u5b8c\u6210\u4e0a\u9762\u7684\u529f\u80fd\uff0c\u5b83\u662f\u8ba9\u4e00\u4e2a\u63a7\u4ef6\u83b7\u5f97\u7126\u70b9\uff0c\u5f53\u5b83\u5728\u540e\u53f0\u7684 TTabSheet \u9875\u9762\u4e0a\u65f6\uff0c\u4f1a\u5c06\u6240\u5728\u7684 TabSheet \u8bbe\u7f6e\u4e3a\u6d3b\u52a8\u9875\u9762\uff0c\u7136\u540e\u518d\u5207\u6362\u83b7\u5f97\u7126\u70b9\u3002\u5f53\u7136\uff0c\u5982\u679c\u5b83\u672c\u8eab\u4e0d\u80fd\u83b7\u5f97\u7126\u70b9\uff0c\u90a3\u4e48\uff0c\u4f1a\u8ba9\u5176\u7236\u83b7\u5f97\u7126\u70b9\uff0c\u4f9d\u6b21\u7c7b\u63a8\u3002<\/p>\n<p>\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre class=\"lang:delphi decode:true \">function ForceFocus(ACtrl: TWinControl): Boolean;\r\nvar\r\n  AParent: TWinControl;\r\nbegin\r\n  AParent := ACtrl.Parent;\r\n  if Assigned(AParent) then\r\n  begin\r\n    if AParent is TTabSheet then\r\n    begin\r\n      (AParent as TTabSheet).PageControl.ActivePage := AParent as TTabSheet;\r\n      Result := ForceFocus(AParent);\r\n    end\r\n    else\r\n      Result := ForceFocus(AParent);\r\n  end\r\n  else\r\n    Result:=True;\r\n  if Result then\r\n    begin\r\n    Result := ACtrl.CanFocus;\r\n    if Result then\r\n      ACtrl.SetFocus;\r\n    end;\r\nend;<\/pre>\n<p>\u8c03\u7528\u7684 ForceFocus \u5c31\u53ef\u4ee5\u5207\u6362\u7126\u70b9\u5230\u76f8\u5e94\u7684\u63a7\u4ef6\u4e0a\u4e86\uff0c\u5982\u679c\u5f53\u524d\u63a7\u4ef6\u4e0d\u53ef\u89c1\u6216Enabled\u4e3aFalse\uff0c\u5219\u4f1a\u8bbe\u7f6e\u5230\u5176\u7236\u63a7\u4ef6\u4e0a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b9e\u9645\u4e0a\uff0c\u8fd9\u4e2a\u51fd\u6570\u5e76\u4e0d\u53ea\u80fd\u5b8c\u6210\u4e0a\u9762\u7684\u529f\u80fd\uff0c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[69,8,21],"tags":[519,517,518],"class_list":["post-3360","post","type-post","status-publish","format-standard","hentry","category-c-builder","category-delphi","category-misc","tag-pagecontrol","tag-setfocus","tag-tabsheet"],"views":3544,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/3360","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3360"}],"version-history":[{"count":2,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/3360\/revisions"}],"predecessor-version":[{"id":3362,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/3360\/revisions\/3362"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3360"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3360"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}