+ Reply to Thread
Results 1 to 6 of 6

Problems with Exit event for Textbox

  1. #1
    Forum Contributor
    Join Date
    11-15-2012
    Location
    Buffalo, NY
    MS-Off Ver
    Office 365
    Posts
    319

    Problems with Exit event for Textbox

    I have a frame that allows me to select either All merchants for a report, or the Top n Merchants. The two option buttons work fine.

    I want to have the behavior be as follows:

    If I type a value into the text box associated with Top N (ie I am implicitly selecting that option), then I want that option to be selected.

    So, I put the following into the Exit event handler:
    Please Login or Register  to view this content.
    It doesn't work!
    When I simply tab out of the text field the event doesn't fire. If I tab back to the frame that contains the text box then it does fire (about 2 minutes and 20 tabs late!). Similarly, if I click on the field (after clicking elsewhere on the form), the event will fire. (This of course, is really an On Entry event!)

    I'm stumped about why this should (mis-)behave in this manner.

    Any ideas?

    Tony

  2. #2
    Valued Forum Contributor
    Join Date
    09-04-2012
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    463

    Re: Problems with Exit event for Textbox

    upload a sample file so that i can help you....
    Regards
    CA Mahaveer Somani

  3. #3
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Problems with Exit event for Textbox

    the control's direct parent is the frame not the form and so the exit event only fires when the next control within the frame is entered (or the frame itself). you need either another textbox in the frame (it can be extremely small and auto tab to another control) or to not locate the textbox within the frame itself. you could also use the enter event of the next control in the tab order
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  4. #4
    Forum Contributor
    Join Date
    11-15-2012
    Location
    Buffalo, NY
    MS-Off Ver
    Office 365
    Posts
    319

    Re: Problems with Exit event for Textbox

    Thanks Joseph

    I think that you've identified the problem. At any rate it is an (intellectually) satisfying answer. I've shifted the text box to the top of the tab order in the frame, so it may clear up some percentage of the problem.

    The MS documentation is delightfully (and typically) vague on this issue. At http://msdn.microsoft.com/en-us/libr...ice.10%29.aspx we read:
    Please Login or Register  to view this content.
    Nothing at all about frames, you note! However, if we regard a frame as a form then it makes some sort of sense. I am reminded of the early days of Windows when MS used to assert that every single visible artifact on the screen was in fact s separate window, and as such this was the basis for the plural in the Windows name. Seems like every collection of controls is a form.....

    At any rate, I'll explore Lost Focus and see if that helps!

    Thanks again for the succinct explanation,

    Tony

  5. #5
    Forum Contributor
    Join Date
    11-15-2012
    Location
    Buffalo, NY
    MS-Off Ver
    Office 365
    Posts
    319

    Re: Problems with Exit event for Textbox

    Just ran a quick test.

    1) Moving the textbox to the top of the tab order worked if I wanted to tab out of the box, however it resulted in a somewhat unsatisfactory user experience, because the cursor then wandered off into an unex[ected part of the form!

    2) After Update (no LostFocus on an Excel control :-( ) worked fine. When I select the Top N option I can now (after restoring the tab order) immediately go to the text field. No need to worry about whether the <end of control> processing works, because the option is set. However, if I mouse directly to the text box, the Afterpdate event ocurs even when the Exit event doesn't.

    Solution:

    Avoid Exit events in frames.

    Thanks for the pointer!

    Tony

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Problems with Exit event for Textbox

    you're welcome :-)

    please don't forget to mark the thread solved (click the 'thread tools' link at the top, then 'mark solved')

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1