View Issue Details

IDProjectCategoryView StatusLast Update
0008955LazarusPatchpublic2007-09-02 00:22
ReporterZaher DirkeyAssigned ToPaul Ishenin 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version0.9.23 (SVN)Product Build 
Target VersionFixed in Version0.9.23 (SVN) 
Summary0008955: Patch for BidiMode to TControl
DescriptionAdd property BidiMode and ParentBidiMode to TControl and patch the code for TForm, TButton, TEdit to work with this property.

Changed files

buttons.pp
controls.pp
forms.pp
stdctrls.pp
include/buttons.inc
include/control.inc
include/customedit.inc
include/wincontrol.inc
interfaces/win32/win32wsbuttons.pp
interfaces/win32/win32wsforms.pp
interfaces/win32/win32wsstdctrls.pp

I put a Wiki page for it
http://wiki.lazarus.freepascal.org/BidiMode
http://www.lazarus.freepascal.org/index.php?name=PNphpBB2&file=viewtopic&t=3766

in next patch i will make Menus, CheckBox, TListBox, TComboBox
Tagsbidi
Fixed in Revision11029
LazTarget0.9.26
WidgetsetWin32/Win64
Attached Files
  • add_bidimode_property.patch (13,102 bytes)
    Index: buttons.pp
    ===================================================================
    --- buttons.pp	(revision 11206)
    +++ buttons.pp	(working copy)
    @@ -74,6 +74,7 @@
         procedure CMUIActivate(var Message: TLMessage); message CM_UIACTIVATE;
         procedure WMDefaultClicked(var Message: TLMessage); message LM_CLICKED;
         procedure WMKillFocus(var Message: TLMKillFocus); message LM_KILLFOCUS;
    +    procedure CMBiDiModeChanged(var Message: TLMessage); message CM_BIDIMODECHANGED;
       protected
         procedure Click; override;
         procedure CreateWnd; override;
    @@ -112,6 +113,7 @@
         property Align;
         property Anchors;
         property AutoSize;
    +    property BidiMode;
         property BorderSpacing;
         property Cancel;
         property Caption;
    @@ -122,6 +124,7 @@
         property DragMode;
         property Enabled;
         property Font;
    +    property ParentBidiMode;
         property ModalResult;
         property OnChangeBounds;
         property OnClick;
    Index: controls.pp
    ===================================================================
    --- controls.pp	(revision 11206)
    +++ controls.pp	(working copy)
    @@ -1282,6 +1282,22 @@
         property TBDockHeight: Integer read GetTBDockHeight write FTBDockHeight;
         property UndockHeight: Integer read GetUndockHeight write FUndockHeight;// Height used when undocked
         property UndockWidth: Integer read GetUndockWidth write FUndockWidth;// Width used when undocked
    +  private
    +    //BidiMode property, RightToLeft
    +    FBiDiMode: TBiDiMode;
    +    FParentBiDiMode: Boolean;
    +    function IsBiDiModeStored: boolean;
    +    procedure SetBiDiMode(const AValue: TBiDiMode);
    +    procedure SetParentBiDiMode(const AValue: Boolean);
    +    procedure CMBiDiModeChanged(var Message: TLMessage); message CM_BIDIMODECHANGED;
    +    procedure CMParentBiDiModeChanged(var Message: TLMessage); message CM_PARENTBIDIMODECHANGED;
    +  public
    +    function UseRightToLeftAlignment: Boolean; virtual;
    +    function UseRightToLeftReading: Boolean; virtual;
    +    function UseRightToLeftScrollBar: Boolean;
    +    function IsRightToLeft: Boolean;
    +    property BiDiMode: TBiDiMode read FBiDiMode write SetBiDiMode stored IsBiDiModeStored default bdLeftToRight;
    +    property ParentBiDiMode: Boolean read FParentBiDiMode write SetParentBiDiMode default True;
       published
         property AnchorSideLeft: TAnchorSide index 0 read GetAnchorSideIndex write SetAnchorSideIndex;
         property AnchorSideTop: TAnchorSide index 1 read GetAnchorSideIndex write SetAnchorSideIndex;
    @@ -1586,6 +1602,7 @@
         // messages
         procedure CMEnabledChanged(var Message: TLMessage); message CM_ENABLEDCHANGED;
         procedure CMShowHintChanged(var Message: TLMessage); message CM_SHOWHINTCHANGED;
    +    procedure CMBiDiModeChanged(var Message: TLMessage); message CM_BIDIMODECHANGED;
         procedure WMEraseBkgnd(var Message: TLMEraseBkgnd); message LM_ERASEBKGND;
         procedure WMNotify(var Message: TLMNotify); message LM_NOTIFY;
         procedure WMSetFocus(var Message: TLMSetFocus); message LM_SETFOCUS;
    Index: forms.pp
    ===================================================================
    --- forms.pp	(revision 11206)
    +++ forms.pp	(working copy)
    @@ -185,7 +185,7 @@
         property AutoSize;
         //property AutoScroll;
         property BorderSpacing;
    -    //property BiDiMode;
    +    property BiDiMode;
         property BorderStyle;
         property ChildSizing;
         property Constraints;
    @@ -198,7 +198,7 @@
         property Color nodefault;
         property Ctl3D;
         property Font;
    -    //property ParentBiDiMode;
    +    property ParentBiDiMode;
         property ParentColor;
         property ParentCtl3D;
         property ParentFont;
    @@ -571,6 +571,7 @@
         property ActiveControl;
         property Align;
         property AutoSize;
    +    property BiDiMode;
         property BorderIcons;
         property BorderStyle;
         property Caption;
    @@ -617,6 +618,7 @@
         property OnStartDock;
         property OnUnDock;
         property OnUTF8KeyPress;
    +    property ParentBiDiMode;
         property ParentFont;
         property PixelsPerInch;
         property PopupMenu;
    Index: include/buttons.inc
    ===================================================================
    --- include/buttons.inc	(revision 11206)
    +++ include/buttons.inc	(working copy)
    @@ -258,6 +258,14 @@
       end;
     end;
     
    +procedure TCustomButton.CMBiDiModeChanged(var Message: TLMessage);
    +begin
    +  inherited;
    +  if (Message.wParam = 0) then
    +    RecreateWnd(Self);
    +  //i dont like RecreateWnd we must call a WSSet function to reset the Flags;
    +end;
    +
     procedure TCustomButton.RealSetText(const Value: TCaption);
     var
       ParseStr : String;
    Index: include/control.inc
    ===================================================================
    --- include/control.inc	(revision 11206)
    +++ include/control.inc	(working copy)
    @@ -2631,6 +2631,11 @@
           Font := Parent.Font;
           ParentFont := true;
         end;
    +
    +    if ParentBidiMode then begin
    +      BiDiMode := Parent.BiDiMode;
    +      ParentBidiMode := true;
    +    end;
       end;
     
       UpdateBaseBounds(true,true,true);
    @@ -3690,6 +3695,7 @@
       FHelpType := htContext;
       FDragCursor := crDrag;
       FFloatingDockSiteClass := TCustomDockForm;
    +  FParentBidiMode := True;
       //DebugLn('TControl.Create END ',Name,':',ClassName);
     end;
     
    @@ -4134,7 +4140,103 @@
       SetBoundsKeepBase(Message.XPos, Message.YPos, Width, Height,Parent<>nil);
     end;
     
    +{------------------------------------------------------------------------------
    +   Method:  TControl.SetBiDiMode
    + ------------------------------------------------------------------------------}
     
    +procedure TControl.SetBiDiMode(const AValue: TBiDiMode);
    +begin
    +  if FBiDiMode=AValue then exit;
    +  FBiDiMode:=AValue;
    +  FParentBiDiMode := False;
    +  Perform(CM_BIDIMODECHANGED, 0, 0);
    +end;
    +
    +{------------------------------------------------------------------------------
    +   Method:  TControl.SetParentBiDiMode
    + ------------------------------------------------------------------------------}
    +
    +procedure TControl.SetParentBiDiMode(const AValue: Boolean);
    +begin
    +  if FParentBiDiMode=AValue then exit;
    +  FParentBiDiMode:=AValue;
    +  if (FParent <> nil) and not (csReading in ComponentState) then
    +    Perform(CM_PARENTBIDIMODECHANGED, 0, 0);
    +end;
    +
    +{------------------------------------------------------------------------------
    +   Method:  TControl.CMBiDiModeChanged
    + ------------------------------------------------------------------------------}
    +
    +procedure TControl.CMBiDiModeChanged(var Message: TLMessage);
    +begin
    +  if (Message.wParam = 0) then
    +    Invalidate;
    +end;
    +
    +{------------------------------------------------------------------------------
    +       TControl.CMParentBidiModeChanged
    +
    +       assumes: FParent <> nil
    +------------------------------------------------------------------------------}
    +
    +procedure TControl.CMParentBidiModeChanged(var Message: TLMessage);
    +begin
    +  if csLoading in ComponentState then exit;
    +
    +  if FParentBidiMode then
    +  begin
    +    if FParent <> nil then
    +      BidiMode := FParent.BidiMode;
    +    FParentBidiMode := true;
    +  end;
    +end;
    +
    +{------------------------------------------------------------------------------
    +       TControl.IsBiDiModeStored
    +------------------------------------------------------------------------------}
    +function TControl.IsBiDiModeStored: boolean;
    +begin
    +  Result := not FParentBidiMode;
    +end;
    +
    +
    +{------------------------------------------------------------------------------
    +       TControl.IsRightToLeft
    +------------------------------------------------------------------------------}
    +
    +function TControl.IsRightToLeft: Boolean;
    +begin
    +  Result := UseRightToLeftReading;
    +end;
    +
    +{------------------------------------------------------------------------------
    +       TControl.UseRightToLeftAlignment
    +------------------------------------------------------------------------------}
    +
    +function TControl.UseRightToLeftAlignment: Boolean;
    +begin
    +  Result := (BiDiMode = bdRightToLeft);
    +end;
    +
    +{------------------------------------------------------------------------------
    +       TControl.UseRightToLeftReading
    +------------------------------------------------------------------------------}
    +
    +function TControl.UseRightToLeftReading: Boolean;
    +begin
    +  Result := (BiDiMode <> bdLeftToRight);
    +end;
    +
    +{------------------------------------------------------------------------------
    +       TControl.UseRightToLeftScrollBar
    +------------------------------------------------------------------------------}
    +
    +function TControl.UseRightToLeftScrollBar: Boolean;
    +begin
    +  Result := (BiDiMode in [bdRightToLeft, bdRightToLeftNoAlign]);
    +end;
    +
     {$IFDEF ASSERT_IS_ON}
       {$UNDEF ASSERT_IS_ON}
       {$C-}
    Index: include/customedit.inc
    ===================================================================
    --- include/customedit.inc	(revision 11206)
    +++ include/customedit.inc	(working copy)
    @@ -325,6 +325,14 @@
       end;
     end;
     
    +procedure TCustomEdit.CMBiDiModeChanged(var Message: TLMessage);
    +begin
    +  inherited;
    +  if (Message.wParam = 0) then
    +    RecreateWnd(Self);
    +  //i dont like RecreateWnd we must call a WSSet function to reset the Flags;
    +end;
    +
     {------------------------------------------------------------------------------
       Method:  TCustomEdit.RealSetText
       Params:  Override of text setup to watch for max length
    Index: include/wincontrol.inc
    ===================================================================
    --- include/wincontrol.inc	(revision 11206)
    +++ include/wincontrol.inc	(working copy)
    @@ -4668,6 +4668,12 @@
       NotifyControls(CM_PARENTSHOWHINTCHANGED);
     end;
     
    +procedure TWinControl.CMBiDiModeChanged(var Message: TLMessage);
    +begin
    +  inherited;
    +  NotifyControls(CM_PARENTBIDIMODECHANGED);
    +end;
    +
     {------------------------------------------------------------------------------
       Method: TWinControl.WMSetFocus
       Params: Message
    Index: interfaces/win32/win32wsbuttons.pp
    ===================================================================
    --- interfaces/win32/win32wsbuttons.pp	(revision 11206)
    +++ interfaces/win32/win32wsbuttons.pp	(working copy)
    @@ -101,6 +101,11 @@
           Flags := Flags or BS_DEFPUSHBUTTON
         else
           Flags := Flags or BS_PUSHBUTTON;
    +    with Params do {BidiMode}
    +    begin
    +      if AWinControl.UseRightToLeftReading then
    +        FlagsEx := FlagsEx or WS_EX_RTLREADING;
    +    end;
         pClassName := 'BUTTON';
         WindowTitle := StrCaption;
       end;
    Index: interfaces/win32/win32wsforms.pp
    ===================================================================
    --- interfaces/win32/win32wsforms.pp	(revision 11206)
    +++ interfaces/win32/win32wsforms.pp	(working copy)
    @@ -245,6 +245,13 @@
            ( not (csDesigning in lForm.ComponentState) and
             (lForm.ShowInTaskBar = stAlways)) then
           Parent := 0;
    +    with Params do {BidiMode}
    +    begin
    +      if AWinControl.UseRightToLeftAlignment then
    +        FlagsEx := FlagsEx or WS_EX_LEFTSCROLLBAR or WS_EX_RIGHT;
    +      if AWinControl.UseRightToLeftReading then
    +        FlagsEx := FlagsEx or WS_EX_RTLREADING ;
    +    end;
       end;
       // create window
       FinishCreateWindow(AWinControl, Params, false);
    Index: interfaces/win32/win32wsstdctrls.pp
    ===================================================================
    --- interfaces/win32/win32wsstdctrls.pp	(revision 11206)
    +++ interfaces/win32/win32wsstdctrls.pp	(working copy)
    @@ -873,6 +873,13 @@
         pClassName := 'EDIT';
         WindowTitle := StrCaption;
         Flags := Flags or ES_AUTOHSCROLL;
    +    with Params do {BidiMode}
    +    begin
    +      if AWinControl.UseRightToLeftAlignment then
    +        FlagsEx := FlagsEx or WS_EX_LEFTSCROLLBAR or WS_EX_RIGHT;
    +      if AWinControl.UseRightToLeftReading then
    +        FlagsEx := FlagsEx or WS_EX_RTLREADING ;
    +    end;
       end;
       // create window
       FinishCreateWindow(AWinControl, Params, false);
    Index: stdctrls.pp
    ===================================================================
    --- stdctrls.pp	(revision 11206)
    +++ stdctrls.pp	(working copy)
    @@ -647,6 +647,7 @@
         procedure SetModified(Value: Boolean);
         procedure SetPasswordChar(const AValue: Char);
         procedure SetReadOnly(Value: Boolean);
    +    procedure CMBiDiModeChanged(var Message: TLMessage); message CM_BIDIMODECHANGED;
       protected
         procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer;
                                          WithThemeSpace: Boolean); override;
    @@ -776,6 +777,7 @@
         property Anchors;
         property AutoSize;
         property AutoSelect;
    +    property BidiMode;
         property BorderSpacing;
         property Color;
         property Constraints;
    @@ -786,6 +788,7 @@
         property Enabled;
         property Font;
         property MaxLength;
    +    property ParentBidiMode;
         property OnChange;
         property OnChangeBounds;
         property OnClick;
    @@ -823,6 +826,7 @@
         property Align;
         property Alignment;
         property Anchors;
    +    property BidiMode;
         property BorderSpacing;
         property Color;
         property Constraints;
    @@ -832,6 +836,7 @@
         property Font;
         property Lines;
         property MaxLength;
    +    property ParentBidiMode;
         property OnChange;
         property OnClick;
         property OnDblClick;
    

Activities

2007-05-26 17:19

 

add_bidimode_property.patch (13,102 bytes)
Index: buttons.pp
===================================================================
--- buttons.pp	(revision 11206)
+++ buttons.pp	(working copy)
@@ -74,6 +74,7 @@
     procedure CMUIActivate(var Message: TLMessage); message CM_UIACTIVATE;
     procedure WMDefaultClicked(var Message: TLMessage); message LM_CLICKED;
     procedure WMKillFocus(var Message: TLMKillFocus); message LM_KILLFOCUS;
+    procedure CMBiDiModeChanged(var Message: TLMessage); message CM_BIDIMODECHANGED;
   protected
     procedure Click; override;
     procedure CreateWnd; override;
@@ -112,6 +113,7 @@
     property Align;
     property Anchors;
     property AutoSize;
+    property BidiMode;
     property BorderSpacing;
     property Cancel;
     property Caption;
@@ -122,6 +124,7 @@
     property DragMode;
     property Enabled;
     property Font;
+    property ParentBidiMode;
     property ModalResult;
     property OnChangeBounds;
     property OnClick;
Index: controls.pp
===================================================================
--- controls.pp	(revision 11206)
+++ controls.pp	(working copy)
@@ -1282,6 +1282,22 @@
     property TBDockHeight: Integer read GetTBDockHeight write FTBDockHeight;
     property UndockHeight: Integer read GetUndockHeight write FUndockHeight;// Height used when undocked
     property UndockWidth: Integer read GetUndockWidth write FUndockWidth;// Width used when undocked
+  private
+    //BidiMode property, RightToLeft
+    FBiDiMode: TBiDiMode;
+    FParentBiDiMode: Boolean;
+    function IsBiDiModeStored: boolean;
+    procedure SetBiDiMode(const AValue: TBiDiMode);
+    procedure SetParentBiDiMode(const AValue: Boolean);
+    procedure CMBiDiModeChanged(var Message: TLMessage); message CM_BIDIMODECHANGED;
+    procedure CMParentBiDiModeChanged(var Message: TLMessage); message CM_PARENTBIDIMODECHANGED;
+  public
+    function UseRightToLeftAlignment: Boolean; virtual;
+    function UseRightToLeftReading: Boolean; virtual;
+    function UseRightToLeftScrollBar: Boolean;
+    function IsRightToLeft: Boolean;
+    property BiDiMode: TBiDiMode read FBiDiMode write SetBiDiMode stored IsBiDiModeStored default bdLeftToRight;
+    property ParentBiDiMode: Boolean read FParentBiDiMode write SetParentBiDiMode default True;
   published
     property AnchorSideLeft: TAnchorSide index 0 read GetAnchorSideIndex write SetAnchorSideIndex;
     property AnchorSideTop: TAnchorSide index 1 read GetAnchorSideIndex write SetAnchorSideIndex;
@@ -1586,6 +1602,7 @@
     // messages
     procedure CMEnabledChanged(var Message: TLMessage); message CM_ENABLEDCHANGED;
     procedure CMShowHintChanged(var Message: TLMessage); message CM_SHOWHINTCHANGED;
+    procedure CMBiDiModeChanged(var Message: TLMessage); message CM_BIDIMODECHANGED;
     procedure WMEraseBkgnd(var Message: TLMEraseBkgnd); message LM_ERASEBKGND;
     procedure WMNotify(var Message: TLMNotify); message LM_NOTIFY;
     procedure WMSetFocus(var Message: TLMSetFocus); message LM_SETFOCUS;
Index: forms.pp
===================================================================
--- forms.pp	(revision 11206)
+++ forms.pp	(working copy)
@@ -185,7 +185,7 @@
     property AutoSize;
     //property AutoScroll;
     property BorderSpacing;
-    //property BiDiMode;
+    property BiDiMode;
     property BorderStyle;
     property ChildSizing;
     property Constraints;
@@ -198,7 +198,7 @@
     property Color nodefault;
     property Ctl3D;
     property Font;
-    //property ParentBiDiMode;
+    property ParentBiDiMode;
     property ParentColor;
     property ParentCtl3D;
     property ParentFont;
@@ -571,6 +571,7 @@
     property ActiveControl;
     property Align;
     property AutoSize;
+    property BiDiMode;
     property BorderIcons;
     property BorderStyle;
     property Caption;
@@ -617,6 +618,7 @@
     property OnStartDock;
     property OnUnDock;
     property OnUTF8KeyPress;
+    property ParentBiDiMode;
     property ParentFont;
     property PixelsPerInch;
     property PopupMenu;
Index: include/buttons.inc
===================================================================
--- include/buttons.inc	(revision 11206)
+++ include/buttons.inc	(working copy)
@@ -258,6 +258,14 @@
   end;
 end;
 
+procedure TCustomButton.CMBiDiModeChanged(var Message: TLMessage);
+begin
+  inherited;
+  if (Message.wParam = 0) then
+    RecreateWnd(Self);
+  //i dont like RecreateWnd we must call a WSSet function to reset the Flags;
+end;
+
 procedure TCustomButton.RealSetText(const Value: TCaption);
 var
   ParseStr : String;
Index: include/control.inc
===================================================================
--- include/control.inc	(revision 11206)
+++ include/control.inc	(working copy)
@@ -2631,6 +2631,11 @@
       Font := Parent.Font;
       ParentFont := true;
     end;
+
+    if ParentBidiMode then begin
+      BiDiMode := Parent.BiDiMode;
+      ParentBidiMode := true;
+    end;
   end;
 
   UpdateBaseBounds(true,true,true);
@@ -3690,6 +3695,7 @@
   FHelpType := htContext;
   FDragCursor := crDrag;
   FFloatingDockSiteClass := TCustomDockForm;
+  FParentBidiMode := True;
   //DebugLn('TControl.Create END ',Name,':',ClassName);
 end;
 
@@ -4134,7 +4140,103 @@
   SetBoundsKeepBase(Message.XPos, Message.YPos, Width, Height,Parent<>nil);
 end;
 
+{------------------------------------------------------------------------------
+   Method:  TControl.SetBiDiMode
+ ------------------------------------------------------------------------------}
 
+procedure TControl.SetBiDiMode(const AValue: TBiDiMode);
+begin
+  if FBiDiMode=AValue then exit;
+  FBiDiMode:=AValue;
+  FParentBiDiMode := False;
+  Perform(CM_BIDIMODECHANGED, 0, 0);
+end;
+
+{------------------------------------------------------------------------------
+   Method:  TControl.SetParentBiDiMode
+ ------------------------------------------------------------------------------}
+
+procedure TControl.SetParentBiDiMode(const AValue: Boolean);
+begin
+  if FParentBiDiMode=AValue then exit;
+  FParentBiDiMode:=AValue;
+  if (FParent <> nil) and not (csReading in ComponentState) then
+    Perform(CM_PARENTBIDIMODECHANGED, 0, 0);
+end;
+
+{------------------------------------------------------------------------------
+   Method:  TControl.CMBiDiModeChanged
+ ------------------------------------------------------------------------------}
+
+procedure TControl.CMBiDiModeChanged(var Message: TLMessage);
+begin
+  if (Message.wParam = 0) then
+    Invalidate;
+end;
+
+{------------------------------------------------------------------------------
+       TControl.CMParentBidiModeChanged
+
+       assumes: FParent <> nil
+------------------------------------------------------------------------------}
+
+procedure TControl.CMParentBidiModeChanged(var Message: TLMessage);
+begin
+  if csLoading in ComponentState then exit;
+
+  if FParentBidiMode then
+  begin
+    if FParent <> nil then
+      BidiMode := FParent.BidiMode;
+    FParentBidiMode := true;
+  end;
+end;
+
+{------------------------------------------------------------------------------
+       TControl.IsBiDiModeStored
+------------------------------------------------------------------------------}
+function TControl.IsBiDiModeStored: boolean;
+begin
+  Result := not FParentBidiMode;
+end;
+
+
+{------------------------------------------------------------------------------
+       TControl.IsRightToLeft
+------------------------------------------------------------------------------}
+
+function TControl.IsRightToLeft: Boolean;
+begin
+  Result := UseRightToLeftReading;
+end;
+
+{------------------------------------------------------------------------------
+       TControl.UseRightToLeftAlignment
+------------------------------------------------------------------------------}
+
+function TControl.UseRightToLeftAlignment: Boolean;
+begin
+  Result := (BiDiMode = bdRightToLeft);
+end;
+
+{------------------------------------------------------------------------------
+       TControl.UseRightToLeftReading
+------------------------------------------------------------------------------}
+
+function TControl.UseRightToLeftReading: Boolean;
+begin
+  Result := (BiDiMode <> bdLeftToRight);
+end;
+
+{------------------------------------------------------------------------------
+       TControl.UseRightToLeftScrollBar
+------------------------------------------------------------------------------}
+
+function TControl.UseRightToLeftScrollBar: Boolean;
+begin
+  Result := (BiDiMode in [bdRightToLeft, bdRightToLeftNoAlign]);
+end;
+
 {$IFDEF ASSERT_IS_ON}
   {$UNDEF ASSERT_IS_ON}
   {$C-}
Index: include/customedit.inc
===================================================================
--- include/customedit.inc	(revision 11206)
+++ include/customedit.inc	(working copy)
@@ -325,6 +325,14 @@
   end;
 end;
 
+procedure TCustomEdit.CMBiDiModeChanged(var Message: TLMessage);
+begin
+  inherited;
+  if (Message.wParam = 0) then
+    RecreateWnd(Self);
+  //i dont like RecreateWnd we must call a WSSet function to reset the Flags;
+end;
+
 {------------------------------------------------------------------------------
   Method:  TCustomEdit.RealSetText
   Params:  Override of text setup to watch for max length
Index: include/wincontrol.inc
===================================================================
--- include/wincontrol.inc	(revision 11206)
+++ include/wincontrol.inc	(working copy)
@@ -4668,6 +4668,12 @@
   NotifyControls(CM_PARENTSHOWHINTCHANGED);
 end;
 
+procedure TWinControl.CMBiDiModeChanged(var Message: TLMessage);
+begin
+  inherited;
+  NotifyControls(CM_PARENTBIDIMODECHANGED);
+end;
+
 {------------------------------------------------------------------------------
   Method: TWinControl.WMSetFocus
   Params: Message
Index: interfaces/win32/win32wsbuttons.pp
===================================================================
--- interfaces/win32/win32wsbuttons.pp	(revision 11206)
+++ interfaces/win32/win32wsbuttons.pp	(working copy)
@@ -101,6 +101,11 @@
       Flags := Flags or BS_DEFPUSHBUTTON
     else
       Flags := Flags or BS_PUSHBUTTON;
+    with Params do {BidiMode}
+    begin
+      if AWinControl.UseRightToLeftReading then
+        FlagsEx := FlagsEx or WS_EX_RTLREADING;
+    end;
     pClassName := 'BUTTON';
     WindowTitle := StrCaption;
   end;
Index: interfaces/win32/win32wsforms.pp
===================================================================
--- interfaces/win32/win32wsforms.pp	(revision 11206)
+++ interfaces/win32/win32wsforms.pp	(working copy)
@@ -245,6 +245,13 @@
        ( not (csDesigning in lForm.ComponentState) and
         (lForm.ShowInTaskBar = stAlways)) then
       Parent := 0;
+    with Params do {BidiMode}
+    begin
+      if AWinControl.UseRightToLeftAlignment then
+        FlagsEx := FlagsEx or WS_EX_LEFTSCROLLBAR or WS_EX_RIGHT;
+      if AWinControl.UseRightToLeftReading then
+        FlagsEx := FlagsEx or WS_EX_RTLREADING ;
+    end;
   end;
   // create window
   FinishCreateWindow(AWinControl, Params, false);
Index: interfaces/win32/win32wsstdctrls.pp
===================================================================
--- interfaces/win32/win32wsstdctrls.pp	(revision 11206)
+++ interfaces/win32/win32wsstdctrls.pp	(working copy)
@@ -873,6 +873,13 @@
     pClassName := 'EDIT';
     WindowTitle := StrCaption;
     Flags := Flags or ES_AUTOHSCROLL;
+    with Params do {BidiMode}
+    begin
+      if AWinControl.UseRightToLeftAlignment then
+        FlagsEx := FlagsEx or WS_EX_LEFTSCROLLBAR or WS_EX_RIGHT;
+      if AWinControl.UseRightToLeftReading then
+        FlagsEx := FlagsEx or WS_EX_RTLREADING ;
+    end;
   end;
   // create window
   FinishCreateWindow(AWinControl, Params, false);
Index: stdctrls.pp
===================================================================
--- stdctrls.pp	(revision 11206)
+++ stdctrls.pp	(working copy)
@@ -647,6 +647,7 @@
     procedure SetModified(Value: Boolean);
     procedure SetPasswordChar(const AValue: Char);
     procedure SetReadOnly(Value: Boolean);
+    procedure CMBiDiModeChanged(var Message: TLMessage); message CM_BIDIMODECHANGED;
   protected
     procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer;
                                      WithThemeSpace: Boolean); override;
@@ -776,6 +777,7 @@
     property Anchors;
     property AutoSize;
     property AutoSelect;
+    property BidiMode;
     property BorderSpacing;
     property Color;
     property Constraints;
@@ -786,6 +788,7 @@
     property Enabled;
     property Font;
     property MaxLength;
+    property ParentBidiMode;
     property OnChange;
     property OnChangeBounds;
     property OnClick;
@@ -823,6 +826,7 @@
     property Align;
     property Alignment;
     property Anchors;
+    property BidiMode;
     property BorderSpacing;
     property Color;
     property Constraints;
@@ -832,6 +836,7 @@
     property Font;
     property Lines;
     property MaxLength;
+    property ParentBidiMode;
     property OnChange;
     property OnClick;
     property OnDblClick;

Paul Ishenin

2007-05-28 11:07

manager   ~0012832

Last edited: 2007-05-28 11:19

Applied with changes

Issue History

Date Modified Username Field Change
2007-05-26 17:19 Zaher Dirkey New Issue
2007-05-26 17:19 Zaher Dirkey File Added: add_bidimode_property.patch
2007-05-26 17:19 Zaher Dirkey Widgetset => Win32
2007-05-26 17:35 Paul Ishenin LazTarget => 0.9.26
2007-05-26 17:35 Paul Ishenin Status new => acknowledged
2007-05-28 11:07 Paul Ishenin Fixed in Revision => 11029
2007-05-28 11:07 Paul Ishenin Status acknowledged => resolved
2007-05-28 11:07 Paul Ishenin Fixed in Version => 0.9.23 (SVN)
2007-05-28 11:07 Paul Ishenin Resolution open => fixed
2007-05-28 11:07 Paul Ishenin Assigned To => Paul Ishenin
2007-05-28 11:07 Paul Ishenin Note Added: 0012832
2007-05-28 11:19 Vincent Snijders Note Edited: 0012832
2007-05-28 11:19 Vincent Snijders Note Edited: 0012832
2007-09-02 00:22 Marc Weustink Status resolved => closed
2010-01-25 23:17 Zaher Dirkey Tag Attached: bidi