From: <ob...@us...> - 2012-06-13 08:53:26
|
Revision: 13340 http://jvcl.svn.sourceforge.net/jvcl/?rev=13340&view=rev Author: obones Date: 2012-06-13 08:53:16 +0000 (Wed, 13 Jun 2012) Log Message: ----------- Mantis 5888: Must set the Default property for the given button or the form will not give it focus. Also, must use RTL200_UP in the IFDEF as the move to TCustomButton occured in the RTL and has stayed throughout successive versions. If not, all "is" code will return false and many functionalities will stop working. Modified Paths: -------------- trunk/jvcl/run/JvDSADialogs.pas Modified: trunk/jvcl/run/JvDSADialogs.pas =================================================================== --- trunk/jvcl/run/JvDSADialogs.pas 2012-06-13 08:26:12 UTC (rev 13339) +++ trunk/jvcl/run/JvDSADialogs.pas 2012-06-13 08:53:16 UTC (rev 13340) @@ -51,9 +51,9 @@ FTimer: TTimer; FCountdown: IJvDynControlCaption; FMsg: string; - FDefaultButton: {$IFDEF DELPHI12}TCustomButton{$ELSE}TButton{$ENDIF}; + FDefaultButton: {$IFDEF RTL200_UP}TCustomButton{$ELSE}TButton{$ENDIF}; protected - property DefaultButton: {$IFDEF DELPHI12}TCustomButton{$ELSE}TButton{$ENDIF} read FDefaultButton write FDefaultButton ; + property DefaultButton: {$IFDEF RTL200_UP}TCustomButton{$ELSE}TButton{$ENDIF} read FDefaultButton write FDefaultButton ; procedure CustomKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure CustomMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure CustomShow(Sender: TObject); @@ -570,8 +570,8 @@ WriteToClipboard(GetFormText); end; if Key = VK_RETURN then - if ActiveControl is {$IFDEF DELPHI12}TCustomButton{$ELSE}TButton{$ENDIF} then - {$IFDEF DELPHI12}TCustomButton{$ELSE}TButton{$ENDIF}(ActiveControl).Click + if ActiveControl is {$IFDEF RTL200_UP}TCustomButton{$ELSE}TButton{$ENDIF} then + {$IFDEF RTL200_UP}TCustomButton{$ELSE}TButton{$ENDIF}(ActiveControl).Click else if Assigned(DefaultButton) then DefaultButton.Click; end; @@ -586,16 +586,16 @@ var I: Integer; First : Boolean; - Btn : {$IFDEF DELPHI12}TCustomButton{$ELSE}TButton{$ENDIF}; + Btn : {$IFDEF RTL200_UP}TCustomButton{$ELSE}TButton{$ENDIF}; begin if Timeout <> 0 then FTimer.Enabled := True; First := True; for I := 0 to ComponentCount - 1 do begin - if (Components[i] is {$IFDEF DELPHI12}TCustomButton{$ELSE}TButton{$ENDIF}) then + if (Components[i] is {$IFDEF RTL200_UP}TCustomButton{$ELSE}TButton{$ENDIF}) then begin - Btn := (Components[i] as {$IFDEF DELPHI12}TCustomButton{$ELSE}TButton{$ENDIF}); + Btn := (Components[i] as {$IFDEF RTL200_UP}TCustomButton{$ELSE}TButton{$ENDIF}); if First then begin First := False; @@ -629,9 +629,9 @@ FTimer.Enabled := False; for I := 0 to ComponentCount - 1 do begin - if (Components[i] is {$IFDEF DELPHI12}TCustomButton{$ELSE}TButton{$ENDIF}) and (Components[i] as {$IFDEF DELPHI12}TCustomButton{$ELSE}TButton{$ENDIF}).Default then + if (Components[i] is {$IFDEF RTL200_UP}TCustomButton{$ELSE}TButton{$ENDIF}) and (Components[i] as {$IFDEF RTL200_UP}TCustomButton{$ELSE}TButton{$ENDIF}).Default then begin - (Components[i] as {$IFDEF DELPHI12}TCustomButton{$ELSE}TButton{$ENDIF}).Click; + (Components[i] as {$IFDEF RTL200_UP}TCustomButton{$ELSE}TButton{$ENDIF}).Click; Exit; end; end; @@ -685,7 +685,7 @@ begin DividerLine := StringOfChar('-', 27) + CrLf; for I := 0 to ComponentCount - 1 do - if Components[i] is {$IFDEF DELPHI12}TCustomButton{$ELSE}TButton{$ENDIF} then + if Components[i] is {$IFDEF RTL200_UP}TCustomButton{$ELSE}TButton{$ENDIF} then ButtonCaptions := ButtonCaptions + TButton(Components[i]).Caption + StringOfChar(' ', 3); ButtonCaptions := StringReplace(ButtonCaptions, '&', '', [rfReplaceAll]); Result := Format('%s%s%s%s%s%s%s%s%s%s', [DividerLine, Caption, CrLf, DividerLine, @@ -979,8 +979,10 @@ Button := DynControlEngine.CreateButton(ResultForm, BottomPanel, 'Button' + IntToStr(I), Buttons[I], '', nil, False, False); Button.ModalResult := Results[I]; if I = DefaultButton then + begin ResultForm.DefaultButton := Button; -// Button.Default := True; + Button.Default := True; + end; if I = CancelButton then Button.Cancel := True; Button.TabStop := True; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |