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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mimic a Button Depressed. 1

Status
Not open for further replies.

Alleyopp

Programmer
Sep 17, 2004
22
US
In my cmdPrint_click code I put in a DoEvent to allow the user to click on the Cancel button..

This works find but....
You visually can not tell the button was depressed. It also takes a while to trigger the cmdCancel_click and since you can't tell you depressed the button you tend to sit there clicking on it.. So never the less I need to figure out either why it does not call the normal routines to trigger the button depression(I maybe doing my DoEvent wrong) or mimic it myself.

Here is my code in the cmdPrint where it allows the user the abiltiy to press the cancel button..
Code:
'Make Cancel Print Button Visible Bug#124 ALH 12/2/04
 Me.cmdCancel.Visible = True
 Do While Not rst.EOF
    DoEvents
    If CancelPrint Then
        Exit Do
    End If
    Call Print_Quad_Chart_FY05(NZ(rst("Quad_id").value, 0), True, pfile, pout, copies)
     rst.MoveNext
 Loop
CancelPrint is set to true in the cmdCancel_click event if you user answers YES to wanting to cancel the print job.
I did not use any WithEvents... Not sure if I need to

Does anyone know how to do this..

Thanks Alley
 
What's going on in the Print_Quad_Chart_FY05 and NZ routines? These may be processor intensive and the DoEvents is not hit for a while after the Cancel button is clicked. You may want to put a DoEvents in one or both of these procedures as well. Give it a try and let us know if it works out. If it doesn't, we may need to see the code for these 2 procedures to determine a solution.


I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson
 
That did it..
I put some DoEvents between each major processing section in the procedure Print_Quad_Chart_FY05 and that lessed the amount of processing between when the cmdCancel_click event was triggered.. You can also see the button is depressed.

I also ended up having to disable all the other controls on the form since nasty things happened now that they can click on the other controls on the form..

Thanks Much...
Alley
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top