Create Event Handler to Update Button Status

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  ActiveX Integration > ActiveX Integration Examples > HTML > HTML Integration at Document Level >

Create Event Handler to Update Button Status

Availability of a command may vary with every mouse click or keystroke. The custom event OnUpdateCmdUI of MapForceControl gives us an opportunity to update the enabled/disabled state of buttons associated with MapForce commands. The method MapForceControl.QueryStatus is used to query whether a command is enabled or not.

 

<!--  custom event 'OnUpdateCmdUI" of MapForceControl object  -->
function objMapForceX::OnUpdateCmdUI()
{
  if ( document.readyState == "complete" )// 'complete'
  {
    // update status of buttons
    // set activity status of simulated toolbar
     GenerateXSLT.disabled =  ! (objDoc1.QueryStatus(32360) & 0x02);   // not enabled
     GenerateJava.disabled =  ! (objDoc1.QueryStatus(32358) & 0x02);   // not enabled
     GenerateCpp.disabled =   ! (objDoc1.QueryStatus(32356) & 0x02);   // not enabled
     GenerateCSharp.disabled = ! (objDoc1.QueryStatus(32357) & 0x02);   // not enabled
 
     btnInsertXML.disabled = ! (objDoc1.QueryStatus(32393) & 0x02);
     btnInsertDB.disabled = ! (objDoc1.QueryStatus(32389) & 0x02);
     btnInsertEDI.disabled = ! (objDoc1.QueryStatus(32390) & 0x02);
     btnInsertText.disabled = ! (objDoc1.QueryStatus(32392) & 0x02);
 
     btnInsertConstant.disabled = ! (objDoc1.QueryStatus(32388) & 0x02);
     btnInsertFilter.disabled = ! (objDoc1.QueryStatus(32391) & 0x02);
     btnInsertIFELSE.disabled = ! (objDoc1.QueryStatus(32394) & 0x02);
     btnInsertException.disabled = ! (objDoc1.QueryStatus(32311) & 0x02);
 
     btnFuncUserDef.disabled = ! (objDoc1.QueryStatus(32380) & 0x02);
     btnFuncUserDefSel.disabled = ! (objDoc1.QueryStatus(32381) & 0x02);
     btnFuncSettings.disabled = ! (objDoc1.QueryStatus(32387) & 0x02);
     btnInsertInput.disabled = ! (objDoc1.QueryStatus(32383) & 0x02);
 
     btnGenXSLT.disabled = ! (objDoc1.QueryStatus(32360) & 0x02);
     btnGenXSLT2.disabled = ! (objDoc1.QueryStatus(32361) & 0x02);
     btnGenXQuery.disabled = ! (objDoc1.QueryStatus(32359) & 0x02);
     btnGenCPP.disabled = ! (objDoc1.QueryStatus(32356) & 0x02);
     btnGenCSharp.disabled = ! (objDoc1.QueryStatus(32357) & 0x02);
     btnGenJava.disabled = ! (objDoc1.QueryStatus(32358) & 0x02);
  }
}


© 2019 Altova GmbH