Exit frame on multipage event 
Author Message
 Exit frame on multipage event

Word 2K, Win 98

I have a bunch of controls in frames on pages of a MultiPage control. When
the user exits a frame, I want to check conditions of various controls, to
be sure that the responses are internally consistent. (If an option is
selected, some value is entered in a corresponding TextBox, and the like.)
When I had all this stuff on a plain UserForm, the Frame_Exit event worked
normally. But when I spread things around, the _Exit event doesn't fire on
switching to another page. Oddly enough, it fires when I click on the tab of
the page which I left, before actually returning to that page. It doesn't
fire while messing around on other pages.

I tried intercepting the MultiPage_Change event and redirecting the user
back to the offending frame, but that doesn't work very well. For one thing,
the routine doesn't know which page it came form, so I have to store that on
entry to a page. For another, it tries to display the page before my routine
runs, which makes the screen flash annoyingly when I send the user back to
the original page.

I've searched the archives and not found anything helpful on this. I can't
use the _Exit event of the last field, because the user can skip around and
may not leave in a nicely predictable Tab order. Does anyone have any ideas
on this?

--
Pete

This e-mail address is fake to keep spammers and their auto-harvesters out
of my hair. If you need to get in touch personally, I am 'pdanes' and I use
Yahoo mail. But please use the newsgroups whenever possible, so that all may
benefit from the exchange of ideas.



Sat, 30 Apr 2005 17:05:17 GMT  
 Exit frame on multipage event
Hi Peter,

As far as I know there is no _Exit() event (or any events for that matter
for Frames.

I think that you are going to have to come up with validation routines to be
run on exit from each of the relevant fields on each page.

Did you really get a Frame_Exit event working on a plain UserForm?

Please post any response to the newsgroups for the benefit of others who may
also be following the thread.

Hope this helps,
Doug Robbins - Word MVP

Quote:
> Word 2K, Win 98

> I have a bunch of controls in frames on pages of a MultiPage control. When
> the user exits a frame, I want to check conditions of various controls, to
> be sure that the responses are internally consistent. (If an option is
> selected, some value is entered in a corresponding TextBox, and the like.)
> When I had all this stuff on a plain UserForm, the Frame_Exit event worked
> normally. But when I spread things around, the _Exit event doesn't fire on
> switching to another page. Oddly enough, it fires when I click on the tab
of
> the page which I left, before actually returning to that page. It doesn't
> fire while messing around on other pages.

> I tried intercepting the MultiPage_Change event and redirecting the user
> back to the offending frame, but that doesn't work very well. For one
thing,
> the routine doesn't know which page it came form, so I have to store that
on
> entry to a page. For another, it tries to display the page before my
routine
> runs, which makes the screen flash annoyingly when I send the user back to
> the original page.

> I've searched the archives and not found anything helpful on this. I can't
> use the _Exit event of the last field, because the user can skip around
and
> may not leave in a nicely predictable Tab order. Does anyone have any
ideas
> on this?

> --
> Pete

> This e-mail address is fake to keep spammers and their auto-harvesters out
> of my hair. If you need to get in touch personally, I am 'pdanes' and I
use
> Yahoo mail. But please use the newsgroups whenever possible, so that all
may
> benefit from the exchange of ideas.



Sat, 30 Apr 2005 17:43:29 GMT  
 Exit frame on multipage event
Hi Doug,

Quote:
> As far as I know there is no _Exit() event (or any events for that matter
> for Frames.

Beg to differ. I'm always a little leery when someone with more experience
than me tells me I'm full of it, but this time I have to stick by my guns.
It'e very simple to try - create a UserForm and put a Frame on it and any
active control on the UserForm but not in the Frame, then put in this code:

Private Sub Frame1_Click()
MsgBox "In frame"
End Sub

Private Sub Frame1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
MsgBox "Out of frame"
End Sub

Run it and click in the Frame and then on the outside control, and you'll
see that the Exit event fires just fine. And if you look at the drop-down
boxes in the editor, you'll see many different events available for a Frame.
I haven't tried them all, but at least some of them do work.

Quote:
> I think that you are going to have to come up with validation routines to
be
> run on exit from each of the relevant fields on each page.

That's certainly a solution that suggests itself, but it's not that simple
here. Each Frame has a set of controls that are closely interrelated, and
the conditions on leaving a particular control may not be correct, because
the user has not finished with everything in that Frame. They don't have to
do things in any particular order, so I can't check when they exit the
'last' field - there isn't one.

For example, clicking an OptionButton causes several TextBoxes to become
enabled and some others to become disabled. A simple scenario that can
easily occur is that the user clicks such a button, fills out the
appropriate TextBoxes including the 'last' one, changes his mind, clicks a
different OptionButton, then realizes that he made a mistake and the first
OptionButton was the correct choice after all. He will then re-click the
first OptionButton, but since the TextBoxes are already filled out (I don't
clear them, because there is no point in forcing the user to enter data
twice, they're only disabled and grayed), there is no need for him to do
anything else. At that point he would just leave the Frame to work on some
other part of the UserForm. So there are two different, perfectly legitimate
situations where two different controls are the 'last' ones touched, but in
either case, I can't jump on the user for not having the stuff in that Frame
filled out correctly when he Exits that control, because he may simply be
moving to a different control in the Frame.

A simpler and much more likely situation is that he can get to the 'last'
box, realize he made a mistake earlier in the Frame, go back to correct it
and then want to leave directly from there.

I need to know when he leaves the Frame entirely, from whatever point, and
check everything in the Frame at that time, to make sure that whatever
choices he did make are internally consistent.

Quote:
> Did you really get a Frame_Exit event working on a plain UserForm?

Absolutely, and it functioned perfectly, except that the Frame_Exit event
fired before the TextBox_Exit, in a few cases where I did want to check the
contents of an individual TextBox. Seems pretty back-asswards to me - how
can you possibly leave a Frame without first having left the TextBox
enclosed in the Frame? But I got around that by putting all the validation
code in the Frame_Exit event. It wasn't as elegant as I wanted, but it
worked. But the UserForm got too busy, so I split the controls up onto
separate pages of a MultiPage control. Now the Frame_Exit event doesn't work
properly. It fires okay when I go to a different control on the same page,
even if it's in another Frame, but not when I leave the page altogether. If
I can't get this working somehow, I'll have no choice but to do a mass
validation routine at the end, when the user is (supposedly) finished. It
will then have to list all his crimes and he will have to go back and find
them himself, one at a time, instead of being alerted to them immediately.
It will work, but with all the event-driven routines available in VBA, a
much more elegant functionality should be possible. The problem seems to be
(as usual) that this stuff doesn't work correctly, or sometimes at all.

--
Pete

This e-mail address is fake to keep spammers and their auto-harvesters out
of my hair. If you need to get in touch personally, I am 'pdanes' and I use
Yahoo mail. But please use the newsgroups whenever possible, so that all may
benefit from the exchange of ideas.



Quote:
> Hi Peter,

> As far as I know there is no _Exit() event (or any events for that matter
> for Frames.

> I think that you are going to have to come up with validation routines to
be
> run on exit from each of the relevant fields on each page.

> Did you really get a Frame_Exit event working on a plain UserForm?

> Please post any response to the newsgroups for the benefit of others who
may
> also be following the thread.

> Hope this helps,
> Doug Robbins - Word MVP


> > Word 2K, Win 98

> > I have a bunch of controls in frames on pages of a MultiPage control.
When
> > the user exits a frame, I want to check conditions of various controls,
to
> > be sure that the responses are internally consistent. (If an option is
> > selected, some value is entered in a corresponding TextBox, and the
like.)
> > When I had all this stuff on a plain UserForm, the Frame_Exit event
worked
> > normally. But when I spread things around, the _Exit event doesn't fire
on
> > switching to another page. Oddly enough, it fires when I click on the
tab
> of
> > the page which I left, before actually returning to that page. It
doesn't
> > fire while messing around on other pages.

> > I tried intercepting the MultiPage_Change event and redirecting the user
> > back to the offending frame, but that doesn't work very well. For one
> thing,
> > the routine doesn't know which page it came form, so I have to store
that
> on
> > entry to a page. For another, it tries to display the page before my
> routine
> > runs, which makes the screen flash annoyingly when I send the user back
to
> > the original page.

> > I've searched the archives and not found anything helpful on this. I
can't
> > use the _Exit event of the last field, because the user can skip around
> and
> > may not leave in a nicely predictable Tab order. Does anyone have any
> ideas
> > on this?

> > --
> > Pete

> > This e-mail address is fake to keep spammers and their auto-harvesters
out
> > of my hair. If you need to get in touch personally, I am 'pdanes' and I
> use
> > Yahoo mail. But please use the newsgroups whenever possible, so that all
> may
> > benefit from the exchange of ideas.



Sun, 01 May 2005 05:42:52 GMT  
 Exit frame on multipage event
Sorry Peter,

I stand corrected on that one.  I don't know what has happened between last
night and to night, but last night, I put a Frame on a form and the editor
definitely did not show any events for it.  Not to be stopped by that, I
made one up, but it didn't work.  Tonight of course everything is different,
and just as you say.

I'll have more of a think about this and get back to you if I come up with
anything

Please post any response to the newsgroups for the benefit of others who may
also be following the thread.

Regards,
Doug Robbins - Word MVP

Quote:
> Hi Doug,

> > As far as I know there is no _Exit() event (or any events for that
matter
> > for Frames.

> Beg to differ. I'm always a little leery when someone with more experience
> than me tells me I'm full of it, but this time I have to stick by my guns.
> It'e very simple to try - create a UserForm and put a Frame on it and any
> active control on the UserForm but not in the Frame, then put in this
code:

> Private Sub Frame1_Click()
> MsgBox "In frame"
> End Sub

> Private Sub Frame1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
> MsgBox "Out of frame"
> End Sub

> Run it and click in the Frame and then on the outside control, and you'll
> see that the Exit event fires just fine. And if you look at the drop-down
> boxes in the editor, you'll see many different events available for a
Frame.
> I haven't tried them all, but at least some of them do work.

> > I think that you are going to have to come up with validation routines
to
> be
> > run on exit from each of the relevant fields on each page.

> That's certainly a solution that suggests itself, but it's not that simple
> here. Each Frame has a set of controls that are closely interrelated, and
> the conditions on leaving a particular control may not be correct, because
> the user has not finished with everything in that Frame. They don't have
to
> do things in any particular order, so I can't check when they exit the
> 'last' field - there isn't one.

> For example, clicking an OptionButton causes several TextBoxes to become
> enabled and some others to become disabled. A simple scenario that can
> easily occur is that the user clicks such a button, fills out the
> appropriate TextBoxes including the 'last' one, changes his mind, clicks a
> different OptionButton, then realizes that he made a mistake and the first
> OptionButton was the correct choice after all. He will then re-click the
> first OptionButton, but since the TextBoxes are already filled out (I
don't
> clear them, because there is no point in forcing the user to enter data
> twice, they're only disabled and grayed), there is no need for him to do
> anything else. At that point he would just leave the Frame to work on some
> other part of the UserForm. So there are two different, perfectly
legitimate
> situations where two different controls are the 'last' ones touched, but
in
> either case, I can't jump on the user for not having the stuff in that
Frame
> filled out correctly when he Exits that control, because he may simply be
> moving to a different control in the Frame.

> A simpler and much more likely situation is that he can get to the 'last'
> box, realize he made a mistake earlier in the Frame, go back to correct it
> and then want to leave directly from there.

> I need to know when he leaves the Frame entirely, from whatever point, and
> check everything in the Frame at that time, to make sure that whatever
> choices he did make are internally consistent.

> > Did you really get a Frame_Exit event working on a plain UserForm?

> Absolutely, and it functioned perfectly, except that the Frame_Exit event
> fired before the TextBox_Exit, in a few cases where I did want to check
the
> contents of an individual TextBox. Seems pretty back-asswards to me - how
> can you possibly leave a Frame without first having left the TextBox
> enclosed in the Frame? But I got around that by putting all the validation
> code in the Frame_Exit event. It wasn't as elegant as I wanted, but it
> worked. But the UserForm got too busy, so I split the controls up onto
> separate pages of a MultiPage control. Now the Frame_Exit event doesn't
work
> properly. It fires okay when I go to a different control on the same page,
> even if it's in another Frame, but not when I leave the page altogether.
If
> I can't get this working somehow, I'll have no choice but to do a mass
> validation routine at the end, when the user is (supposedly) finished. It
> will then have to list all his crimes and he will have to go back and find
> them himself, one at a time, instead of being alerted to them immediately.
> It will work, but with all the event-driven routines available in VBA, a
> much more elegant functionality should be possible. The problem seems to
be
> (as usual) that this stuff doesn't work correctly, or sometimes at all.

> --
> Pete

> This e-mail address is fake to keep spammers and their auto-harvesters out
> of my hair. If you need to get in touch personally, I am 'pdanes' and I
use
> Yahoo mail. But please use the newsgroups whenever possible, so that all
may
> benefit from the exchange of ideas.



> > Hi Peter,

> > As far as I know there is no _Exit() event (or any events for that
matter
> > for Frames.

> > I think that you are going to have to come up with validation routines
to
> be
> > run on exit from each of the relevant fields on each page.

> > Did you really get a Frame_Exit event working on a plain UserForm?

> > Please post any response to the newsgroups for the benefit of others who
> may
> > also be following the thread.

> > Hope this helps,
> > Doug Robbins - Word MVP


> > > Word 2K, Win 98

> > > I have a bunch of controls in frames on pages of a MultiPage control.
> When
> > > the user exits a frame, I want to check conditions of various
controls,
> to
> > > be sure that the responses are internally consistent. (If an option is
> > > selected, some value is entered in a corresponding TextBox, and the
> like.)
> > > When I had all this stuff on a plain UserForm, the Frame_Exit event
> worked
> > > normally. But when I spread things around, the _Exit event doesn't
fire
> on
> > > switching to another page. Oddly enough, it fires when I click on the
> tab
> > of
> > > the page which I left, before actually returning to that page. It
> doesn't
> > > fire while messing around on other pages.

> > > I tried intercepting the MultiPage_Change event and redirecting the
user
> > > back to the offending frame, but that doesn't work very well. For one
> > thing,
> > > the routine doesn't know which page it came form, so I have to store
> that
> > on
> > > entry to a page. For another, it tries to display the page before my
> > routine
> > > runs, which makes the screen flash annoyingly when I send the user
back
> to
> > > the original page.

> > > I've searched the archives and not found anything helpful on this. I
> can't
> > > use the _Exit event of the last field, because the user can skip
around
> > and
> > > may not leave in a nicely predictable Tab order. Does anyone have any
> > ideas
> > > on this?

> > > --
> > > Pete

> > > This e-mail address is fake to keep spammers and their auto-harvesters
> out
> > > of my hair. If you need to get in touch personally, I am 'pdanes' and
I
> > use
> > > Yahoo mail. But please use the newsgroups whenever possible, so that
all
> > may
> > > benefit from the exchange of ideas.



Sun, 01 May 2005 20:05:53 GMT  
 Exit frame on multipage event
Hi Doug,

what I've done is give up on the Frame stuff and just do a mass once-over at
the end. After thinking about it a bit, I realized that I need to do that
anyway, since there is no guarantee that the user would ever enter a
particular Frame. I could get an incomplete set of data from a Frame just by
virtue of the user never touching anything in it, and so never getting
stopped by tests in the _Exit routine. And the user may wish to do part of a
Frame, switch out to look at something else, then switch back in to finish,
so refusing to let him out may not be a good idea after all.

So once again, I've solved a problem by deciding that it really isn't one.
Still annoying when stuff doesn't work right, though.

Thanks for your time.

--
Pete

This e-mail address is fake to keep spammers and their auto-harvesters out
of my hair. If you need to get in touch personally, I am 'pdanes' and I use
Yahoo mail. But please use the newsgroups whenever possible, so that all may
benefit from the exchange of ideas.



Quote:
> Sorry Peter,

> I stand corrected on that one.  I don't know what has happened between
last
> night and to night, but last night, I put a Frame on a form and the editor
> definitely did not show any events for it.  Not to be stopped by that, I
> made one up, but it didn't work.  Tonight of course everything is
different,
> and just as you say.

> I'll have more of a think about this and get back to you if I come up with
> anything

> Please post any response to the newsgroups for the benefit of others who
may
> also be following the thread.

> Regards,
> Doug Robbins - Word MVP


> > Hi Doug,

> > > As far as I know there is no _Exit() event (or any events for that
> matter
> > > for Frames.

> > Beg to differ. I'm always a little leery when someone with more
experience
> > than me tells me I'm full of it, but this time I have to stick by my
guns.
> > It'e very simple to try - create a UserForm and put a Frame on it and
any
> > active control on the UserForm but not in the Frame, then put in this
> code:

> > Private Sub Frame1_Click()
> > MsgBox "In frame"
> > End Sub

> > Private Sub Frame1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
> > MsgBox "Out of frame"
> > End Sub

> > Run it and click in the Frame and then on the outside control, and
you'll
> > see that the Exit event fires just fine. And if you look at the
drop-down
> > boxes in the editor, you'll see many different events available for a
> Frame.
> > I haven't tried them all, but at least some of them do work.

> > > I think that you are going to have to come up with validation routines
> to
> > be
> > > run on exit from each of the relevant fields on each page.

> > That's certainly a solution that suggests itself, but it's not that
simple
> > here. Each Frame has a set of controls that are closely interrelated,
and
> > the conditions on leaving a particular control may not be correct,
because
> > the user has not finished with everything in that Frame. They don't have
> to
> > do things in any particular order, so I can't check when they exit the
> > 'last' field - there isn't one.

> > For example, clicking an OptionButton causes several TextBoxes to become
> > enabled and some others to become disabled. A simple scenario that can
> > easily occur is that the user clicks such a button, fills out the
> > appropriate TextBoxes including the 'last' one, changes his mind, clicks
a
> > different OptionButton, then realizes that he made a mistake and the
first
> > OptionButton was the correct choice after all. He will then re-click the
> > first OptionButton, but since the TextBoxes are already filled out (I
> don't
> > clear them, because there is no point in forcing the user to enter data
> > twice, they're only disabled and grayed), there is no need for him to do
> > anything else. At that point he would just leave the Frame to work on
some
> > other part of the UserForm. So there are two different, perfectly
> legitimate
> > situations where two different controls are the 'last' ones touched, but
> in
> > either case, I can't jump on the user for not having the stuff in that
> Frame
> > filled out correctly when he Exits that control, because he may simply
be
> > moving to a different control in the Frame.

> > A simpler and much more likely situation is that he can get to the
'last'
> > box, realize he made a mistake earlier in the Frame, go back to correct
it
> > and then want to leave directly from there.

> > I need to know when he leaves the Frame entirely, from whatever point,
and
> > check everything in the Frame at that time, to make sure that whatever
> > choices he did make are internally consistent.

> > > Did you really get a Frame_Exit event working on a plain UserForm?

> > Absolutely, and it functioned perfectly, except that the Frame_Exit
event
> > fired before the TextBox_Exit, in a few cases where I did want to check
> the
> > contents of an individual TextBox. Seems pretty back-asswards to me -
how
> > can you possibly leave a Frame without first having left the TextBox
> > enclosed in the Frame? But I got around that by putting all the
validation
> > code in the Frame_Exit event. It wasn't as elegant as I wanted, but it
> > worked. But the UserForm got too busy, so I split the controls up onto
> > separate pages of a MultiPage control. Now the Frame_Exit event doesn't
> work
> > properly. It fires okay when I go to a different control on the same
page,
> > even if it's in another Frame, but not when I leave the page altogether.
> If
> > I can't get this working somehow, I'll have no choice but to do a mass
> > validation routine at the end, when the user is (supposedly) finished.
It
> > will then have to list all his crimes and he will have to go back and
find
> > them himself, one at a time, instead of being alerted to them
immediately.
> > It will work, but with all the event-driven routines available in VBA, a
> > much more elegant functionality should be possible. The problem seems to
> be
> > (as usual) that this stuff doesn't work correctly, or sometimes at all.

> > --
> > Pete

> > This e-mail address is fake to keep spammers and their auto-harvesters
out
> > of my hair. If you need to get in touch personally, I am 'pdanes' and I
> use
> > Yahoo mail. But please use the newsgroups whenever possible, so that all
> may
> > benefit from the exchange of ideas.



> > > Hi Peter,

> > > As far as I know there is no _Exit() event (or any events for that
> matter
> > > for Frames.

> > > I think that you are going to have to come up with validation routines
> to
> > be
> > > run on exit from each of the relevant fields on each page.

> > > Did you really get a Frame_Exit event working on a plain UserForm?

> > > Please post any response to the newsgroups for the benefit of others
who
> > may
> > > also be following the thread.

> > > Hope this helps,
> > > Doug Robbins - Word MVP


> > > > Word 2K, Win 98

> > > > I have a bunch of controls in frames on pages of a MultiPage
control.
> > When
> > > > the user exits a frame, I want to check conditions of various
> controls,
> > to
> > > > be sure that the responses are internally consistent. (If an option
is
> > > > selected, some value is entered in a corresponding TextBox, and the
> > like.)
> > > > When I had all this stuff on a plain UserForm, the Frame_Exit event
> > worked
> > > > normally. But when I spread things around, the _Exit event doesn't
> fire
> > on
> > > > switching to another page. Oddly enough, it fires when I click on
the
> > tab
> > > of
> > > > the page which I left, before actually returning to that page. It
> > doesn't
> > > > fire while messing around on other pages.

> > > > I tried intercepting the MultiPage_Change event and redirecting the
> user
> > > > back to the offending frame, but that doesn't work very well. For
one
> > > thing,
> > > > the routine doesn't know which page it came form, so I have to store
> > that
> > > on
> > > > entry to a page. For another, it tries to display the page before my
> > > routine
> > > > runs, which makes the screen flash annoyingly when I send the user
> back
> > to
> > > > the original page.

> > > > I've searched the archives and not found anything helpful on this. I
> > can't
> > > > use the _Exit event of the last field, because the user can skip
> around
> > > and
> > > > may not leave in a nicely predictable Tab order. Does anyone have
any
> > > ideas
> > > > on this?

> > > > --
> > > > Pete

> > > > This e-mail address is fake to keep spammers and their
auto-harvesters
> > out
> > > > of my hair. If you need to get in touch personally, I am 'pdanes'
and
> I
> > > use
> > > > Yahoo mail. But please use the newsgroups whenever possible, so that
> all
> > > may
> > > > benefit from the exchange of ideas.



Mon, 02 May 2005 09:44:11 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Controls in Frames or Multipage

2. Frames: Responding to an event after a frame loads

3. object created in workbook_open event handler disappears on exit from the event handler

4. Multipage form events

5. Implementing Multipage MouseMove Event

6. Exiting from frames on response.redirect

7. How can I catch Multipage Click event ?

8. Chosing Frame content in a 2 framed page from a 1 framed page

9. Exit Access Event

10. How to catch exit event?

11. Capture the Exit event

12. catching exit/enter events of msform control in custom class

 

 
Powered by phpBB® Forum Software