Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

disabling start button

Status
Not open for further replies.

sfarfasrew

Programmer
Dec 3, 2005
3
US
Is there a way that I can disable the Start button while the program is running but still detect when the Start button is being pressed (so I can give a message saying please dont press the start button)?
 
You can set its enabled property to false, then back to true. You can't capture the click event while it is disabled though. Maybe MouseOver?
Guess the point is who cares if it is clicked on or not since nothing will happen? If it's a question of letting them know when a process has finished, you can add a message box after the procedure call...

The Microsoft mascot is a butterfly.
A butterfly is a bug.
Think about it....
 
If you just put the start button on the form, and don't provide any code in the click event, you essentially have a disabled button. Just put code in the click event that says "please don't press the start button" or whatever.

On the other hand, I wouldn't do that! I'd do what genomon is suggesting, and simply disable the Start button while your program is running, and forget about giving the user a message. This is more consistent with common GUI practice. The user will know that the button is disabled before trying to press it instead of after trying to press it, and this makes for better ergonomics. Why have the user do something useless and then tell him it's useless afterwards? Better to prevent the useless activity beforehand.

HTH

Bob
 
I suspect we are talking about the Start button rather than a Start button ...
 
Or, are you referring to the Windows Start button by any chance?
 
Guess that's what happens when you post a comment without refreshing the page :).

What strongm said ^^^^^
 
If you do have a Start button on your form, then you can set a flag when you want the button disabled. This you can put in an if statement.

Code:
if (DisableFlag) then
  MsgBox("Please don't press the Start button", vbOkOnly, "Error")
else
  ' Do your normal code here
endif

Of course, you may want the start button to be graphical and change its appearance to indicate that it is disabled.

HyperEngineer
If it ain't broke, it probably needs improvement.
 
<I suspect we are talking about the Start button rather than a Start button ...
What on earth for????? LOL
Seriously, if I had a piece of software that interfered with my ability to run other programs that way (whether it said please or not), I do believe I'd give it the 3 finger salute, uninstall it, and then invite friends over to a ritual burning of the cd's and packaging. Assuming the vendor wouldn't give me my money back, that is.
 
Bob,

That's an interesting perspective, and for the most part, I agree with you.

However, someone could be writing a 'kiosk' application. For example, imagine if every Automated Teller Machine ran Windows XP and you were responsible for writing the software for it. I'd think you would try pretty hard to disable the start button.

I only mention this because I'm hoping to write one myself in the near future (completely un-related to banking).

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
However, someone could be writing a 'kiosk' application. For example, imagine if every Automated Teller Machine ran Windows XP and you were responsible for writing the software for it. I'd think you would try pretty hard to disable the start button.

I think in general, it would be better to use group policy etc to lock down the OS, rather than making your application do it. I don't recall seeing a setting for disabling the start button though...

Take Care

Matt
If at first you don't succeed, skydiving is not for you.
 
>I'd think you would try pretty hard

Most ATMs don't have a QWERTY keyboard or mouse
 
I agree completely with Bob.

You shouldnt interfere with the normal operation of the OS.

If this is an application designed to be the only applicaton running on this PC then you could consider XP Embedded. You can create an image for the PC and you can turn on/off various elements of Windows not needed. I not sure but I guess the "Start" button could be turned off. I would still strongly suggest thinking about it before turning off such an integral part of the OS.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top