473,396 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Help! Tab Pages and the Tab Control

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?
Jun 27 '08 #1
12 2295
On Mon, 28 Apr 2008 14:31:09 -0700 (PDT), jo*********@topscene.com
wrote:
>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.
Jun 27 '08 #2
On Mon, 28 Apr 2008 14:31:09 -0700, <jo*********@topscene.comwrote:
[...]
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.
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
Jun 27 '08 #3
<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.
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

Jun 27 '08 #4
<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.
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

Jun 27 '08 #5
On Mon, 28 Apr 2008 17:43:59 -0700, Richard Carpenter
<ru*******@hotmail.comwrote:
<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.

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 nothing else, using a worker thread for a lengthy operation ensures
correct visual behavior from the user interface, by avoiding the blockage
of the UI thread's message pump.

This would be important even if the UI wasn't updated during the operation
-- for example, if the window is dragged or obscured in a way that
requires it to be redrawn -- but it's obviously even more so if the
lengthy operation is updating some sort of progress indicator in the UI.

IMHO, my previous suggestion to disable the TabControl is probably going
to work for the OP (since he already looked at disabling the tab to
prevent switching to another tab, and that's effectively what disabling
the control will do). But if not, an alternative would probably be to put
up a modal dialog box while the operation is proceeding.

Blocking the UI thread while the operation proceeds is a poor solution.

Pete
Jun 27 '08 #6
jo*********@topscene.com wrote:
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?
Handle the Selecting event and set e.Cancel to IsBusy

ie
void tab_Selecting(object sender, TabControlCancelEventArgs e)
{
e.Cancel = IsBusy;
}

JB
Jun 27 '08 #7
On Mon, 28 Apr 2008 18:09:52 -0700, John B <jb******@yahoo.comwrote:
Handle the Selecting event and set e.Cancel to IsBusy

ie
void tab_Selecting(object sender, TabControlCancelEventArgs e)
{
e.Cancel = IsBusy;
}
Note that if you use this approach, be sure to provide the user with some
feedback as to _why_ you've canceled the tab change. For example,
displaying an alert.

That's one advantage of simply disabling the control: it becomes
immediately apparent to the user that the control isn't going to accept
user input. Other alternatives are viable though, as long as the user is
always presented with clear information about why they aren't able to
change tabs in the control.

Pete
Jun 27 '08 #8
On Mon, 28 Apr 2008 21:22:57 -0700, mgsram <mg****@gmail.comwrote:
Disabling the tab control OR canceling the tab change _alone_ can lead
to confusion to the user due to inactivity, especially if the wait
time is longer.
Disabling the control is not mutually exclusive with providing progress
feedback. I agree that progress feedback is desirable _as well_, and
never intended anyone to take my suggestion to mean otherwise. I'm sorry
if I didn't make that clear enough.

Ignoring the issue of progress feedback though, disabling the control
provides the user with a clear indication that the UI will not respond at
the moment. That's a lot different from a control that looks ready to
respond but ignores your input without any feedback at all.

Pete
Jun 27 '08 #9
On Apr 29, 2:57*am, "Peter Duniho" <NpOeStPe...@nnowslpianmk.com>
wrote:
On Mon, 28 Apr 2008 21:22:57 -0700, mgsram <mgs...@gmail.comwrote:
Disabling the tab control OR canceling the tab change _alone_ can lead
to confusion to the user due to inactivity, especially if the wait
time is longer.

Disabling the control is not mutually exclusive with providing progress *
feedback. *I agree that progress feedback is desirable _as well_, and *
never intended anyone to take my suggestion to mean otherwise. *I'm sorry *
if I didn't make that clear enough.

Ignoring the issue of progress feedback though, disabling the control *
provides the user with a clear indication that the UI will not respond at *
the moment. *That's a lot different from a control that looks ready to *
respond but ignores your input without any feedback at all.

Pete
We are already using a progress bar and status text to provide visual
feedback. And this is another reason why we are using worker threads -
we would see "white out," and it would get really ugly otherwise.

As for disabling the entire tab control, well that is not an option.
This is because the associated progress bar, status text, and a cancel
button are containted within it.

I agree with John B, wow a Selecting event with an EventArg e with a
cancel option would be a great solution. And that's what I went
looking for first. Unfortunately these options do not exist with the
tab control (at least not in .net 3.5)!

And Peter, I understand about the "Help in the subject" thing. You're
right.

Any other suggestions?
Jun 27 '08 #10
On Apr 29, 8:12*am, joey.pow...@topscene.com wrote:
On Apr 29, 2:57*am, "Peter Duniho" <NpOeStPe...@nnowslpianmk.com>
wrote:


On Mon, 28 Apr 2008 21:22:57 -0700, mgsram <mgs...@gmail.comwrote:
Disabling the tab control OR canceling the tab change _alone_ can lead
to confusion to the user due to inactivity, especially if the wait
time is longer.
Disabling the control is not mutually exclusive with providing progress *
feedback. *I agree that progress feedback is desirable _as well_, and *
never intended anyone to take my suggestion to mean otherwise. *I'm sorry *
if I didn't make that clear enough.
Ignoring the issue of progress feedback though, disabling the control *
provides the user with a clear indication that the UI will not respond at *
the moment. *That's a lot different from a control that looks ready to*
respond but ignores your input without any feedback at all.
Pete

We are already using a progress bar and status text to provide visual
feedback. And this is another reason why we are using worker threads -
we would see "white out," and it would get really ugly otherwise.

As for disabling the entire tab control, well that is not an option.
This is because the associated progress bar, status text, and a cancel
button are containted within it.

I agree with John B, wow a Selecting event with an EventArg e with a
cancel option would be a great solution. And that's what I went
looking for first. Unfortunately these options do not exist with the
tab control (at least not in .net 3.5)!

And Peter, I understand about the "Help in the subject" thing. You're
right.

Any other suggestions?- Hide quoted text -

- Show quoted text -
OK OK not sure what was going on earlier, but I found a "Selecting"
event. I'm checking into that now...
Jun 27 '08 #11
On Apr 28, 9:20*pm, "Peter Duniho" <NpOeStPe...@nnowslpianmk.com>
wrote:
On Mon, 28 Apr 2008 18:09:52 -0700, John B <jbngs...@yahoo.comwrote:
Handle the Selecting event and set e.Cancel to IsBusy
ie
void tab_Selecting(object sender, TabControlCancelEventArgs e)
{
* *e.Cancel = IsBusy;
}

Note that if you use this approach, be sure to provide the user with some *
feedback as to _why_ you've canceled the tab change. *For example, *
displaying an alert.

That's one advantage of simply disabling the control: it becomes *
immediately apparent to the user that the control isn't going to accept *
user input. *Other alternatives are viable though, as long as the user is *
always presented with clear information about why they aren't able to *
change tabs in the control.

Pete
Hi,

I think that the best solution is your proposed modal dialog
Jun 27 '08 #12
On Tue, 29 Apr 2008 06:12:28 -0700, <jo*********@topscene.comwrote:
We are already using a progress bar and status text to provide visual
feedback. And this is another reason why we are using worker threads -
we would see "white out," and it would get really ugly otherwise.
Agreed.
As for disabling the entire tab control, well that is not an option.
Why not? Your first post implied that disabling an individual tab page
would have been okay, and that would have had the exact same effect, had
it worked.
This is because the associated progress bar, status text, and a cancel
button are containted within it.
Personally, I don't see why those things would be in the tab page if you
want to basically disable the entire tab control while the processing is
going on. However, if you insist, then I suppose that's an issue (at
least for the Cancel button...the other stuff can stand to be disabled
while still providing feedback).

Still, IMHO you should disable all of the tab page contents except those
items, to provide the user with useful feedback (at least, if there are
editable controls that shouldn't be modified during the operation, which
seems implied by your description). IMHO, better would be to put the
status UI somewhere else. Either in the same form, but outside the tab
control, or -- even better -- in a modal dialog.

It's hard to know for sure what's the right thing without knowing more
about the rest of your UI design. But you seem to have a user-modal
sitaution here in which nothing else should be touched while the
processing is going on.

Pete
Jun 27 '08 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Dave | last post by:
After following Microsofts admonition to reformat my system before doing a final compilation of my app I got many warnings/errors upon compiling an rtf file created in word. I used the Help...
9
by: Tom | last post by:
A question for gui application programmers. . . I 've got some GUI programs, written in Python/wxPython, and I've got a help button and a help menu item. Also, I've got a compiled file made with...
4
by: Sarir Khamsi | last post by:
Is there a way to get help the way you get it from the Python interpreter (eg, 'help(dir)' gives help on the 'dir' command) in the module cmd.Cmd? I know how to add commands and help text to...
6
by: wukexin | last post by:
Help me, good men. I find mang books that introduce bit "mang header files",they talk too bit,in fact it is my too fool, I don't learn it, I have do a test program, but I have no correct doing...
6
by: d.warnermurray | last post by:
I am doing a project for school that involves creating help files for a html authoring tool. If you could help me with answers to some questions it would really help. 1. What tasks do you expect...
3
by: Colin J. Williams | last post by:
Python advertises some basic service: C:\Python24>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) on win32 Type "help", "copyright", "credits" or "license" for more information. >>> With...
7
by: Corepaul | last post by:
Missing Help Files When I enter "recordset" as the keyword and search the Visual Basic Help index, I get many topics of interest in the resulting list. But there isn't any information available...
10
by: JonathanOrlev | last post by:
Hello everybody, I wrote this comment in another message of mine, but decided to post it again as a standalone message. I think that Microsoft's Office 2003 help system is horrible, probably...
1
by: trunxnirvana007 | last post by:
'UPGRADE_WARNING: Array has a new behavior. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"' 'UPGRADE_WARNING: Couldn't resolve...
0
by: hitencontractor | last post by:
I am working on .NET Version 2003 making an SDI application that calls MS Excel 2003. I added a menu item called "MyApp Help" in the end of the menu bar to show Help-> About. The application...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.