Results 1 to 7 of 7

Thread: Event Sequence

  1. #1
    Guest

    Question

    Is there a way to prevent click events from initiating while a previous event is being processed?

    ie.
    I have a form with many command buttons, and when I click one of them, I want to ignore any other click on other objects until the routine from the first click terminates.

    It happens that I have a comm port trans, and the user clicks on objects while the system is handling an interrupt routine. I would like to be able to ignore new events, and perhaps inform the user that the system is busy.

    Please, any info?

    NV

  2. #2
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987

    DoEvents

    Add DoEvents as the first line in each click statement....
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

  3. #3
    Guest
    Thanks for the info,

    I will use DoEvent an other part of my program, but I don't think I explained my situation accurately.

    Sometimes when you have many buttons on a form and you press a bunch of them in sequence, you want to IGNORE the ones that were pressed. This prevents unintentional clicks when the system is busy.

    Hope you can help,

    NV

  4. #4
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    You could always disable the other buttons until the one running is completed.

    i.e.

    Code:
    Private Sub Command1_Click()
    
        Command2.Enabled = False
        Command3.Enabled = False
    
        '.......CODE HERE..........
    
        Command2.Enabled = True
        Command3.Enabled = True
    
    End Sub
    
    Private Sub Command2_Click()
    
        Command1.Enabled = False
        Command3.Enabled = False
    
        '.......CODE HERE..........
    
        Command1.Enabled = True
        Command3.Enabled = True
    
    End Sub
    
    'ETC
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

  5. #5
    Addicted Member
    Join Date
    Mar 2000
    Location
    Gainesville, FL
    Posts
    131
    a quick fix might be

    "form1.enabled = false"

  6. #6
    New Member
    Join Date
    Nov 2000
    Location
    Costa Rica
    Posts
    8

    Thumbs up

    why don't you try declaring a global Boolean}
    Variable and when you start the sub set it to False
    an d in the first line of the other subs
    put somthing like this

    'Global Variable Control
    Dim DoClik as Boolean

    If DoClik = False then Exit Sub

    'The rest of your Code...
    Zopailot

  7. #7
    New Member
    Join Date
    Nov 2000
    Location
    Costa Rica
    Posts
    8

    Talking Oops

    I Forgot when you Finish your Process
    Set the Variable to True!!
    Zopailot

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width