Reappearing Form Problem ...
WinXP/VB6Pro. My app has a primary form that loads a second form for user interaction then makes itself invis until the user is done. When finished, the second form is unloaded, and the primary form is 'shown' again (it's never unloaded).
For some reason the hidden primary form is occasionally becoming visible behind the secondary form before my 'make vis' code is ever encountered and I can't figure out what has caused it. It's important because the user can shrink the secondary form, move it around, etc., to gain access to the desktop, and I don't want the primary form to be viewable at that stage.
If anyone has any suggestions on what could be causing this I would appreciate hearing about them. Thanks very much in advance.
Shannon
[809 byte] By [
Shannon] at [2007-11-11 10:20:32]

# 1 Re: Reappearing Form Problem ...
if I understand u, u need to make some form modal to another;
like "form2.show 1,form1"
otherwise if u just want to make form1 invis before showing form2, u may only need to change the code arrangment, I think u execute form2.show before form1.invisible and this must be reversed .
If this isn't what u want I'm sorry maybe I haven't good understood u so please explain more .
Amahdy at 2007-11-11 17:22:43 >

# 2 Re: Reappearing Form Problem ...
in effect it is hard to understand what is going on, the onlt info we have it that there is a "make vis" code but we do not know what it does, where it is and when it is called.
Usually:
me.hide
form2.show vbmodal
me.show
should be enough (hide me, show the next form modally and then show me again), because when form2 (thas is Modal) is visible, you get an error if you try to show form1
mstraf at 2007-11-11 17:23:53 >

# 3 Re: Reappearing Form Problem ...
Okay, let's say frmSetup is a setup screen for a game. Once you set up the game frmGameBoard is loaded and shown, where the game is actually played. Once the game is over, frmGameBoard is unloaded and you are returned to the sign up screen where you can begin another game or sign off.
While the user is viewing frmGameboard, I would like to allow them to view the desktop (if desired), minimize or move frmGameBoard around, etc., without being able to see frmSetup until the game is over.
I have simply made the frmSetup.Visible=False, which hides the form from view. This is great, and the way it is supposed to work, but ... every so often (and I have not been able to replicate it since the original post), frmSetup suddenly makes itself visible behind frmGameboard (without going through my coded process of intentionally making it visible). I only know this to have happened because I stumbled on to it when I minimized frmGameboard to look at my desktop and there it was, a visible frmSetup. This obviously violates my intentions and is the cause of this post.
So the question ... what rare occurrence could be causing this to occur without the code specifically requesting frmSetup to be made visible?
Hope that helps, and thanks for your time (both of you).
Shannon
PS: As you can see, making frmGameBoard modal will not solve the problem, since this will have no bearing on whether frmSetup is visible or not behind frmGameBoard. If the user moves or minimizes the modal frmGameboard, then frmSetup will still be visible (if it has come out of hiding on it's own).
# 4 Re: Reappearing Form Problem ...
"frmSetup.Hide";
a small suggestion:
make this;
-save settings [registry/file/static class ..]
-unload frmSetup
-frmGame.show()
this is better to free up your memory when playing your game, and ensure that there is no external access to your setup form from any type, also if u get any type of errors in your game it will not affect your setup and all thing will be saved [like continuing breaked game].
Amahdy at 2007-11-11 17:25:53 >

# 5 Re: Reappearing Form Problem ...
Thank you, Ahmady. I'm still having the problem with this reappearing form and can't for the life of me figure out why it is happening. I have only been able to replicate it once (today). The frmSetup doesn't reappear on top of the frmGameboard, it appears behind it out of view. Very strange, and very tough to repeat it with the app running.
I have ZERO experience with the Registry and am a little nervous about making my app dependent on registry settings, but that does sound like it would eliminate my problem.
I have tried making adjustments to Unload the frmSetup instead of hiding it while frmGameboard is in use (since I have a global array tracking my game data), but then ran into different problems in unloading the frmGameboard properly when done with it (see my other recent post). I've had problems making these two forms work in harmony for a long time and am growing very frustrated. Might be time to toss it all in the garbage.
Thanks for your advice, I'll look into that next.
Shannon
# 6 Re: Reappearing Form Problem ...
I think as said before your only problem is with the sequesnce used.. u have statments that should be before other statments and so on .
just for test u can make many tests like :
frmGame.windowstate = vbminimized
or
frmSetup.show 1,frmGame //this will obligate the user to press ok or any thing to continue to the frmGame and hide the frmSetup.
..
About the data, u may save it on files instead or just in static variable(s)/class ... variable(s) for example should be global in external module and unloading the frmSetup will not make u loose anything ...
of course savesettings in a static class will be better , and externally on the hard-drive [using files or registry] will be the best to save memory on paly-time as I think u will not need them on the play time , but if it contains data that's needed during playing so just save on static variable(s) it will be best in this case .
If the above fails, just send a snap of the code that makes the problem .
Amahdy.
Amahdy at 2007-11-11 17:27:53 >

