[Lazarus] Highlighter/line-Remainder patch [Re: [Fwd: A few hacky patches (resent)]]

Martin lazarus at mfriebe.de
Tue May 26 16:36:22 CEST 2009


Paul Ishenin wrote:
> I would leave class hierarchi as is. It is not a big problem to copy
> property BidiMode to the TMenu, TTrayIcon or anything else.

Not just copy the code.
When TForm or TApplication has BidiMode changed it pass to owned
components to change the BidiMode

-------------------
procedure TCustomForm.BiDiModeChanged;
var
  i:Integer;
begin
  inherited;
  for i := 0 to ComponentCount - 1 do
  begin
    if (Components[i] is TVisualComponent) and not (Components[i] is
TCustomControl) then //TCustomControl already has this notification
      (Components[i] as TVisualComponent).ParentBiDiModeChanged;
  end;
end;


procedure TApplication.BidiModeChanged;
var
  i: Integer;
begin
  for i := 0 to ComponentCount -1 do
  begin
    if (Components[i] is TVisualComponent) then
    begin
      (Components[i] as TVisualComponent).ParentBidiModeChanged;
      if AutoFlipChildren and (Components[i] is TWinControl) then
        (Components[i] as TWinControl).FlipChildren(True);
    end;
  end;
end;
-------------------

And lookup to old code.
-------
procedure TCustomForm.CMBiDiModeChanged(var Message: TLMessage);
var
  i:Integer;
  lMessage:TLMessage;
begin
  inherited;
  //send CM_PARENTBIDIMODECHANGED to All Component owned by Form
{ This way is usefull for other TMenu components that need BidiMode of
form changed
  Like as TToolbar }
  lMessage.msg := CM_PARENTBIDIMODECHANGED;
  lMessage.wParam := 0;
  lMessage.lParam := 0;
  lMessage.Result := 0;
  for i := 0 to ComponentCount - 1 do
  begin
    if not (Components[i] is TCustomControl) then//TCustomControl
already has this notification
      Components[i].Dispatch(lMessage);
//the old way
//    if Components[i] is TMenu then
//      TMenu(Components[i]).ParentBiDiModeChanged;
  end;
end;
-------
And Delphi only check TMenu, that make problems when i tried to add
BidiMode to TB2K (and it is done by many hacks before years), for that
i prepare lazarus to not fall in the same hole (Arabic aphorism :) ).




More information about the Lazarus mailing list