DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: Reappearing Form Problem ...

  1. #1
    Join Date
    Apr 2004
    Location
    Hawaii
    Posts
    220

    Question 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

  2. #2
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    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 .
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  3. #3
    Join Date
    Nov 2003
    Location
    Alameda, CA
    Posts
    1,737
    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
    "There are two ways to write error-free programs. Only the third one works."
    Unknown

  4. #4
    Join Date
    Apr 2004
    Location
    Hawaii
    Posts
    220
    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).
    Last edited by Shannon; 02-07-2007 at 03:27 PM. Reason: add additional info

  5. #5
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    "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].
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  6. #6
    Join Date
    Apr 2004
    Location
    Hawaii
    Posts
    220
    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

  7. #7
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    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.
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

Similar Threads

  1. Problem with creating Multiple instances of Form in VB!
    By vb_programmer in forum VB Classic
    Replies: 16
    Last Post: 06-23-2006, 08:10 AM
  2. Replies: 0
    Last Post: 02-23-2006, 08:08 PM
  3. order problem with web browser in form
    By Dralion in forum VB Classic
    Replies: 4
    Last Post: 02-15-2005, 02:27 PM
  4. Problem validating form NEED HELP
    By Steve in forum Web
    Replies: 1
    Last Post: 01-04-2002, 04:32 AM
  5. Re: Printing form Problem
    By Phil Weber in forum vb.announcements
    Replies: 0
    Last Post: 11-08-2000, 08:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center