Results 1 to 18 of 18

Thread: Need code for fading in popup boxes ..

  1. #1

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    Question Need code for fading in popup boxes ..

    Does anyone have access to code or know of an API I can use to make my popup boxes 'fade-in', or basically do anything apart from just suddenly appear when a button is clicked ?

    Just trying to jazz things up a bit !


    Cheers.

  2. #2
    Fanatic Member InvisibleDuncan's Avatar
    Join Date
    May 2001
    Location
    Eating jam.
    Posts
    819
    This is a bit different...

    (If by pop-up boxes you mean Forms. If you mean message boxes, well, this isn't what you want )
    Attached Files Attached Files
    Indecisiveness is the key to flexibility.

    www.mangojacks.com

  3. #3

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    Nice effect ...

    Thats just the sort of thing I was looking for !!

    Unfortunately, when I click the button that opens my form (yes, sorry it was forms I was referring to !), it 'explodes' a white box almost the size of my screen !!

    I looked at the code in the module that does the 'exploding', but don't have enough experience to know what, if anything, I need to change.

    Any ideas ?

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    BionicOrange:

    I tried InvisibleDuncans form (very cool!), and it worked just dandy on my machine.

    I added a second form to the project, and loaded his form from it, and it still worked fine.

    I'm thinking that perhaps there might be a monitor, or screen resolution difference going on here.

  5. #5

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    Hmmmm .........

    Maybe you're right.

    I'm using 1024 x 768 resolution.

    also, the form that contains the button (which opens the exploding form) is an MDI child. Don't know if this has an impact !

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    I don't know about the MDI thing. Could be. It would be interesting if you could run his forms on another machine with a different resolution to see what would happen.

  7. #7

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    Doh !

    When I first ran the sample code, it worked fine.

    When I ran it in my app., it didn't.

    Both times I was in the same resolution !!!!! (1024 x 768)

    I tried the sample code in 800 x 600 and it worked fine in that too.

    Fuess that rules out resolution problems.

  8. #8
    Fanatic Member InvisibleDuncan's Avatar
    Join Date
    May 2001
    Location
    Eating jam.
    Posts
    819
    The code uses the GetWindowRect API to find out the size of the form you're building. It then creates a brush, and uses that to build a series of rectangles based on the number you specified when you called the procedure (in my example I've used 2,500 - so it draws 2,500 rectangles, starting at 1/2,500 the size of your form up to the size of your form).

    As far as I can see, having it as an MDI child shouldn't make a difference. I've tested it on an MDI child, and it still seems to work the same.

    Sorry...
    Indecisiveness is the key to flexibility.

    www.mangojacks.com

  9. #9

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    .

    Due to teh nature of my program, I can't put the 'SubExplodeForm Me, 2500' line in the form load, but need to put it in the form refresh.

    This seems to cause a problem as the form is drawn, then the 'explode' effect happens, then I lose my form title bar (it stays white) and teh edge of my listview box on the form !

    I presume this is a timing issue because the form has already been drawn by the time the 'Form Activate' routine is called ? (This is a guess !)

    Don't want to make a mountain out of a molehill, just would be nice to use as its a nice effect.

    Thanks regardless.

  10. #10
    Fanatic Member InvisibleDuncan's Avatar
    Join Date
    May 2001
    Location
    Eating jam.
    Posts
    819
    I think, then, that you might be stuck. The exploding effect isn't actually connected to the form; all it uses is the form's size and it then paints a series of rectangle up to that size. I guess if it does that over the top of an existing form, it might cause problems.

    I'm not too sure why you wouldn't be able to put it in the Form_Load, because this relates purely to display. You're the boss, though.

    One final possibility: You could put the procedure between the load and the show on the form that calls it. For example:
    VB Code:
    1. Private Sub Command1_Click()
    2.    
    3.     '# Load the form
    4.     Load FrmImplodeExplode
    5.    
    6.     '# Explode the form as it opens
    7.     SubExplodeForm FrmImplodeExplode, 2500
    8.    
    9.     '# Show the form itself
    10.     FrmImplodeExplode.Show
    11.    
    12. End Sub
    That any good to you?
    Indecisiveness is the key to flexibility.

    www.mangojacks.com

  11. #11

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    .

    Ha Ha ! 10 out of 10 for perseverence !

    The reason it can't go in the form load event is because the form contains a listview box, which has items added to it whilst my main form is built. Its purely up to the user if they want to eventually click the button that loads this form when all prcessing is complete.

    I've noticed that when you address a control on a form it runs through the form load event, therefore the form concerned runs the 'explode' routine as my processing is half way through.

    Also I don't unload the form I just hide it, because otherwise my listview wil lose all of its data.

    If you know of a better way then please tell. I'm pretty new at all this so I'm sure I'm not doing a lot of things the best way possible.

    My program does a lot of processing before the user can intervene, so that when it gets that far they have no more waiting.

    Thanks for the input so far by the way.

    Steve.

  12. #12
    Fanatic Member InvisibleDuncan's Avatar
    Join Date
    May 2001
    Location
    Eating jam.
    Posts
    819
    So, is the code on my previous post no good to you? If you put that on the button that loads the exploding form it should work. You then won't need to put it in the form itself at all. As long as you call SubExplodeForm immediately prior to showing the form, you should be alright. Just make sure you pass the form's name in as a parameter instead of using Me.
    Indecisiveness is the key to flexibility.

    www.mangojacks.com

  13. #13

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    .

    Sorry about that, i didn't read it properly (one of those days .... I HATE Mondays !).

    That now actually works perfectly , so thanks very much for all your help (and the code in the first place !)

  14. #14
    Fanatic Member InvisibleDuncan's Avatar
    Join Date
    May 2001
    Location
    Eating jam.
    Posts
    819
    My pleasure. I'm glad you got it working - I'd hate to think that I was posting crappy code...
    Indecisiveness is the key to flexibility.

    www.mangojacks.com

  15. #15
    Fanatic Member dongaman's Avatar
    Join Date
    Aug 2001
    Location
    xi'an
    Posts
    616

    THE ESAYEST WAY!!!

    Hey.
    I find a easy way to do this.You will find it is very simple to make a popup boxes 'fade-in'.
    Here is the exe.
    I am just aman.

  16. #16

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818
    Very nice effect.

    Any chance of the source code to see how 'simple' they are to do ??

  17. #17
    Fanatic Member dongaman's Avatar
    Join Date
    Aug 2001
    Location
    xi'an
    Posts
    616
    Click here you will get it.
    Good luck!
    I am just aman.

  18. #18

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818
    Thanks a lot.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width