Interface form min and max help

oxicottin

Learning by pecking away....
Local time
Today, 09:33
Joined
Jun 26, 2007
Messages
889
Hello, I have a database that I’m having trouble with. If I open a form from the side menu by clicking the windows button on the left bottom and selecting a form then (With form still open) minimize the database using the green arrow everything minimizes fine but, when I maximize it from the taskbar my form is hidden behind my interface instead of being in front like it was before I minimized it. Is there a way I can fix this? Thanks!
 
Last edited:
Oxi,

Nice little problem.

You need to know what form you want displayed when maximized.

You need to know if the app is minimized (So your Timer event doesn't try
to bring up the appropriate form.

1) Add Invisible Textbox to your BackGround form.
Name = txtFormName
DefaultValue = "BackGround"
Change it for each --> DoCmd.OpenForm as you launch the forms.

2) Add Invisible Textbox to your BackGround form
Name = txtAppMode
DefaultValue = "Max"
Set to "Min" on your form's "Green Minimize arrow"
Your Timer event will use this value to see if it needs to act.

3) In your timer procedure

This link shows how to get the app's state; min, max

http://support.microsoft.com/kb/210118

You need this so that when minimized, your Timer event doesn't try to do anything.

If maximized (and txtAppMode = "Min") then set focus to the form in txtFormName

Note: In this last step, I think you should also do a DoCmd.Restore (???)

hth,
Wayne
 
Wayne, thanks for the help! Im pretty new to access so Im sorry but Im stuck in your instructions "Change it for each --> DoCmd.OpenForm as you launch the forms" and "Set to "Min" on your form's "Green Minimize arrow". It took me forever to do what I have done already in the database so please bear with me... When I press a button in the menu to open a form I set focus to a invisable button already "Named cmdHiddenTransparentButton" and im already using my Timer event so im confused on what to do to get this working? Thanks!!!
 
oxi,

You do have a timer event already for updating your clock.

It can also do the following:

1) If Access Is mimimized, do nothing at all.

2)If Access is maximized and its last known state was minimized,
then we need to set focus to the last known form in use.
Then set state to maximized.

3) Then update your clock.

Questions
=========

How to tell application state?
Microsoft link has the code for this.

What was the last form in use?
Everyplace in your code where you have a --> DoCmd.OpenForm ...
save that form's name for your timer routine.

What was the last application state?
When you do the --> DoCmd.Minimize (Can't remember the syntax)
set the value to "Minimized". That way you'll know the user
minimized the application.

Wayne
 
Ok Wayne, I created two txt boxes and made the visable "no" and named them as follows.

txtFormName
Set the default value to "background" (With "")

txtAppMode
Set the default value to "Max" (With "")

then I made a module named MinMaxRestoreModule wich I just copy and pasted the code from the link you gave me.

Now im lost when you say save the timer routine and also the DoCmd.Minimize set the value to "Minimized".

I have included what I have done so far so you can see if im correct so far...Thanks!
 
Last edited:
Oxi,

Just checked in today.

I tested out the MS API call. It can detect that the app is maximized.

Give me a few minutes to try out the rest of the stuff.

Wayne
 
Oxi,

The only trouble I'm having is with the MS API call.

If I can "fake" its value (to max), things work OK.

Look for "EDIT" on the code page of the Background form.

I'll reattach your DB.

Meanwhile I'll research the API call. We need this to work.

I also set the timerinterval up to 10 seconds to buy a little time.

Wayne
 

Attachments

Oxi,

Wow, weird timing issues!

At least I learned that the Access Timer Event doesn't fire (or even count)
until you click on the "Maxed" Access window.

It does however work. I gotta try it at full speed with your timer back at
1 second.

oops, gotta go.

Wayne
 
Wayne I would have never got that!! I see what you changed in the code 'Edit and 'Stop and I see why you left the txt boxes visible. If I open a form it shows in the top txt box and when I min and then max it show the form I had open but the form is behind the background form. Is the module not working right? Is that what you mean by API? Im kinda getting what all this does so far but still confused. I will keep looking at the changes you made and try to see what does what. I did get a windows error after opening it a few times though. Dont know what that was about.... I will keep looking at it while you are looking into the API. Thanks a million!!!
 
Oxi,

I'm back.

Three people in the house and only two computers ... poor me.

I made new textboxes because you must have cut and pasted the
names for your original ones ... they had a carriage return/line feed at
the end of their names.

I just made them visible for testing purposes.

I set the timer interval back to one-second and the thing actually works.

On the code for your minimize "Green Arrow" I set the TimerInterval down to
200 so that when you maximize later, it will react quicker. The OnTimer
event sets it back to 1000.

It's kind of tough to deal with this app. The timer always introduces
its own wrinkles, but if you open something like the Personnel form,
then click off of it, you've lost it forever. Can't get it back!

Anyway, I hope I got you started on this.

Let me know of your progress.

See ya,
Wayne
 
Ok Wayne, I made new txt boxes and named them the same ect. Then I set the background timer interval to 1000 and in the timer code I set it back to 1000 but I dont understand what you mean by the "On the code for your minimize "Green Arrow" I set the TimerInterval down to 200 so that when you maximize later, it will react quicker" I looked at the on click event and saw what you did but I dont see anything that has to do with changing the time to 200? Also After changing what I mentioned above its not working. It still acts the same as before? Thanks!
 
I figured out why the form wasnt opening again. The Case"" I didnt seet that I had to put the forms name in the rest of the spots but I still dont know what you mean by "On the code for your minimize "Green Arrow" I set the TimerInterval down to 200 so that when you maximize later, it will react quicker." It works for me now to...
 
Oxi,

Sorry, I changed it AFTER I posted the database.

All I did was put:

Me.TimerInterval = 200

in the OnClick event of your "green arrow".

Then I had the Timer event set it back to 1000

Me.TimerInterval = 1000

AND obviously I didn't put the other form names in the Case statement.
I need to take some shortcuts.

I think that your timer event could also see if any forms (other than Background)
were loaded. They'd probably be the orphans I mentioned earlier an it
could reset the focus back to them.

Wayne
 
Wayne, I really, really appreciate the help! I have found an error though. If you open a form and then close the form then minimize the app then open it back up it givs you an error that it cant find a form. The form its talking about is the form that you opened and closed prior to minimizing the app. Am I missing something? I added finished app as attachment....
 
Last edited:
Oxi,

To make it really bulletproof, you'd have to go to the OnClose event for each
form that you open. When they close set txtFormName back to Background.

OR, you could just trap the error in your Timer event code and if there is a
form not found error, just set focus to the Background form.

Wayne
 
Wayne, what code would I use to set txtFormName back to Background on a forms On Close event? Thanks!
 
Wayne thanks again!! I’m so happy I could cry....Finally this interface thing is done and works! Thanks a million your a great asset to the forum communities....
 

Users who are viewing this thread

Back
Top Bottom