Forum Discussion

iamraj09's avatar
iamraj09
Contributor
11 years ago
Solved

How to know if Status bar is active or still working

I am currently new to Test Complete and I have problem in getting the status of the status bar. To explain that in breif.



1.When I dont perform any Operation it has 3 panels.



2.When I perfrom a particular operation, the whole status bar becomes busy and no panels are visible. After some seconds it becomes 4 panels it indicates that it is still loading in the back ground. 



3.After the loading is completed it becomes 3 panels again. For better understanding please refer the screen shots of the status bar with this description.



Status_Bar=Sys.Process("Central").WinFormsObject("MainForm").WinFormsObject("_statusBar");



Methods tried:



Is_Enabled();          

get_Enabled();

wPartCount();

wItembounds();
  // tried this as the width of the panel was changing ...but it doesnt                                           work  it remains constant as 1148 



Please suggest me any other methods that I can try. 



  • In your code, you saved value of StatusBar.wPartCount into a local variable StatusBarPane, and then output that saved value again and again in while loop.



    If you want to get latest wPartCount in while loop, you should output StatusBar.wPartCount instead of StatusBarPane.



    -Ocean
  • In your code, you saved value of StatusBar.wPartCount into a local variable StatusBarPane, and then output that saved value again and again in while loop.



    If you want to get latest wPartCount in while loop, you should output StatusBar.wPartCount instead of StatusBarPane.



    -Ocean
  • Hard to give a correct answer without seeing the full object properties when it's doing nothing and busy.



    But, from what you have given us .... you say it goes from 3 panels, to 4 panels, then back to 3?



    Can you detect the panel count?

    Does it ALWAYS do this?



    Assuming this behaviour is consistent, and you can get a count on the panels, you could put it in a loop ....



    Loop1 ..... until it goes from the initial 3, to 4 panels.

    Loop2 ..... until it goes back to 3 panels. At this point it should be finished according to your description.



    If you can't get a count on the number of panels then another approach will be needed.



    (And probably use a timer as a get-out clause in case it doesn't go 3/4/3 ...)
  • IT WORKED..!!! Thank you Colin and Ocean ..I have corrected and implemented the code the way you both suggested.....and now it is working as expected.  
  • This is the sample approch what I did from my side ...






    function getStatus()


    {


    var StatusBar=Sys.Process("Central").WinFormsObject("MainForm").WinFormsObject("_statusBar");


    var Text=StatusBar.wItemBounds(1).Width;


    var StopWatch=HISUtils.StopWatch;


    Test1();


    StopWatch.Start()


     


    while(!Status_Bar["Enabled"])


    {


    Delay(100);


    Log.Message(Text);


    }


     


    StopWatch.Stop();


    Log.Message(StopWatch.ToString());


    Delay(2000);


    Log.Message(Text.Width);


     


     


    }


     


    function Test1()


    {


      var central;


      central = Aliases.Central;


      central.MainForm.ztopSandBarDock.zmenuBar.Keys("~Ba");


      central.MainForm.ztopSandBarDock.zmenuBar.Keys("~y");  


    }

  • Thank you for the reply. Yeah I have tried that but the pane count remains constant through out the process it is not changing  ....I am posting the code ...please let me know if any thing can be done.



    I have posted the screenshot of the result with this code. Thank you.






    function getStatusText()


    {


    var StatusBar=Sys.Process("Central").WinFormsObject("MainForm").WinFormsObject("_statusBar");


    var Text=StatusBar.wItemBounds(1).Width;


    var StopWatch=HISUtils.StopWatch;


    Test1();


    Delay(1000);


    StopWatch.Start()


    var StatusBarPane=StatusBar.wPartCount;


    Log.Message(StatusBarPane);                 //Status pane count before starting 


    Log.Message("...............");


     


    while(StatusBarPane>2)      // I know it is not the appropriate condition but I have put this just to chek the pane count before and while running 


    {


    Delay(100);


    Log.Message(StatusBarPane);                // Status pane count while running 


    }


     


    StopWatch.Stop();


    Log.Message(StopWatch.ToString());


    Delay(2000);


    Log.Message(Text.Width);


     


     


    }


     


    function Test1()


    {


      var central;


      central = Aliases.Central;


      central.MainForm.ztopSandBarDock.zmenuBar.Keys("~Ba");


      var ButtonYes=Sys.Process("Central").Window("#32770", "SoMachine Logic Builder", 1).Window("Button", "&Yes", 1);


      ButtonYes.ClickButton();  

  • It's not so much the code, as the object properties.



    You need to find something that changes when it's updating. Which is hard to do from a couple of screen captures. You need to sit with the Object Browser and inspect things (both before and during an update) until you find something you can use. Simple as that.



    Find the property that changes, and use that inside a loop to detect the change(s).



    Does seem odd that the part count doesn't change though. Are you sure it's the same object? It doesn't create a new one and overlay it while it's updating?



    Things like this are kind of tricky to give a reliable answer to without the actual object in question available to look at I'm afraid ....
  • Thank you..... for sparing time ....yeah that is the same object and you can find that in the screen shot too

    yeah even I find it weird though that the part count doesnt change ...every option is getting closed ...and that is the only statusbar which i am working on ....anyways ...I will dig into it little more and try to find it out ....Thanks ..
  • lol



    I should pay more attention to the code snippets. I didn't even notice that!



    So the count may be going up after all?