如何访问父类中的子控件 [英] how to access child controls in parent class

查看:75
本文介绍了如何访问父类中的子控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个其中MainWndDlg.cpp包含tabctrl的应用程序.
每个选项卡都是主窗口(选项卡式对话框)的子级,每个选项卡都有一个类(tabonedlg.cpp,tabtwodlg.cpp).

在选项卡中,我创建了一些控件,例如编辑,复选框等.

在主窗口中,存在spinctrl btn.

现在的问题是,当我单击或更改主wnd中的spinctrl按钮时,我需要更改tabctrl中存在的ctrl数据才能进行更改.

可能吗?如果是,怎么办?
(请给我一些建议)

我对CWnd函数不了解,请为您提供任何文章以获取有关它的信息.


嘿,谢谢大家的帮助...我通过使用SetDlgItemText

Hi Guys,

I''ve an application in which MainWndDlg.cpp contains tabctrl.
Each tab is child of main window (tabbed dialog box) and I have a class for each tab (tabonedlg.cpp,tabtwodlg.cpp).

In the tabs, I''ve created some controls like edit, check box, etc.

In the main window spinctrl btn is present.

Now the problem is when I clicked or change the spinctrl button in main wnd, I need to change ctrl''s data present in tabctrl to be changed.

Is it possible? If yes, how?
(pls give me suggestions)

I don''t have idea about CWnd funcs, please could you suggest any articles to get info about it.


Hey Thanks guys for u help... I found the solution to the problem by using SetDlgItemText

推荐答案

找到了解决问题的方法
Check this article[^], it could help you.


您好,如果您使用MFC属性表类创建了选项卡式对话框,则可以使用主要的diloag类(CPropertySheet派生类)将具有每个选项卡类的对象(CPropertyPage派生类).这些对象将具有选项卡(子对话框)上控件的数据成员.因此,使用父daialog类中的这些对象,可以访问选项卡控件的数据.

问候,
Devadutta.
Hi,If you have created the tabbed dialog using the MFC property sheet class, then the main diloag class(The CPropertySheet derived class) will have the objects of each tab class(CPropertyPage derived class).These objects will have data members for the controls that are on the tabs(child dialogs). So using these objects inside the parent daialog class the data of the tab''s controls can be accessed .

Regards,
Devadutta.


这篇关于如何访问父类中的子控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆