dcsimg
Results 1 to 3 of 3

Thread: How to bring the form back to focus after the code finish ploting in matlab?

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2012
    Posts
    49

    How to bring the form back to focus after the code finish ploting in matlab?

    Hi folks, my code uses Matlab as a COM server and has matlab plot some data in a figure, which is opened up in a new window named 'Figure 1' normally. After it's done plotting I hope to give focus back to the form that calls the sub that execute the matlab commands. I've tried to add two lines after the sub call
    Code:
    PassDataNPlot()
    Me.BringToFront()
    Me.Focus()
    but when it's done plotting the matlab figure is still on top of my form. I wonder what else could do the trick? any suggestions?

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,242

    Re: How to bring the form back to focus after the code finish ploting in matlab?

    If PassDataNPlot() completes then your solution should work. I can only assume therefore that there is some kind of wait loop or threading issue that prevents this.

  3. #3
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    104,182

    Re: How to bring the form back to focus after the code finish ploting in matlab?

    As the documentation that you didn't bother reading says, you don't call BringToFront or Focus on forms. You call a form's Activate method to make it the active form. I'm not aware of a reason that that wouldn't work.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width