Alarm table right click

Find and share HowTos to various installations / configurations!
10 posts • Page 1 of 1
AGorbatykh
Posts:59
Joined: Thu Dec 17, 2015 1:01 pm

Alarm table right click

Post by AGorbatykh »

Hello,

I'm working with table and got an issue. I added a function to hide a row (or all at once) in a popup menu (by right clicking on a table) and a function that shows hidden rows back. However, when there's no rows in a table, it's not possible to pop out that menu to show hidden rows.
Unfortunately RightMousePressed (of a table) takes some arguments:

Code: Select all

main(int row, string column) ...
and assumes operation with real current cell, not with an empty table.
I can't find how to overload that function or event, to catch that moment when I right clicked on a table.
Have you faced with this problem?

With best regards

mkoller
Posts:741
Joined: Fri Sep 17, 2010 9:03 am

Re: Table right click

Post by mkoller »

Which WinCC_OA version ? Testing here with 3.14 works even with an empty table

AGorbatykh
Posts:59
Joined: Thu Dec 17, 2015 1:01 pm

Re: Table right click

Post by AGorbatykh »

Oh, yes it's works. Popup blocks in aes_onRightClick(...) logic.
Thanks

AGorbatykh
Posts:59
Joined: Thu Dec 17, 2015 1:01 pm

Re: Table right click

Post by AGorbatykh »

If anyone needs to show popup panel, you need to modify a few function in aes.ctl:
[spoiler]void aes_onRightClick(...)
{
//if (row < 0) // no line selected -> context menue still shows
// return;


if(dynlen(diSelectedLines) == 0) //ETCS_WS AES Enhancements - 071_8602 - WinCC OA Erweiterungen Alarmlogging
dynAppend(diSelectedLines, row);

int screenType;
string content;

const string _func_="aes_onRightClick";

unsigned runMode;

aes_getRunMode( propDp, runMode );

if( runMode != AES_RUNMODE_RUNNING )
{
if( !AES_FORCE_CLICK )
return;
}

// no popup menu available for user guest
if( !getUserPermission( AES_PERMLEVEL_MENU ) )
return;

setInputFocus( myModuleName(), myPanelName(), tableName );

aes_getScreenType( propDp, screenType );

if(row>=0) content=mTableMultipleRows[row][_DPID_];
else content="";

if( g_alertRow )
{
if( aes_checkPermission( AES_PERM_ALLOWAECONFIG ) == AES_PERM_NOK )
return;
}

//if( ( content != "" ) || g_alertRow )
{
bool emptyRow=false;

// freeze table
this.updatesEnabled=false;

if( g_alertRow && ( content == "" ) )
emptyRow=true;

aes_displayMenu( screenType, row, column, value, propDp, tableName, tabType, emptyRow, mTableMultipleRows, diSelectedLines ); //ETCS_WS AES Enhancements - 071_8602 - WinCC OA Erweiterungen Alarmlogging
}
}[/spoiler][spoiler]void aes_displayMenu(...)
{
...
// control popup items visibility
if(row>=0)
{

dpid=mTableMultipleRows[row][_DPID_];
fullDpid=dpid;

dpid=dpSubStr( dpid, DPSUB_SYS_DP_EL );

if( emptyRow )
dpeType=DPEL_BOOL; // dummy
else
dpeType=dpElementType( dpid );
} // now check everywhere (row>=0) to disable or hide menu lines that can't work without real cell
...
string ackVal, ackOldest;
bool ackable, bAckable, bAckOldest;

if(row>=0) // bAckable, bAckOldest= false
{

ackVal =mTableMultipleRows[row][_ACKABLE_];
ackOldest =mTableMultipleRows[row][_ACK_OLD_];
bAckable=(bool)strrtrim( strltrim( ackVal ) );
bAckOldest=(bool)strrtrim( strltrim( ackOldest ) );
}

if( bAckable && bAckOldest )
ack=true;
else
ack=false;
...
}[/spoiler][spoiler]void aes_menuFunctionHandler(...)
{
const string _func_="aes_menuFunctionHandler";
anytype cellVal;
const int d=0;
string dpid="";
int res=0;
int iScreenType;
mapping mTableRow;

if( !emptyRow )
{
// have entered here, but must check that function doesn't work incorrect
//if( ( row < 0 ) && ( functionId != AES_MNUA_ACKALLVISIBLE ) )
//{
// return;
//}

if(row>=0)
{

res=aes_getDpidFromTable( row, dpid, mTableMultipleRows[row] );

if( res != 0 )
{
return;
}
cellVal=mTableMultipleRows[row][_DPID_];
}
}
...
}
[/spoiler]

AGorbatykh
Posts:59
Joined: Thu Dec 17, 2015 1:01 pm

Re: Table right click

Post by AGorbatykh »

Nice. It's works

AGorbatykh
Posts:59
Joined: Thu Dec 17, 2015 1:01 pm

Re: Alarm table right click

Post by AGorbatykh »

And what about columns headers? RightMousePressed script is not triggered if I click by right mouse button on a colunm header. How can I fix it? How could I catch right click on a column header state?

mkoller
Posts:741
Joined: Fri Sep 17, 2010 9:03 am

Re: Table right click

Post by mkoller »

You need to use the HeaderClicked script in the table.

mkoller
Posts:741
Joined: Fri Sep 17, 2010 9:03 am

Re: Table right click

Post by mkoller »

my bad ... right clicking does not trigger this

AGorbatykh
Posts:59
Joined: Thu Dec 17, 2015 1:01 pm

Re: Alarm table right click

Post by AGorbatykh »

So..? How can I catch this?

mkoller
Posts:741
Joined: Fri Sep 17, 2010 9:03 am

Re: Alarm table right click

Post by mkoller »

you can't

10 posts • Page 1 of 1