What’s New in Visual Styles for the Teigha BIM Sample Application

Artur Vakhramov

November 28, 2017

Recently the Graphic Display Options dialog was improved in the OdaBimApp sample application. You can now click Apply to apply the selected style to the current view without closing the dialog.

image1

An event handler for the OK button performs an update of visual styles and returns to the parent window:

void ViewDisplayStyleDialog::OnBnClickedOk()
{
  UpdateData(TRUE);
  updateDBViewVisualStyle();
  CDialog::OnOK();
  m_nModalResult = IDOK;
}

An event handler for the Cancel button performs a return to the parent window:

void ViewDisplayStyleDialog::OnBnClickedCancel()
{
  CDialog::OnCancel();
  m_nModalResult = IDCANCEL;
}

An event handler for the Apply button performs an update of the visual styles and sends a message to update the rendering to the parent window:

void ViewDisplayStyleDialog::OnBnClickedApply()
{
  UpdateData(TRUE);
  updateDBViewVisualStyle();

  ((OdaBimExViewer*)m_pParentWnd)->invalidateDevice();
  m_pParentWnd->SendMessage(WM_PAINT);
}

The following function of the parent window processes actions of the OK and Cancel buttons and was changed to:

void OdaBimExViewer::OnViewGraphicDisplayOptions() {
  OdBmDBViewPtr pDBView = getActiveDbView();
  ViewDisplayStyleDialog viewDisplayStyleDialog(pDBView, this);
  viewDisplayStyleDialog.DoModal();
  int modalResult = viewDisplayStyleDialog.GetModalResult();
  if (modalResult == IDOK) {
    m_pDevice->invalidate();

    PostMessage(WM_PAINT);
  }
  else if (modalResult == IDCANCEL) {
    // do nothing
  }
}