DblClick on FlexGrid sends a Click-Event to another Form

Originally Posted 20 June 2013, 10:34 am EST

  • Originally Posted 20 June 2013, 10:34 am EST

    Hi Forum!

    - sorry for my bad English -

    i'm using FlexGrid8L in Access 2010.
    In general all things work as they should. But there is one little crazy behavior:

    imagine an Access-Form with a Textbox on it. This Textbox stores e-mail-addresses and has one procedure:

    Private Sub txtEmail_Click()
    subEMail Nz(Me.txtEmail, "")
    End Sub


    if you click on the Textbox it opens an Outlook-NewMail-Object. All works great.

    now imagine further you got a 2nd Form. This 2nd form is a popup and can be opened from the 1st form. It contains my FlexGrid.
    The use of this 2nd form is to display some lines - get a DblClick on one line - returning the value and close the popup.
    The Code is simple:

    Private Sub MyFlexGrid_DblClick()
    ..do some sql stuff..
    DoCmd.Close acForm, Me.Name
    End Sub


    and now there comes the "error" when you do this:
    - open the 1st form, fill in an e-mail-address
    - open the 2nd form
    - move the 2nd form in a position that 1 line of the grid is at the same position as the E-Mail-Textbox of the 1st form (the gridline should "hover" over the Textbox)
    - perform a DblClick on that gridline

    At 1st the Sub MyFlexGrid_DblClick() will be executed. OK.. within this Sub the 2nd form is closed. And after this the Sub txtEmail_Click() is executed !!

    I've tried a lot of things and found 2 things out:
    1) it only happens when you use the VS FlexGrid! There is no other control that has this behavior
    2) when you fill in some extra code the error is "solved"

    Private Sub MyFlexGrid_DblClick()
    ..do some sql stuff..

    'extra super special code
    DoEvents
    apiSleep 100 ' an API-call that will do a break of 100 ms
    DoEvents

    DoCmd.Close acForm, Me.Name
    End Sub


    I have to use DoEvents 2 times! With only 1 DoEvents it won't work.

    Now can anyone explain this behavior?
    Maybe it's not a bug, it's a feature?!

    Greetings,
    Thomas
  • Reply

    HI,

    Can you provide me the build number you are using on your end, I am not able to recreate the same on my end, as you are. However if you can confirm the same and test it with the latest build

    http://prerelease.componentone.com/activex/C1FlexGrid/C1FlexGrid%208.0/2012-T2/vsflex8_8.0.20122.296.zip

    Regards,
  • Reply

    Hi,

    thank you for your help.

    I was using build 8.0.20121.295.
    So I copied the new version but it doesn't change. :(



    I've just created a new Access-DB and created 2 Forms as mentioned above. You can find my test-DB as attachment!


    Just start the program - the "Form1" will be displayed.
    Single-click on the textbox to get a MsgBox.

    When you now click the button "Form2" will open. Move the "Form2" in a position, that the gridline labeled with "dblclick me" is placed over the textbox of "Form1"

    Now dblclick it... "Form2" will close and you will get the MsgBox of "Form1"


    I've tested this little test.accdb on 3 different computers - 2 on Win7 64bit and an old one on WinXP. The same on all machines...


    I hope the problem is the same at your side now.
    (my Access version: 14.0.6129.5000 32Bit)

    Greetings
    Thomas
    2013/06/test1.zip
  • Reply

    HI,

    This seems to be happening only when you place the grid over the textbox.

    Due to dblclick event executed on grid, the underlying single click also gets executed, however on using the lines below

    DoEvents
    apiSleep 200
    DoEvents

    It seems the mouse click is passed on the underlying textbox as well. On using sleep, the routine pauses for the specified amount of time and then resumes execution.

    I'd escalate this to the concerned team and let you know on getting an update

    Regards,
  • Reply

    Hi,

    a fix would be nice to get my code clean of this Sleep- and DoEvents-commands.
    As I told you already I've tested it with some other controls. Simple controls like a Textbox or Combobox as well as other ActiveX-controls like the MS ListView (of mscomctl.ocx).

    No other control runs into the same error and executes the singleclick-event in "Form1". So this should not be an issue of Access itself, I think.


    Thanks for your help.
    Regards
  • Reply

    HI,

    As per the updates, It looks like this is a limitation of VBA. As I tested the same in VB 6.0 with a VSFlexGrid and TextBox and the event worked fine

    There are certain things in the control that work a little differently in VBA than they do in VB6.

    Unfortunately our controls are only intended (and tested) to work in VB6. There are some things going on behind the scenes in VBA that take time.

    Currently the workaround you are implementing on your end, would be the only way to avoid this.

    Thanks,
    ~Gatim
  • Reply

    Hi,

    I'm back with the same problem - but in another way. This time I have not found a work around.

    The situation:
    You have a Form1 with a FlexGrid on it. Fill the grid with at least 1 line.
    Your only code is the DblClick-Event like this:


    Private Sub MyFlexGrid_DblClick()
    'a MsgBox to recognize the error
    MsgBox "this is a test"
    'Open another form
    DoCmd.OpenForm "Form2"
    End Sub


    Now do a DblClick on the Grid. The MsgBox fires and the Form2 will open. Everything is OK.

    When the Form2 is now open (there is no need to fill this form with anything) just drag it to a side so you can see Form1 again. From2 needs to stay open. Now make a [u]Single[/u]Click directly on the Grid of Form1 (till now Form2 has the focus).

    As you will see the FlexGrid of Form1 will perform the DblClick-Event again! You just clicked once but it fires the DblClick. :(

    When you first close Form2 or you first set the focus to Form1 (by clicking in some free space of Form1) this error will not occur.
    Only a direct SingleClick from Form2 in the Grid of Form1 will result in this behavior.


    Is there a chance that your team take care of this problem and bring a fix? As written above, this time I haven't a workaround!
    I know you developed the controls for VB6 and not for VBA.. but maybe..?!


    Regards,
    Thomas
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels