05-30-2019 02:16 AM
Hi,
I am customizing the Teststand Operator Interface based on my project requirements.
Now I want to display the Current system and Date information in the bottom pane of the operator interface along with other information like User, Model etc. I am using below code to display the current date and time but is not working.
mExecutionViewMgr->GetCaptionText(CaptionSource_Date, false, "");
mExecutionViewMgr->GetCaptionText(CaptionSource_Time, false, "");
Where mExecutionViewMgr is my pointer to Execution view manager.
Please guide how to display current date and time as I could not get this anywhere in internet or forum.
Thanks in advance.
Solved! Go to Solution.
05-31-2019 03:38 AM - edited 05-31-2019 03:39 AM
Building the connection is the first important step on displaying that information. However, i do recommend you to use the ApplicationMgr in case you want to display the information all the time.
You missed the second step to actually display the accoring pane(s). You can configure this in the ShowAppropriateStatusBarPanes method (at least this is the name in C# as i do not work with C++ anymore). Note that the panes are referred to per name in that method.
06-03-2019 02:47 AM
Hi Norbert,
Thanks for the reply.
I have replaced 'mExecutionViewMgr' with 'mApplicationMgr' (again a pointer to ApplicationMgr). However I still don't get the date and time information.
About ShowAppropriateStatusBarPanes:
Below code snippet was available in the C++(MFC) example code for Operator Interface. It is used to show information like User, Model etc on the selected tab control.
void CTestExecDlg::ShowAppropriateStatusBarPanes()
{
if (m_tabCtrl.GetCurSel() >= 0)
{
if (mListBar->GetCurrentPage() == SEQUENCE_FILES_PAGE_INDEX) // if only the files tab is visible
mStatusBar->ShowPanes(_T("User, EngineEnvironment, FileModel, FileSelectedSteps, FileNumberOfSteps"));
else
if (m_tabCtrl.GetCurSel() == 0) // execution tab is selected
mStatusBar->ShowPanes(_T("User, EngineEnvironment, ExecutionModel, ExecutionSelectedSteps, ExecutionNumberOfSteps, ProgressText, ProgressPercent"));
else // report tab is selected
mStatusBar->ShowPanes(_T("User, EngineEnvironment, ExecutionModel, ReportLocation, ReportModel, ProgressText, ProgressPercent"));
}
}
In the above ShowAppropriateStatusBarPanes(), how can I include date and time information as GetCaptionText() does not have the 'uiObj' parameter.
PS: The parameters inside ShowPanes() in the above code snippet are the 'uiObj' for each connection established.
Appreciate any help!
06-03-2019 03:49 AM
As mentioned, the panes are referred to by name.
mStatusBar->ShowPanes(_T("User, EngineEnvironment, FileModel, FileSelectedSteps, FileNumberOfSteps, <MyPaneName>"));
I hope above part points you to a working solution...
06-03-2019 05:29 AM
Hi Norbert,
I understand that I should list <MyPaneName> in the parameters list of ShowPanes().
But, analyzing the current parameters of ShowPanes(), for example 'User', this is the uiObj parameter of the below code snippet. used for connection.
mApplicationMgr->ConnectCaption(panes->GetItem("User"), CaptionSource_UserName, false);
'uiObj' is the first parameter of the function ConnectCaption() which is used to connect this caption (i.e. 'User')
However for date and time, I am using GetCaptionText() and this function does not have uiObj parameter. I tried using ConnectCaption() for date and time but when I launch my .exe, it says invalid pane probably because no such pane exists. Is GetCaptionText() the correct function to use?
If yes, what would be <MyPaneName> I should be passing to ShowPanes().
If No, what should be the function used instead of GetCaptionText() ?
06-03-2019 06:15 AM
@Divyaa wrote:
[...]But, analyzing the current parameters of ShowPanes(), for example 'User', this is the uiObj
[...]
That part underlined in your text above is incorrect. ShowPanes works with the name.
That is why you need
@Divyaa wrote:
[...]
mApplicationMgr->ConnectCaption(panes->GetItem("User"), CaptionSource_UserName, false);[...]
This code connects the item with the name "User" to the application manager. You can see this because it calls the GetItem method.
When looking at the parameters of ShowPanes, you won't see the GetItem method call....
The name is whatever you provided as name for the pane in the ActiveX property dialog.
06-03-2019 06:36 AM
It Worked! Thanks a lot Norbert.
I am pasting the code below for someone in need.
First insert two panes with names 'Date' and 'Time' as below.
panes->Insert("Date",4);
panes->Insert("Time", 5);
where 'panes' is of type StatusBarPanesPtr.
4 and 5 is the position of the panes.
Then connect these panes as below:
mApplicationMgr->ConnectCaption(panes->GetItem("Date"), CaptionSource_Date, false);
mApplicationMgr->ConnectCaption(panes->GetItem("Time"), CaptionSource_Time, false);
Upon passing 'Date' and 'Time' in ShowPanes() of ShowAppropriateStatusBarPanes() function. This brings both date and time information to the status bar.
06-03-2019 07:30 AM
This is working fine and displaying the current date and time correctly. Now, how to give a label to them as 'Date:' and 'Time:' so that when they look like 'Date:dd/mm/yyyy' and 'Time: hh:mm:ss'?
Now it is just 'dd/mm/yyyy' and 'hh:mm:ss'
06-03-2019 09:02 AM - edited 06-03-2019 09:03 AM
You have to extend your connection to allow custom formatting.
To do so, you can modify the connection command area to somthing like this (C#):
CaptionConnection TimeConn;
TimeConn = this.axApplicationMgr.ConnectCaption(panes["Time"], CaptionSources.CaptionSource_Time, false);
TimeConn.FormatExpression = "\"Time: %1\"";
%1 is replaced with the text of the caption source once an update is done.
06-03-2019 11:19 PM
Got it working. Thanks a lot!