救命!标签页和标签控件 [英] Help! Tab Pages and the Tab Control

查看:49
本文介绍了救命!标签页和标签控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我有一个应用程序,它使用带有多个标签页的标签控件。

有时在其中一个标签上启动了一些处理页面

忙着做一些工作线程的东西。我必须

才能防止标签页发生变化(阻止用户选择

其他标签)这样的话。


我已经有一个变量来跟踪这个状态(即bool

IsBusy),但我现在无法弄清楚是否冻结了

IsBusy时的标签页是真的。这个想法是在处理过程中冻结它们,然后在它完成后解冻它们。


到目前为止,我已经尝试设置 CanSelect"每个

其他标签页的属性,但它们是只读的。此外,每个标签页都没有b $ b似乎具有已启用功能。属性像大多数其他控件。那个

会让事情变得容易多了。


Gusy,我怎么能让它工作呢?

Hello,

I have an app that uses a tab control with several tab pages.
Sometimes some of the processing initiated on one of the tab pages
gets busy doing stuff that is farmed out to worker threads. I have to
be able to prevent the tab page from changing (prevent users selecting
other tabs) while this is going on.

I already have a variable to track the status of this (i.e. "bool
IsBusy"), but I cannot figure out now to "freeze" the tab pages when
"IsBusy" is true. The idea is to freeze them while the processing is
going on and then unfreeze them once it has completed.

So far I have tried setting the "CanSelect" properties for each of the
other tab pages, but they are read-only. Also, each tab page does not
appear to have an "Enabled" property like most other controls. That
would make things a lot easier.

Gusy, how can I get this to work?

推荐答案

2008年4月28日星期一14:31:09 -0700(PDT), jo *********@topscene.com

写道:
On Mon, 28 Apr 2008 14:31:09 -0700 (PDT), jo*********@topscene.com
wrote:

>你好,

我有一个应用程序,它使用带有多个标签页的标签控件。
有时在其中一个标签页上启动的某些处理工作正忙于处理工作线程中的东西。我必须能够防止标签页发生变化(阻止用户选择
其他标签)。

我已经有一个变量来跟踪状态这个(即bool
IsBusy),但我现在无法弄清楚是否冻结了
IsBusy时的标签页是真的。我们的想法是在处理过程中冻结它们,然后在它完成后解冻它们。

到目前为止,我已尝试设置CanSelect。每个
其他标签页的属性,但它们是只读的。此外,每个标签页似乎没有已启用标签。属性像大多数其他控件。那将会让事情变得更加容易。

Gusy,我怎么能让它发挥作用?
>Hello,

I have an app that uses a tab control with several tab pages.
Sometimes some of the processing initiated on one of the tab pages
gets busy doing stuff that is farmed out to worker threads. I have to
be able to prevent the tab page from changing (prevent users selecting
other tabs) while this is going on.

I already have a variable to track the status of this (i.e. "bool
IsBusy"), but I cannot figure out now to "freeze" the tab pages when
"IsBusy" is true. The idea is to freeze them while the processing is
going on and then unfreeze them once it has completed.

So far I have tried setting the "CanSelect" properties for each of the
other tab pages, but they are read-only. Also, each tab page does not
appear to have an "Enabled" property like most other controls. That
would make things a lot easier.

Gusy, how can I get this to work?



点击另一个标签时有几个事件被触发。

您可以通过查看状态来完成任务

其中一个变量。我会建议验证事件。你还需要一个指向当前标签的变量,所以你知道

如果需要可以回到哪里。

There are several events that get fired when you click on another tab.
You may be able to accomplish your task by checking you status
variable in one of these. I would suggest the Validating event. You
will also need a variable that points to the current tab, so you know
where to go back to if needed.


2008年4月28日星期一14:31:09 -0700,< jo ********* @topscene.comwrote:
On Mon, 28 Apr 2008 14:31:09 -0700, <jo*********@topscene.comwrote:

[...]

到目前为止,我已尝试设置CanSelect每个

其他标签页的属性,但它们是只读的。此外,每个标签页都没有b $ b似乎具有已启用功能。属性像大多数其他控件。那个

会让事情变得容易多了。
[...]
So far I have tried setting the "CanSelect" properties for each of the
other tab pages, but they are read-only. Also, each tab page does not
appear to have an "Enabled" property like most other controls. That
would make things a lot easier.



你可以禁用整个TabControl。


我认为这将是最用户友好的方法。你可能会尝试其他

黑客攻击,但我认为它们对用户不太友好,而且b $ b更难以实现(取决于TabControl的工作原理)
实现了
,它甚至可能需要覆盖WndProc()

方法并直接处理窗口消息...哎呀!)


顺便说一句,只是一个小建议:没有必要写下这个词

帮助!在你的主题。我想我们都可以理所当然地认为,如果你在这里问一个问题,那你就是在寻求帮助。 :)


Pete

You can disable the entire TabControl.

I think that would be the most user-friendly approach. There are other
hacks you might try, but I think they would be less user-friendly as well
as significantly more difficult (depending on how TabControl is
implemented, it could even involve the need to override the WndProc()
method and handling window messages directly...yuck!)

By the way, just a minor suggestion: there''s no need to write the word
"Help!" in your subject. I think we can all take it as granted that if
you''re asking a question here, you''re requesting help. :)

Pete


< jo ********* @ topscene.comwrote in message

新闻:dc ********************************** @ y38g2000 hsy.googlegroups.com ...
<jo*********@topscene.comwrote in message
news:dc**********************************@y38g2000 hsy.googlegroups.com...

您好,


我有一个应用程序,它使用带有多个标签页的标签控件。

有时,在其中一个标签页上启动的某些处理工作会忙于处理工作线程中的东西。我必须

才能防止标签页发生变化(阻止用户选择

其他标签)这样做。
Hello,

I have an app that uses a tab control with several tab pages.
Sometimes some of the processing initiated on one of the tab pages
gets busy doing stuff that is farmed out to worker threads. I have to
be able to prevent the tab page from changing (prevent users selecting
other tabs) while this is going on.



您是否有使用工作线程的原因?如果处理发生在

与调用函数相同的线程中,那不会解决

问题吗?如果您正在关闭*多个*进程,那就可以解释它。

在这种情况下,也许在while循环中检查进程状态?


-

Richard Carpenter

Is there a reason you''re using worker threads? If the processing occurred in
the same thread as the calling function, wouldn''t that take care of the
problem? If you''re firing off *multiple* processes, that would explain it.
In that case, perhaps a check on the process status in a while loop?

--
Richard Carpenter


这篇关于救命!标签页和标签控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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