473,729 Members | 2,376 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2320
On Mon, 28 Apr 2008 14:31:09 -0700 (PDT), jo*********@top scene.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*********@to pscene.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*********@to pscene.comwrote in message
news:dc******** *************** ***********@y38 g2000hsy.google groups.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*********@to pscene.comwrote in message
news:dc******** *************** ***********@y38 g2000hsy.google groups.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*******@hotm ail.comwrote:
<jo*********@to pscene.comwrote in message
news:dc******** *************** ***********@y38 g2000hsy.google groups.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*********@top scene.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(o bject sender, TabControlCance lEventArgs 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(o bject sender, TabControlCance lEventArgs 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.c omwrote:
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...@nn owslpianmk.com>
wrote:
On Mon, 28 Apr 2008 21:22:57 -0700, mgsram <mgs...@gmail.c omwrote:
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

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

Similar topics

21
6553
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 Workshop program: hcw.exe that's included with Visual Basic. This exact same file compiled perfectly with no notes, warnings or errors prior to reformatting my system. Prior to the reformatting, I copied the help.rtf file onto a CD and checked the box to...
9
4411
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 the microsoft HTML workshop utility, lets call it c:\path\help.chm. My question is how do you launch it from the GUI? What logic do I put behind the "help" button, in other words. I thought it would be os.spawnv(os.P_DETACH,...
4
3353
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 cmd.Cmd but I would also like to get the man-page-like help for classes and functions. Does anyone know how to do that? Thanks. Sarir
6
4344
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 result in any way. Who can help me, I thank you very very much. list.cpp(main program) //-------------------------------------------------------------------------- - #pragma hdrstop #pragma argsused
6
3022
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 an html authoring tool to help you accomplish? 2. What do you expect from online help for a html authoring tool? 3. What audience do you think a freeware html authoring tool is directed towards?
3
3362
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 numarray, help gives unhelpful responses:
7
5382
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 from clicking on many of the available topics (mostly methods but some properties are also unavailable). This same problem occurs with many, if not most, keywords. Is there any way I can activate these "missing" help topics? HELP!
10
3363
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 the worst I ever seen. I almost cannot find anything I need, including things I
1
6130
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 default property of object Label. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' Label = New Object(){Box1, Box2, Box3, Box4, Box5, Box6, Box7, Box8, Box9, Box10, Box11,...
0
2887
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 calls MS Excel, so the scenario is that I am supposed to see the Excel Menu bar, FILE EDIT VIEW INSERT ... HELP. I am able to see the menu bar, but in case of Help, I see the Help of Excel and help of my application, both as a submenu of help. ...
0
8917
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8761
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9281
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9142
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6022
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2680
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.