CPB Mailing List

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MDI windows and statusbar



Ken,
   I hope you dont mind me asking a question on something you helped me with
on the C++ Builder list.  Your response is below to refresh you.  My
original question was that Im working on a wordprocessor using MDI forms,
when I open one child window and start typing the statusbar is updated
correctly, when I open a second and type the statusbar is ok, when I switch
back to the first one, the statusbar is not updated, Im referring to
row/column updates.  you mentioned about the handle not being set correct
and using ActiveMDIChild, whenever I try and use ActiveMDIChild I get an
error that says Forms::TForm::ActiveMDIChild is not accessible.
Here is the functionthat does the statusbar update. If you wouldnt mind
taking a look and seeing what I need to change, I would appreciate it.

 Thanks,
    Tony

void TFrameForm::UpdateStatusBar()
{


  // Get the line number.
  int line = SendMessage (EditForm->Editor->Handle,
                          EM_LINEFROMCHAR,
                          EditForm->Editor->SelStart,
                          0) ;
  // Get the starting character position for the line.
  int   lineindex = SendMessage (EditForm->Editor->Handle,
                               EM_LINEINDEX,
                               line,
                               0) ;
  FrameForm->StatusBar1->Panels->Items[0]->Text = String (line + 1) + ": "
                         + String (EditForm->Editor->SelStart - lineindex + 1);
  if (EditForm->Editor->Modified)
    FrameForm->StatusBar1->Panels->Items[1]->Text = "Modified" ;
  else
    FrameForm->StatusBar1->Panels->Items[1]->Text = "" ;


  return ;
}


W Komornicki's Home Page | Main Index | Thread Index