简体   繁体   English

如何在powerbuilder中将焦点设置在选定的可视用户对象上

[英]how to set focus on selected visual user object in powerbuilder

I have main window that content a few stack panel and for every stack panel, consist visual user object. 我有一个主窗口,其中包含一些堆栈面板,并且对于每个堆栈面板,都包含可视用户对象。 My issue now is how to set focus on selected visual object in stack panel? 我现在的问题是如何将焦点设置在堆栈面板中的选定视觉对象上?

I suppose that somepanel.panel_control.SetFocus() will do what you want. 我想somepanel.panel_control.SetFocus()会做你想要的。

BTW, if the panels are visual user objects, it is not good practice to access directly to an inner control of an object from the window. 顺便说一句,如果面板是可视的用户对象,则不是从窗口直接访问对象的内部控件的好习惯。 It breaks encapsulation. 它破坏了封装。 You should add some methods to the user objects to reduce strong coupling. 您应该向用户对象添加一些方法以减少强耦合。 You can read the article about the Law of Demeter for a detailed explanation. 您可以阅读有关得 the 耳定律的文章,以获取详细说明。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM