By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,087 Members | 1,513 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,087 IT Pros & Developers. It's quick & easy.

How to set level/depth/Z-value of non-modal popup forms?

P: n/a
I have a need to arrange the relative depth of several non-modal popup
forms. Specifically, I need to make sure one particular form is
always at the back of the others. That is, if a user happens to click
on the "background" form (which would normally bring that form to the
front), I want to execute code that would immediately send that form
to the "back-most" position.

I believe that, in general, in working with layered windows in any
system, the property I am speaking of is called something like the "Z-
value," but I do not know how to reference it in Access forms or
whether it can be set programmatically via Windows API or some other
means.

I know that it is easy to accomplish this if only two forms are
involved, by setting focus to the form-that-needs-to-be-on-top
whenever the form-that-needs-to-be-on-the-bottom is clicked. In this
particular app I will have many forms displayed at once, and setting
focus to a single form means that ONLY that form will then be in front
of the background form.

I also know that if the background form were not set to "popup" this
would not be a problem, but I need it to be popup so that I can
maximize it to take over the entire screen, hiding all the Access
menus and toolbars.

Thanks!

Aug 5 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
if the only thing you're using that form for is to "hide" the Access window
menu bar(s) and toolbar(s), it might be easier to just get rid of them
entirely.

hth
<ks***@yahoo.comwrote in message
news:11**********************@i13g2000prf.googlegr oups.com...
I have a need to arrange the relative depth of several non-modal popup
forms. Specifically, I need to make sure one particular form is
always at the back of the others. That is, if a user happens to click
on the "background" form (which would normally bring that form to the
front), I want to execute code that would immediately send that form
to the "back-most" position.

I believe that, in general, in working with layered windows in any
system, the property I am speaking of is called something like the "Z-
value," but I do not know how to reference it in Access forms or
whether it can be set programmatically via Windows API or some other
means.

I know that it is easy to accomplish this if only two forms are
involved, by setting focus to the form-that-needs-to-be-on-top
whenever the form-that-needs-to-be-on-the-bottom is clicked. In this
particular app I will have many forms displayed at once, and setting
focus to a single form means that ONLY that form will then be in front
of the background form.

I also know that if the background form were not set to "popup" this
would not be a problem, but I need it to be popup so that I can
maximize it to take over the entire screen, hiding all the Access
menus and toolbars.

Thanks!

Aug 5 '07 #2

P: n/a
On Aug 5, 9:23 pm, "tina" <nos...@address.comwrote:
hmm, okay. you might try adding code to the "background" form's Activate
event procedure, to select another open form, using DoCmd.SelectObject. if
there's one that's always open, just select that form. if not, you can loop
through the forms collection, checking for open forms, and select the first
form that *is* open (other than the background form, of course).
I have tried something similar to this, setting focus to a known open
form, but that leaves only that single form exposed in front of the
background. Any other open forms remain behind the background. I
knew that one solution would be to loop through the forms, detecting
the open ones, and setting focus (or, as you suggest, SelectObject) to
each form in turn, which would place them all in front of the
background -- and this may well be the approach I am forced to take.

I was only hoping there was a far simpler and faster way of just
moving the background back where it belongs, which would have the
added benefit of leaving all the forms untouched and in their existing
orientation. (That is, if the user had arranged them in some
overlapping pattern, their relative depths would remain unchanged.)

Aug 6 '07 #3

P: n/a
tina,

It took a little digging (er, googling), but the call to SetWindowPos
(using hWndInsertAfter equal to constant HWND_BOTTOM and FLAG equal to
SWP_NOACTIVATE) did the trick. Works great! Exactly what I was
hoping for -- and more. SetWindowPos is a very useful API call to
know about and I am sure I will find other uses for it as well.

SetWindowPos is described here:

http://msdn2.microsoft.com/en-us/library/ms633545.aspx

Thanks so much!

Aug 6 '07 #4

P: n/a
oh, cool, i'm glad Tom's post was able to help you out! and you're very
welcome :)
<ks***@yahoo.comwrote in message
news:11**********************@e16g2000pri.googlegr oups.com...
tina,

It took a little digging (er, googling), but the call to SetWindowPos
(using hWndInsertAfter equal to constant HWND_BOTTOM and FLAG equal to
SWP_NOACTIVATE) did the trick. Works great! Exactly what I was
hoping for -- and more. SetWindowPos is a very useful API call to
know about and I am sure I will find other uses for it as well.

SetWindowPos is described here:

http://msdn2.microsoft.com/en-us/library/ms633545.aspx

Thanks so much!

Aug 7 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.