Results 1 to 17 of 17

Thread: Form_Activate

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    5

    Smile Form_Activate


    hi...i need some help regarding Form_Activate...

    here goes...
    see, i have this form form1(mdichild=true)...it is open or its is visible..then i open another form form2(mdichild=false) and do some processing,after i close form2...form1 is still visible but it will not pass to Form_Activate event anymore...i need to re-initialize some variables in form1....any ideas how to do it???

    thanks a lot...

  2. #2
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878
    Use the Form_GotFocus routine

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    5

    Smile

    hi JordanChris...

    i already did that..still nothing happens...i even use Form_Paint()...thanks for your reply nywys...

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Put what you need to reinitialize in a Sub Routine. Call it when the form loads, and call it again when you need to redo stuff. Make sure the Sub is Public so it can be called from a different form.

  5. #5
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    I think the MDI parent will get the activate event.

  6. #6
    PowerPoster
    Join Date
    Aug 2002
    Location
    NY, NY
    Posts
    2,139
    This is all you need to do:
    VB Code:
    1. 'Form2 - non MDI child
    2. Private Sub Form_Unload(Cancel As Integer)
    3.     Form1.SetFocus 'set focus back to MDI child form
    4. End Sub
    5. 'Form1 - MDI child
    6. Private Sub Form_Activate()
    7.     Debug.Print "Form1.Activate"
    8. End Sub
    Roy

  7. #7

  8. #8
    PowerPoster
    Join Date
    Aug 2002
    Location
    NY, NY
    Posts
    2,139
    Don't use MDI forms...They suck ...
    It's not about what we like but what business needs.
    Roy

  9. #9
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    Business does not know what it needs...The majority of the time, the user hasn't got a clue what they want, or what is on offer. 90% of the time a customer has asked for something and I have offered an alternative, which they have agreed is a better way than theirs...
    MDI forms, Multi Document Interfaces, and designed exactally for that tpye of project. A project that has many of the same type of document open, ie word 97...One MDI form can control loads of word documents. In this situation MDI forms are great. But when trying to write an app that has many types of forms and displays, MDI forms are just plain crap, and should not be used for these types of applications.
    I have no idea why people use MDI forms for non MDI applications. It just makes no sense!
    To be a good programmer you have to know what is the right control, code, references for the job...for some strange and bizzare reason, people continually use MDI forms...and then run into trouble. Menu's are a cracking example, and the reason being is that an MDI document shouldn't have menus All the tools/function or any other menu should be on the MDI form and Not in the child document...

    Woka

  10. #10
    PowerPoster
    Join Date
    Aug 2002
    Location
    NY, NY
    Posts
    2,139
    You are totally wrong on this: serious applications (not to mention interfaces) are design by architects and often according to a very serious analisys done by a group of analysts. Developer may dissagree on some issues wich may or may not be taken into considerations but it all depends on the entire picture wich isn't necessary of our (developres) business.
    Roy

  11. #11
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    I disagree...serious applications? What do you class as a serious application? One that controls the state and production of a million pounds worth of GaAs wafers, for military and satalite communications, as it goes through different processes? If so, then the apps I write are very serious. I make a mistaken then oooops, I've just cost the company one hundred thousand quid...

  12. #12
    PowerPoster
    Join Date
    Aug 2002
    Location
    NY, NY
    Posts
    2,139
    Woka,
    you have your opinion wich (unfortunately for you) I can't change it. So let's stop this chit-chat.
    Roy

  13. #13
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    Wasn't having a go or anything, was just trying to put my point across, which, if you haven't guessed already, I am sticking too
    No offence meant
    If MDI forms had more features, or if they were easier to use, or didn't restrict your coding in anyway then I would use them more often as they do have some benefits, just not for SDI applications...

    me

  14. #14

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    5

    Smile

    Originally posted by Hack
    Put what you need to reinitialize in a Sub Routine. Call it when the form loads, and call it again when you need to redo stuff. Make sure the Sub is Public so it can be called from a different form.
    hi hack...thank u...

  15. #15

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    5

    Smile

    Originally posted by IROY55
    This is all you need to do:
    VB Code:
    1. 'Form2 - non MDI child
    2. Private Sub Form_Unload(Cancel As Integer)
    3.     Form1.SetFocus 'set focus back to MDI child form
    4. End Sub
    5. 'Form1 - MDI child
    6. Private Sub Form_Activate()
    7.     Debug.Print "Form1.Activate"
    8. End Sub
    hey roy..ill try this... ..thanks

  16. #16

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    5
    Originally posted by Wokawidget
    Business does not know what it needs...The majority of the time, the user hasn't got a clue what they want, or what is on offer. 90% of the time a customer has asked for something and I have offered an alternative, which they have agreed is a better way than theirs...
    MDI forms, Multi Document Interfaces, and designed exactally for that tpye of project. A project that has many of the same type of document open, ie word 97...One MDI form can control loads of word documents. In this situation MDI forms are great. But when trying to write an app that has many types of forms and displays, MDI forms are just plain crap, and should not be used for these types of applications.
    I have no idea why people use MDI forms for non MDI applications. It just makes no sense!
    To be a good programmer you have to know what is the right control, code, references for the job...for some strange and bizzare reason, people continually use MDI forms...and then run into trouble. Menu's are a cracking example, and the reason being is that an MDI document shouldn't have menus All the tools/function or any other menu should be on the MDI form and Not in the child document...

    Woka
    hey there.. ..
    well..i think i really need to use mdichild..coz my users want some modules .. like 2-3 modules open simultaneously...they just use minimized..maximed to switch from one module to another which i cannot do when my form is in vbmodal(they want to eliminate the extra trip on menu)...but then i need other forms to be in vbmodal so to save necessary information before returning to main/calling form...
    i guess if ill be the one to decide..ill make it simple as much as possible..who wants to run into trouble anyway...but i have my users...and i guess its my job to do what they think would be easier for them...thats whats automation is all about...i think..
    ...thanks for ur opinion anyway..ill keep it in mind...

  17. #17

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