LITTLEBLACKDOG.COM Forum Index LITTLEBLACKDOG.COM

 
LWD LWD   FAQ FAQ   Memberlist Memberlist   Usergroups Usergroups   Active Topics Active Topics   Register Register  
  Profile Profile   Log in to check your private messages Log in to check your private messages   Log in Log in  
  Who is Online Who is Online   Image Gallery Image Gallery   Chat Chat   Search Search  
  LWDGear       LBDGear  

View next topic
View previous topic
Post new topic     Reply to topic   LITTLEBLACKDOG.COM Forum Index » Code Warriors
Author Message
cmurphy
Stray Dog


Joined: 19 Sep 2006
Posts: 41
Location: US

Post Posted: Thu Feb 08, 2007 4:48 pm   Post subject: Disable mouse click? Reply with quote Back to top  

I want to prevent user to click around in any part of my C# windows application (button, menu and so on) while my application saving file. This is a drawing program. This is my boss's project and I'm adding features.

It saving serveral image & rtf files at the time so if user keep click around or try to drawing more anyway, it will crash my application. I've search google and found few refers to API but I'm not familiar with it. I'm not sure how should I proceed this.

I have a small pop-up display progress bar while it's saving. I make it always on top but the problem is my user still can click on my main application and continue do other thing.

Is there a better way? Please advice,
View user's profile Send private message
T
Curmudgeon


Joined: 17 May 2001
Posts: 16187
Location: Airstrip One

Post Posted: Thu Feb 08, 2007 4:53 pm   Post subject: Reply with quote Back to top  

http://en.wikipedia.org/wiki/Modal_window perhaps?

_________________
Got questions? Click here.
Still got questions? Click here, too.

affabletoaster, Akely, anglachel, blahpony, CMTG, EdisonRex, Elk, Equin, evilness, Fido, fathertyme, Goddess, Jaymac, je, jodygirl, KingKobra, Lycander, mally, Max, OhioArt2, perrito_blanco, Rover, Spot, sully_51, Superdwarf, the taz man, thriftyjack, twiztid, wrathiron, yiayia49

Would you like
good music at a price that is right? CD Baby, baby.

You look like you need a monkey.
View user's profile Send private message
cmurphy
Stray Dog


Joined: 19 Sep 2006
Posts: 41
Location: US

Post Posted: Tue Feb 13, 2007 3:17 pm   Post subject: Reply with quote Back to top  

I did but user still be able to continue whatever they are doing. I just want to somehow prevent them to mouse click on any part of the program. Thanks away.
View user's profile Send private message
Lycander
Lead Dog
Lead Dog


Joined: 24 May 2002
Age: 25
Posts: 12198
Location: The Constitution State

Post Posted: Tue Feb 13, 2007 3:41 pm   Post subject: Reply with quote Back to top  

Hehehe.... hide the main appication window Razz Then unhide it when you're done.

That's the quick and dirty way to do it. The longer and probably more visually appealing way to do it is to create a global variable that's basically a boolean, "allowMouseEvent." When you start the saving routine, set it to false. Then in every mouse event handler you'd have to check the global variable to see if mouse event processing it allowed or not.

_________________
To the top of hunger mountain
I found my solitary ways
Where I could live on nuts and honey
And take my shelter in a cave
View user's profile Send private message
CMTG
Leg Humper
Leg Humper


Joined: 23 Feb 2002
Posts: 4959
Location: On average, Cheltenham.

Post Posted: Tue Feb 13, 2007 4:21 pm   Post subject: Reply with quote Back to top  

Globals? Pah... Wink What's wrong with just disabling the relevant controls while your application is saving? Try System.Windows.Forms.Control.Enabled. (Or maybe even EnableWindow(hwnd, bool); if you're into Win32API.)

The most elegant way is, of course, to do what Toxin suggests and make your progress window a modal dialog rather than always-on-top. Modal dialogs effectively disable their parent windows. Try System.Windows.Forms.Form.ShowDialog. (Or DialogBox() etc...)

_________________
Pie. I wish I could
constrain my hungry greed but...
Sadly, defeated.


Charlene's Law: There's no such thing as can't.
Charlene's Corollary: Unless it's followed by be arsed.

If only 20% of your staff is programmers, and you can save 50% on salary by outsourcing programmers to India, well, how much of a competitive advantage are you really going to get out of that 10% savings?
View user's profile Send private message Send e-mail Visit poster's website
cmurphy
Stray Dog


Joined: 19 Sep 2006
Posts: 41
Location: US

Post Posted: Wed Feb 14, 2007 10:22 am   Post subject: Reply with quote Back to top  

I choose System.Windows.Forms.Control.Enabled. That's all I need to disable control so user can't draw while my application saving file.

Thank you very much, guys. This all great ideas! Smile
View user's profile Send private message
Display posts from previous:   
Post new topic     Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group
phpBB SEO
All times are GMT - 8 Hours

Help us keep advertisements off this site. Donate today!