Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / March 2006

Tip: Looking for answers? Try searching our database.

GUI's, threading and stopping the user clicking etc.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kevin - 08 Mar 2006 16:10 GMT
I am would like to start making my programs more responsive by
introducing threading.
My programs perform reasonable size db queries and builds large
treeviews etc.  I know how to create thread and set them off etc, which
leaves the GUI nice and responsive for the user.

However, this also means that they might do something that affects the
thread, like clearing the treeview, or trying to start another query
while that is running.  I would say that to start off I would like to
stop the user doing ANYTHING while, say, a db query  was running.

What is the best way to achieve this?  One way would be to have a
global variable called boolBUSY, then every time the user tries to do
something it first checks this variable before continuing.  The only
think about this way is that you have to put in in every event handler
which seems a bit clunky.  Or, similarly, you could check that the
cursor is not an hourglass but this gives the same problem.

Is there a way to ignore certain user input (keyboard, mouse click
etc)?

The Eclipse Java IDE brings up a little dialog box that says something
along the lines of 'System busy, cannot interupt', which seems
reasonable.

Any pointers would be greatfully received.
Thanks
Kevin
Michael Nemtsev - 08 Mar 2006 17:22 GMT
Hello Kevin,

There are several cases. Disable controls that are responsible for interaction
with thread; create new dialog window where show
the process of performing thread and etc.

K> I am would like to start making my programs more responsive by
K> introducing threading.
K> My programs perform reasonable size db queries and builds large
K> treeviews etc.  I know how to create thread and set them off etc,
K> which
K> leaves the GUI nice and responsive for the user.
K> However, this also means that they might do something that affects
K> the thread, like clearing the treeview, or trying to start another
K> query while that is running.  I would say that to start off I would
K> like to stop the user doing ANYTHING while, say, a db query  was
K> running.
K>
K> What is the best way to achieve this?  One way would be to have a
K> global variable called boolBUSY, then every time the user tries to do
K> something it first checks this variable before continuing.  The only
K> think about this way is that you have to put in in every event
K> handler which seems a bit clunky.  Or, similarly, you could check
K> that the cursor is not an hourglass but this gives the same problem.
K>
K> Is there a way to ignore certain user input (keyboard, mouse click
K> etc)?
K>
K> The Eclipse Java IDE brings up a little dialog box that says
K> something along the lines of 'System busy, cannot interupt', which
K> seems reasonable.
K>
K> Any pointers would be greatfully received.
K> Thanks
K> Kevin
---
WBR,
Michael  Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Mattias Sjögren - 08 Mar 2006 17:24 GMT
>What is the best way to achieve this?

You could show a modal dialog box, possibly containing a progress bar
or something to notify the user about what's going on. Or just disable
all the relevant controls on the main form.

Mattias

Signature

Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.