add new components TRxRadioGroup and TRxDBRadioGroup - allow disable any of RadioButton from group

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1993 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75 2011-09-23 22:37:57 +00:00
parent 5e72832f78
commit d4c63d5b73
6 changed files with 120 additions and 34 deletions

View File

@ -66,11 +66,12 @@
добавлено новое свойство KeyStrokes
+ Добавлен новый компонент RxCurredit
+ Добавлен новый компонент- TRxViewsPanel
+ у компоненты TRxMemoryData убрана зависимость от модуля Forms
+ Улучшено отображение редактора полей типа TDateTime/TDate в RxDBGrid
+ У TRxCollumn компоненты TRxDBGrid для стиля cbsPickList добавлено свойство DirectInput.
Если оно установлено в false - значения поля можно выбрать только из выпадающего списка
+ Добавлены 2 комопненты - TRxRadioGroup и TRxDBRadioGroup. В отличии от стнадартных позваляют выборочно запрещать некоторые RadioButton-ы на
компоненте через свойство ItemEnabled.
22.05.2008 - версия 2.0.0.136 (svn revision 100)
+ У объекта TRxCustomDBLookupCombo введён контроль на CircularDataLink
+ У объекта TRxCustomDBLookupCombo ускорена отрисовка данных

View File

@ -42,8 +42,8 @@ procedure Register;
implementation
uses
PropEdits, dbdateedit, dbcurredit, rxlookup, folderlister, duallist,
curredit, rxswitch, rxdice, rxdbcomb, rxtoolbar, rxxpman, PageMngr, RxAppIcon,
PropEdits, folderlister, duallist,
curredit, rxswitch, rxdice, rxtoolbar, rxxpman, PageMngr, RxAppIcon,
Dialogs, ComponentEditors, DBPropEdits, DB, rxctrls,
RxCustomChartPanel, AutoPanel, pickdate, rxconst, tooledit, rxclock,
rxceEditLookupFields, rxpopupunit, rxspin, RxTimeEdit,
@ -92,20 +92,6 @@ begin
RegisterComponents('RX',[TPageManager]);
end;
procedure RegisterUnitDBDateEdit;
begin
RegisterComponents('RX DBAware',[TDBDateEdit, TRxDBCalcEdit, TRxDBCurrEdit]);
end;
procedure RegisterRXLookup;
begin
RegisterComponents('RX DBAware',[TRXLookupEdit, TRxDBLookupCombo]);
end;
procedure RegisterRxDBComb;
begin
RegisterComponents('RX DBAware',[TRxDBComboBox]);
end;
procedure RegisterDualList;
begin
@ -139,7 +125,7 @@ end;
procedure RegisterRxCtrls;
begin
RegisterComponents('RX',[TRxLabel, TSecretPanel, TRxSpeedButton]);
RegisterComponents('RX',[TRxLabel, TSecretPanel, TRxSpeedButton, TRxRadioGroup]);
end;
@ -215,13 +201,7 @@ begin
RegisterUnit('RxAboutDialog', @RegisterRxAboutDialog);
RegisterUnit('RxViewsPanel', @RegisterRxViewsPanel);
//RX DBAware
RegisterUnit('dbdateedit', @RegisterUnitDBDateEdit);
RegisterUnit('rxlookup', @RegisterRXLookup);
RegisterUnit('rxdbcomb', @RegisterRxDBComb);
//
//
RegisterPropertyEditor(TypeInfo(string), TPopUpColumn, 'FieldName', TPopUpColumnFieldProperty);
RegisterCEEditLookupFields;
end;

View File

@ -41,7 +41,8 @@ uses
procedure Register;
implementation
uses DB, DBPropEdits, rxdbgrid, RxDBSpinEdit, RxDBTimeEdit, RxDBCtrls, rxmemds,
ComponentEditors, seldsfrm, PropEdits, RxDBColorBox;
ComponentEditors, seldsfrm, PropEdits, RxDBColorBox, dbdateedit, rxdbcomb,
rxlookup, dbcurredit;
type
@ -104,7 +105,7 @@ end;
procedure RegisterRxDBCtrls;
begin
RegisterComponents('RX DBAware',[TRxDBProgressBar, TRxDBTrackBar]);
RegisterComponents('RX DBAware',[TRxDBProgressBar, TRxDBTrackBar, TRxDBRadioGroup]);
end;
procedure RegisterRxDbGrid;
@ -122,8 +123,28 @@ begin
RegisterComponents('RX DBAware',[TRxDBColorBox]);
end;
procedure RegisterUnitDBDateEdit;
begin
RegisterComponents('RX DBAware',[TDBDateEdit, TRxDBCalcEdit, TRxDBCurrEdit]);
end;
procedure RegisterRXLookup;
begin
RegisterComponents('RX DBAware',[TRXLookupEdit, TRxDBLookupCombo]);
end;
procedure RegisterRxDBComb;
begin
RegisterComponents('RX DBAware',[TRxDBComboBox]);
end;
procedure Register;
begin
//RX DBAware
RegisterUnit('dbdateedit', @RegisterUnitDBDateEdit);
RegisterUnit('rxlookup', @RegisterRXLookup);
RegisterUnit('rxdbcomb', @RegisterRxDBComb);
RegisterUnit('RxDBTimeEdit', @RegisterRxDBTimeEdit);
RegisterUnit('RxDBSpinEdit', @RegisterRxDBSpinEdit);
RegisterUnit('RxDBCtrls', @RegisterRxDBCtrls);

View File

@ -797,14 +797,26 @@ function DrawShadowText(DC: HDC; Str: PChar; Count: Integer; var Rect: TRect;
function CheckBitmap: TBitmap;
*)
type
{ TRxDBRadioGroup }
{ TRxRadioGroup }
TRxRadioGroup = class(TRadioGroup)
private
function GetItemEnabled(Index: integer): boolean;
procedure SetItemEnabled(Index: integer; AValue: boolean);
public
property ItemEnabled[Index: integer]: boolean read GetItemEnabled write SetItemEnabled;
end;
implementation
uses SysUtils, Dialogs, {CommCtrl,} VCLUtils, Math, RxAppUtils, ImgList,
ActnList, InterfaceBase
(* Consts, {$IFDEF RX_D6}, RTLConsts{$ENDIF}
*)
;
uses SysUtils, Dialogs, VCLUtils, Math, RxAppUtils, ImgList,
ActnList, InterfaceBase;
const
Alignments: array [TAlignment] of Word = (DT_LEFT, DT_RIGHT, DT_CENTER);
WordWraps: array[Boolean] of Word = (0, DT_WORDBREAK);
@ -2541,6 +2553,32 @@ begin
UnionRect(Rect, RText, RShadow);
end;
{ TRxRadioGroup }
function TRxRadioGroup.GetItemEnabled(Index: integer): boolean;
var
R:TRadioButton;
begin
if (Index < -1) or (Index >= Items.Count) then
RaiseIndexOutOfBounds(Self, Items, Index);
R:=FindComponent('RadioButton'+IntToStr(Index)) as TRadioButton;
if Assigned(R) then
Result:=R.Enabled
else
Result:=False;
end;
procedure TRxRadioGroup.SetItemEnabled(Index: integer; AValue: boolean);
var
R:TRadioButton;
begin
if (Index < -1) or (Index >= Items.Count) then
RaiseIndexOutOfBounds(Self, Items, Index);
R:=FindComponent('RadioButton'+IntToStr(Index)) as TRadioButton;
if Assigned(R) then
R.Enabled:=AValue;
end;
constructor TRxCustomLabel.Create(AOwner: TComponent);
begin
inherited Create(AOwner);

View File

@ -194,8 +194,46 @@ type
property Visible;
end;
type
{ TRxDBRadioGroup }
TRxDBRadioGroup = class(TDBRadioGroup)
private
function GetItemEnabled(Index: integer): boolean;
procedure SetItemEnabled(Index: integer; AValue: boolean);
public
property ItemEnabled[Index: integer]: boolean read GetItemEnabled write SetItemEnabled;
end;
implementation
uses dbutils, LCLVersion;
uses dbutils, LCLVersion, vclutils, StdCtrls;
{ TRxDBRadioGroup }
function TRxDBRadioGroup.GetItemEnabled(Index: integer): boolean;
var
R:TRadioButton;
begin
if (Index < -1) or (Index >= Items.Count) then
RaiseIndexOutOfBounds(Self, Items, Index);
R:=FindComponent('RadioButton'+IntToStr(Index)) as TRadioButton;
if Assigned(R) then
Result:=R.Enabled
else
Result:=False;
end;
procedure TRxDBRadioGroup.SetItemEnabled(Index: integer; AValue: boolean);
var
R:TRadioButton;
begin
if (Index < -1) or (Index >= Items.Count) then
RaiseIndexOutOfBounds(Self, Items, Index);
R:=FindComponent('RadioButton'+IntToStr(Index)) as TRadioButton;
if Assigned(R) then
R.Enabled:=AValue;
end;
{ TCustomRxDBProgressBar }

View File

@ -74,6 +74,8 @@ function ReallocMemo(fpBlock: Pointer; Size: Longint): Pointer;
procedure FreeMemo(var fpBlock: Pointer);
}
procedure RaiseIndexOutOfBounds(Control: TControl; Items:TStrings; Index: integer);
{$IFDEF WIN32}
type
PCursorOrIcon = ^TCursorOrIcon;
@ -100,7 +102,7 @@ procedure OutOfResources;
{$ENDIF}
implementation
uses LCLProc, LCLIntf, LCLType;
uses LCLProc, LCLIntf, LCLType, LCLStrConsts;
function WidthOf(R: TRect): Integer;
begin
@ -650,6 +652,12 @@ begin
Canvas.Free;
end;
procedure RaiseIndexOutOfBounds(Control: TControl; Items:TStrings; Index: integer);
begin
raise Exception.CreateFmt(rsIndexOutOfBounds,
[Control.Name, Index, Items.Count - 1]);
end;
initialization
LazarusResources.Add('rxbtn_downarrow','XPM',[
'/* XPM */'#13#10'static char * btn_downarrow_xpm[] = {'#13#10'"5 3 2 1",'#13