minor fix in TRxDBLookupCombo, TRxLookupEdit. New procedure in rxstrutils

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@282 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2007-10-30 11:43:24 +00:00
parent d635a63cbb
commit aaf09b3fb1
16 changed files with 298 additions and 65 deletions

View File

@ -12,6 +12,8 @@
+ in RxDBGrid images of markers moved to rxdbgrids.lrs (Petr Smolik) + in RxDBGrid images of markers moved to rxdbgrids.lrs (Petr Smolik)
+ add module for autosort in RxDBGrid exsortzeos.pas for ZeosDB (Petr Smolik) + add module for autosort in RxDBGrid exsortzeos.pas for ZeosDB (Petr Smolik)
- In TCurrencyEdit property BorderSpacing now published - In TCurrencyEdit property BorderSpacing now published
+ New procedure StrToStrings in module rxstrutils - fill List:TStrings
procedure StrToStrings(const S:string; const List:TStrings; const Delims:Char);
29.08.2007 - ������ 1.1.5.98 (svn revision 39) 29.08.2007 - ������ 1.1.5.98 (svn revision 39)
+ In RxDBgrid - after close dataset list of SelectedRows is cleared + In RxDBgrid - after close dataset list of SelectedRows is cleared
+ fix resaizing find form for RxDbGrd + fix resaizing find form for RxDbGrd

View File

@ -15,6 +15,12 @@
+ � RxDBGrid ����������� �������� �������� � ������� (Petr Smolik) + � RxDBGrid ����������� �������� �������� � ������� (Petr Smolik)
+ �������� ������ �������������� ���������� � RxDBGrid exsortzeos.pas ��� ZeosDB (Petr Smolik) + �������� ������ �������������� ���������� � RxDBGrid exsortzeos.pas ��� ZeosDB (Petr Smolik)
- � TCurrencyEdit ������������ �������� BorderSpacing - � TCurrencyEdit ������������ �������� BorderSpacing
+ � ������ rxstrutils ��������� ��������� StrToStrings - ��������� ����� TStrings ��������
������������� � ������ S � ������������ �������� Delims
+ ���������� �������� ������� ��� ����� LookupField � LookupDisplay � ���������
TRxLookupEdit � TRxDBLookupCombo
+ TRxDBLookupCombo ����������� ��������� �������� AutoSize
+ ��� ��������� �������� Font � TRxDBLookupCombo ���������� ������ ���������� ���� �� �����
29.08.2007 - ������ 1.1.5.98 (svn revision 39) 29.08.2007 - ������ 1.1.5.98 (svn revision 39)
+ � RxDBGrid ����� �������� ������ ������ ������ ���������� ����� (SelectedRows) + � RxDBGrid ����� �������� ������ ������ ������ ���������� ����� (SelectedRows)
��������� ���������

View File

@ -10,4 +10,3 @@
| | | | | |
|-----------------| |-----------------|
3. TRxDbComboBox �� ��������� ���������� ��������� �������� �� ����

View File

@ -5,9 +5,12 @@ object DualListForm: TDualListForm
Width = 392 Width = 392
HorzScrollBar.Page = 391 HorzScrollBar.Page = 391
VertScrollBar.Page = 268 VertScrollBar.Page = 268
ActiveControl = SrcList
BorderIcons = [] BorderIcons = []
BorderStyle = bsDialog BorderStyle = bsDialog
Caption = 'DualListForm' Caption = 'DualListForm'
ClientHeight = 269
ClientWidth = 392
Font.Height = -11 Font.Height = -11
Font.Name = 'MS Sans Serif' Font.Name = 'MS Sans Serif'
Font.Style = [fsBold] Font.Style = [fsBold]
@ -27,7 +30,6 @@ object DualListForm: TDualListForm
Top = 12 Top = 12
Width = 34 Width = 34
Caption = 'Source' Caption = 'Source'
Color = clNone
ParentColor = False ParentColor = False
end end
object DstLabel: TLabel object DstLabel: TLabel
@ -36,7 +38,6 @@ object DualListForm: TDualListForm
Top = 12 Top = 12
Width = 23 Width = 23
Caption = 'Dest' Caption = 'Dest'
Color = clNone
ParentColor = False ParentColor = False
end end
object SrcList: TListBox object SrcList: TListBox
@ -74,6 +75,7 @@ object DualListForm: TDualListForm
Height = 26 Height = 26
Top = 32 Top = 32
Width = 26 Width = 26
BorderSpacing.InnerBorder = 4
Caption = '>' Caption = '>'
Font.Color = clBlack Font.Color = clBlack
Font.Height = -12 Font.Height = -12
@ -87,6 +89,7 @@ object DualListForm: TDualListForm
Height = 26 Height = 26
Top = 64 Top = 64
Width = 26 Width = 26
BorderSpacing.InnerBorder = 4
Caption = '>>' Caption = '>>'
Font.Color = clBlack Font.Color = clBlack
Font.Height = -12 Font.Height = -12
@ -100,6 +103,7 @@ object DualListForm: TDualListForm
Height = 26 Height = 26
Top = 97 Top = 97
Width = 26 Width = 26
BorderSpacing.InnerBorder = 4
Caption = '<' Caption = '<'
Font.Color = clBlack Font.Color = clBlack
Font.Height = -12 Font.Height = -12
@ -113,6 +117,7 @@ object DualListForm: TDualListForm
Height = 26 Height = 26
Top = 129 Top = 129
Width = 26 Width = 26
BorderSpacing.InnerBorder = 4
Caption = '<<' Caption = '<<'
Font.Color = clBlack Font.Color = clBlack
Font.Height = -12 Font.Height = -12
@ -126,6 +131,7 @@ object DualListForm: TDualListForm
Height = 25 Height = 25
Top = 239 Top = 239
Width = 77 Width = 77
BorderSpacing.InnerBorder = 4
Caption = 'OK' Caption = 'OK'
Default = True Default = True
ModalResult = 1 ModalResult = 1
@ -136,6 +142,7 @@ object DualListForm: TDualListForm
Height = 25 Height = 25
Top = 239 Top = 239
Width = 77 Width = 77
BorderSpacing.InnerBorder = 4
Cancel = True Cancel = True
Caption = 'Cancel' Caption = 'Cancel'
ModalResult = 2 ModalResult = 2
@ -146,6 +153,7 @@ object DualListForm: TDualListForm
Height = 25 Height = 25
Top = 239 Top = 239
Width = 77 Width = 77
BorderSpacing.InnerBorder = 4
Caption = 'Help' Caption = 'Help'
OnClick = HelpBtnClick OnClick = HelpBtnClick
TabOrder = 8 TabOrder = 8

View File

@ -3,41 +3,44 @@
LazarusResources.Add('TDualListForm','FORMDATA',[ LazarusResources.Add('TDualListForm','FORMDATA',[
'TPF0'#13'TDualListForm'#12'DualListForm'#4'Left'#3'7'#1#6'Height'#3#13#1#3'T' 'TPF0'#13'TDualListForm'#12'DualListForm'#4'Left'#3'7'#1#6'Height'#3#13#1#3'T'
+'op'#3#225#0#5'Width'#3#136#1#18'HorzScrollBar.Page'#3#135#1#18'VertScrollBa' +'op'#3#225#0#5'Width'#3#136#1#18'HorzScrollBar.Page'#3#135#1#18'VertScrollBa'
+'r.Page'#3#12#1#11'BorderIcons'#11#0#11'BorderStyle'#7#8'bsDialog'#7'Caption' +'r.Page'#3#12#1#13'ActiveControl'#7#7'SrcList'#11'BorderIcons'#11#0#11'Borde'
+#6#12'DualListForm'#11'Font.Height'#2#245#9'Font.Name'#6#13'MS Sans Serif'#10 +'rStyle'#7#8'bsDialog'#7'Caption'#6#12'DualListForm'#12'ClientHeight'#3#13#1
+'Font.Style'#11#6'fsBold'#0#10'OnActivate'#7#9'ListClick'#8'OnCreate'#7#10'F' +#11'ClientWidth'#3#136#1#11'Font.Height'#2#245#9'Font.Name'#6#13'MS Sans Ser'
+'ormCreate'#6'OnShow'#7#9'ListClick'#8'Position'#7#14'poScreenCenter'#0#6'TB' +'if'#10'Font.Style'#11#6'fsBold'#0#10'OnActivate'#7#9'ListClick'#8'OnCreate'
+'evel'#6'Bevel1'#4'Left'#2#4#6'Height'#3#224#0#3'Top'#2#7#5'Width'#3#128#1#0 +#7#10'FormCreate'#6'OnShow'#7#9'ListClick'#8'Position'#7#14'poScreenCenter'#0
+#0#6'TLabel'#8'SrcLabel'#4'Left'#2#12#6'Height'#2#14#3'Top'#2#12#5'Width'#2 +#6'TBevel'#6'Bevel1'#4'Left'#2#4#6'Height'#3#224#0#3'Top'#2#7#5'Width'#3#128
+'"'#7'Caption'#6#6'Source'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6'TLab' +#1#0#0#6'TLabel'#8'SrcLabel'#4'Left'#2#12#6'Height'#2#14#3'Top'#2#12#5'Width'
+'el'#8'DstLabel'#4'Left'#3#216#0#6'Height'#2#14#3'Top'#2#12#5'Width'#2#23#7 +#2'"'#7'Caption'#6#6'Source'#11'ParentColor'#8#0#0#6'TLabel'#8'DstLabel'#4'L'
+'Caption'#6#4'Dest'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#8'TListBox'#7 +'eft'#3#216#0#6'Height'#2#14#3'Top'#2#12#5'Width'#2#23#7'Caption'#6#4'Dest'
+'SrcList'#4'Left'#2#12#6'Height'#3#194#0#3'Top'#2#30#5'Width'#3#164#0#10'Ite' +#11'ParentColor'#8#0#0#8'TListBox'#7'SrcList'#4'Left'#2#12#6'Height'#3#194#0
+'mHeight'#2#13#11'MultiSelect'#9#7'OnClick'#7#9'ListClick'#10'OnDblClick'#7 +#3'Top'#2#30#5'Width'#3#164#0#10'ItemHeight'#2#13#11'MultiSelect'#9#7'OnClic'
+#11'IncBtnClick'#9'OnKeyDown'#7#14'SrcListKeyDown'#14'ParentShowHint'#8#8'Sh' +'k'#7#9'ListClick'#10'OnDblClick'#7#11'IncBtnClick'#9'OnKeyDown'#7#14'SrcLis'
+'owHint'#9#6'Sorted'#9#8'TabOrder'#2#0#0#0#8'TListBox'#7'DstList'#4'Left'#3 +'tKeyDown'#14'ParentShowHint'#8#8'ShowHint'#9#6'Sorted'#9#8'TabOrder'#2#0#0#0
+#216#0#6'Height'#3#194#0#3'Top'#2#30#5'Width'#3#164#0#10'ItemHeight'#2#13#11 +#8'TListBox'#7'DstList'#4'Left'#3#216#0#6'Height'#3#194#0#3'Top'#2#30#5'Widt'
+'MultiSelect'#9#7'OnClick'#7#9'ListClick'#10'OnDblClick'#7#12'ExclBtnClick'#9 +'h'#3#164#0#10'ItemHeight'#2#13#11'MultiSelect'#9#7'OnClick'#7#9'ListClick'
+'OnKeyDown'#7#14'DstListKeyDown'#14'ParentShowHint'#8#8'ShowHint'#9#6'Sorted' +#10'OnDblClick'#7#12'ExclBtnClick'#9'OnKeyDown'#7#14'DstListKeyDown'#14'Pare'
+#9#8'TabOrder'#2#5#0#0#7'TButton'#6'IncBtn'#4'Left'#3#183#0#6'Height'#2#26#3 +'ntShowHint'#8#8'ShowHint'#9#6'Sorted'#9#8'TabOrder'#2#5#0#0#7'TButton'#6'In'
+'Top'#2' '#5'Width'#2#26#7'Caption'#6#1'>'#10'Font.Color'#7#7'clBlack'#11'Fo' +'cBtn'#4'Left'#3#183#0#6'Height'#2#26#3'Top'#2' '#5'Width'#2#26#25'BorderSpa'
+'nt.Height'#2#244#9'Font.Name'#6#13'MS Sans Serif'#10'Font.Style'#11#6'fsBol' +'cing.InnerBorder'#2#4#7'Caption'#6#1'>'#10'Font.Color'#7#7'clBlack'#11'Font'
+'d'#0#7'OnClick'#7#11'IncBtnClick'#8'TabOrder'#2#1#0#0#7'TButton'#9'IncAllBt'
+'n'#4'Left'#3#183#0#6'Height'#2#26#3'Top'#2'@'#5'Width'#2#26#7'Caption'#6#2
+'>>'#10'Font.Color'#7#7'clBlack'#11'Font.Height'#2#244#9'Font.Name'#6#13'MS '
+'Sans Serif'#10'Font.Style'#11#6'fsBold'#0#7'OnClick'#7#14'IncAllBtnClick'#8
+'TabOrder'#2#2#0#0#7'TButton'#7'ExclBtn'#4'Left'#3#183#0#6'Height'#2#26#3'To'
+'p'#2'a'#5'Width'#2#26#7'Caption'#6#1'<'#10'Font.Color'#7#7'clBlack'#11'Font'
+'.Height'#2#244#9'Font.Name'#6#13'MS Sans Serif'#10'Font.Style'#11#6'fsBold' +'.Height'#2#244#9'Font.Name'#6#13'MS Sans Serif'#10'Font.Style'#11#6'fsBold'
+#0#7'OnClick'#7#12'ExclBtnClick'#8'TabOrder'#2#3#0#0#7'TButton'#10'ExclAllBt' +#0#7'OnClick'#7#11'IncBtnClick'#8'TabOrder'#2#1#0#0#7'TButton'#9'IncAllBtn'#4
+'n'#4'Left'#3#183#0#6'Height'#2#26#3'Top'#3#129#0#5'Width'#2#26#7'Caption'#6 +'Left'#3#183#0#6'Height'#2#26#3'Top'#2'@'#5'Width'#2#26#25'BorderSpacing.Inn'
+#2'<<'#10'Font.Color'#7#7'clBlack'#11'Font.Height'#2#244#9'Font.Name'#6#13'M' +'erBorder'#2#4#7'Caption'#6#2'>>'#10'Font.Color'#7#7'clBlack'#11'Font.Height'
+'S Sans Serif'#10'Font.Style'#11#6'fsBold'#0#7'OnClick'#7#15'ExclAllBtnClick' +#2#244#9'Font.Name'#6#13'MS Sans Serif'#10'Font.Style'#11#6'fsBold'#0#7'OnCl'
+#8'TabOrder'#2#4#0#0#7'TButton'#5'OkBtn'#4'Left'#3#138#0#6'Height'#2#25#3'To' +'ick'#7#14'IncAllBtnClick'#8'TabOrder'#2#2#0#0#7'TButton'#7'ExclBtn'#4'Left'
+'p'#3#239#0#5'Width'#2'M'#7'Caption'#6#2'OK'#7'Default'#9#11'ModalResult'#2#1 +#3#183#0#6'Height'#2#26#3'Top'#2'a'#5'Width'#2#26#25'BorderSpacing.InnerBord'
+#8'TabOrder'#2#6#0#0#7'TButton'#9'CancelBtn'#4'Left'#3#221#0#6'Height'#2#25#3 +'er'#2#4#7'Caption'#6#1'<'#10'Font.Color'#7#7'clBlack'#11'Font.Height'#2#244
+'Top'#3#239#0#5'Width'#2'M'#6'Cancel'#9#7'Caption'#6#6'Cancel'#11'ModalResul' +#9'Font.Name'#6#13'MS Sans Serif'#10'Font.Style'#11#6'fsBold'#0#7'OnClick'#7
+'t'#2#2#8'TabOrder'#2#7#0#0#7'TButton'#7'HelpBtn'#4'Left'#3'6'#1#6'Height'#2 +#12'ExclBtnClick'#8'TabOrder'#2#3#0#0#7'TButton'#10'ExclAllBtn'#4'Left'#3#183
+#25#3'Top'#3#239#0#5'Width'#2'M'#7'Caption'#6#4'Help'#7'OnClick'#7#12'HelpBt' +#0#6'Height'#2#26#3'Top'#3#129#0#5'Width'#2#26#25'BorderSpacing.InnerBorder'
+'nClick'#8'TabOrder'#2#8#0#0#0 +#2#4#7'Caption'#6#2'<<'#10'Font.Color'#7#7'clBlack'#11'Font.Height'#2#244#9
+'Font.Name'#6#13'MS Sans Serif'#10'Font.Style'#11#6'fsBold'#0#7'OnClick'#7#15
+'ExclAllBtnClick'#8'TabOrder'#2#4#0#0#7'TButton'#5'OkBtn'#4'Left'#3#138#0#6
+'Height'#2#25#3'Top'#3#239#0#5'Width'#2'M'#25'BorderSpacing.InnerBorder'#2#4
+#7'Caption'#6#2'OK'#7'Default'#9#11'ModalResult'#2#1#8'TabOrder'#2#6#0#0#7'T'
+'Button'#9'CancelBtn'#4'Left'#3#221#0#6'Height'#2#25#3'Top'#3#239#0#5'Width'
+#2'M'#25'BorderSpacing.InnerBorder'#2#4#6'Cancel'#9#7'Caption'#6#6'Cancel'#11
+'ModalResult'#2#2#8'TabOrder'#2#7#0#0#7'TButton'#7'HelpBtn'#4'Left'#3'6'#1#6
+'Height'#2#25#3'Top'#3#239#0#5'Width'#2'M'#25'BorderSpacing.InnerBorder'#2#4
+#7'Caption'#6#4'Help'#7'OnClick'#7#12'HelpBtnClick'#8'TabOrder'#2#8#0#0#0
]); ]);

View File

@ -138,20 +138,20 @@ procedure TDualListForm.SrcListDragOver(Sender, Source: TObject; X,
Y: Integer; State: TDragState; var Accept: Boolean); Y: Integer; State: TDragState; var Accept: Boolean);
begin begin
BoxDragOver(SrcList, Source, X, Y, State, Accept, SrcList.Sorted); BoxDragOver(SrcList, Source, X, Y, State, Accept, SrcList.Sorted);
{ if State = dsDragLeave then if State = dsDragLeave then
(Source as TListBox).DragCursor := crDrag; (Source as TListBox).DragCursor := crDrag;
if (State = dsDragEnter) and ((Source as TListBox).SelCount > 1) then if (State = dsDragEnter) and ((Source as TListBox).SelCount > 1) then
(Source as TListBox).DragCursor := crMultiDrag;} (Source as TListBox).DragCursor := crMultiDrag;
end; end;
procedure TDualListForm.DstListDragOver(Sender, Source: TObject; X, procedure TDualListForm.DstListDragOver(Sender, Source: TObject; X,
Y: Integer; State: TDragState; var Accept: Boolean); Y: Integer; State: TDragState; var Accept: Boolean);
begin begin
BoxDragOver(DstList, Source, X, Y, State, Accept, DstList.Sorted); BoxDragOver(DstList, Source, X, Y, State, Accept, DstList.Sorted);
{ if State = dsDragLeave then if State = dsDragLeave then
(Source as TListBox).DragCursor := crDrag; (Source as TListBox).DragCursor := crDrag;
if (State = dsDragEnter) and ((Source as TListBox).SelCount > 1) then if (State = dsDragEnter) and ((Source as TListBox).SelCount > 1) then
(Source as TListBox).DragCursor := crMultiDrag;} (Source as TListBox).DragCursor := crMultiDrag;
end; end;
procedure TDualListForm.SrcListDragDrop(Sender, Source: TObject; X, procedure TDualListForm.SrcListDragDrop(Sender, Source: TObject; X,
@ -209,9 +209,9 @@ end;
procedure TDualListForm.FormCreate(Sender: TObject); procedure TDualListForm.FormCreate(Sender: TObject);
begin begin
{ OkBtn.Caption := ResStr(SOKButton); { OkBtn.Caption := SOKButton;
CancelBtn.Caption := ResStr(SCancelButton); CancelBtn.Caption := SCancelButton;
HelpBtn.Caption := ResStr(SHelpButton);} HelpBtn.Caption := SHelpButton;}
if NewStyleControls then Font.Style := []; if NewStyleControls then Font.Style := [];
end; end;

View File

@ -10,10 +10,12 @@ uses
procedure Register; procedure Register;
implementation implementation
uses PropEdits, dbdateedit, rxlookup, folderlister, rxdbgrid, rxmemds, duallist, uses
PropEdits, dbdateedit, rxlookup, folderlister, rxdbgrid, rxmemds, duallist,
curredit, rxswitch, rxdice, rxdbcomb, rxtoolbar, rxxpman, PageMngr, RxAppIcon, curredit, rxswitch, rxdice, rxdbcomb, rxtoolbar, rxxpman, PageMngr, RxAppIcon,
Dialogs, ComponentEditors, seldsfrm, DBPropEdits, DB, rxctrls, RxLogin, Dialogs, ComponentEditors, seldsfrm, DBPropEdits, DB, rxctrls, RxLogin,
RxCustomChartPanel, AutoPanel, pickdate, rxconst, tooledit; RxCustomChartPanel, AutoPanel, pickdate, rxconst, tooledit,
rxceEditLookupFields;
type type
@ -253,6 +255,7 @@ begin
RegisterComponentEditor(TRxMemoryData, TMemDataSetEditor); RegisterComponentEditor(TRxMemoryData, TMemDataSetEditor);
// //
RegisterPropertyEditor(TypeInfo(string), TRxColumn, 'FieldName', TRxDBGridFieldProperty); RegisterPropertyEditor(TypeInfo(string), TRxColumn, 'FieldName', TRxDBGridFieldProperty);
RegisterCEEditLookupFields;
end; end;
initialization initialization

View File

@ -6,3 +6,5 @@
{.$DEFINE ENABLE_Child_Defs} {.$DEFINE ENABLE_Child_Defs}
{$DEFINE NEW_STYLE_TITLE_ALIGNMENT_RXDBGRID} {$DEFINE NEW_STYLE_TITLE_ALIGNMENT_RXDBGRID}
{$DEFINE RXDBGRID_OPTIONS_WO_CANCEL_ON_EXIT} {$DEFINE RXDBGRID_OPTIONS_WO_CANCEL_ON_EXIT}
{.$DEFINE USED_BiDi}
{$DEFINE DEFAULT_POPUP_CALENDAR}

View File

@ -35,8 +35,10 @@ type
implementation implementation
{$IFDEF WIN32} {$IFDEF WIN32}
{$IFNDEF LCLGtk2}
uses Windows, win32int, InterfaceBase, vclutils; uses Windows, win32int, InterfaceBase, vclutils;
{$ENDIF} {$ENDIF}
{$ENDIF}
{ TRxAppIcon } { TRxAppIcon }
@ -86,6 +88,7 @@ end;
procedure TRxAppIcon.ApplyIcon; procedure TRxAppIcon.ApplyIcon;
{$IFDEF WIN32} {$IFDEF WIN32}
{$IFNDEF LCLGtk2}
procedure DoApply; procedure DoApply;
var var
H:HICON; H:HICON;
@ -106,12 +109,15 @@ begin
end; end;
end; end;
{$ENDIF} {$ENDIF}
{$ENDIF}
begin begin
if FIconStream.Size>0 then if FIconStream.Size>0 then
begin begin
Icon.LoadFromStream(FIconStream); Icon.LoadFromStream(FIconStream);
{$IFDEF WIN32} {$IFDEF WIN32}
{$IFNDEF LCLGtk2}
DoApply; DoApply;
{$ENDIF}
{$ENDIF} {$ENDIF}
end; end;
FIconStream.Position:=0; FIconStream.Position:=0;

View File

@ -0,0 +1,154 @@
unit rxceEditLookupFields;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, PropEdits;
type
{ TLookupFieldProperty }
TLookupFieldProperty = class(TStringPropertyEditor)
public
function GetAttributes: TPropertyAttributes; override;
procedure GetValues(Proc: TGetStrProc); override;
procedure FillValues(const Values: TStrings); virtual;
end;
{ TLookupDisplayProperty }
TLookupDisplayProperty = class(TLookupFieldProperty)
public
function GetAttributes: TPropertyAttributes; override;
procedure Edit; override;
end;
procedure RegisterCEEditLookupFields;
implementation
uses
//
db, duallist, Forms, rxstrutils, TypInfo,
//unit for edits
rxlookup;
procedure RegisterCEEditLookupFields;
begin
RegisterPropertyEditor(TypeInfo(string), TRxDBLookupCombo, 'LookupField', TLookupFieldProperty);
RegisterPropertyEditor(TypeInfo(string), TRxDBLookupCombo, 'LookupDisplay', TLookupDisplayProperty);
RegisterPropertyEditor(TypeInfo(string), TRxLookupEdit, 'LookupField', TLookupFieldProperty);
RegisterPropertyEditor(TypeInfo(string), TRxLookupEdit, 'LookupDisplay', TLookupDisplayProperty);
end;
{ TLookupFieldProperty }
function TLookupFieldProperty.GetAttributes: TPropertyAttributes;
begin
Result:= [paValueList, paSortList, paMultiSelect];
end;
procedure TLookupFieldProperty.GetValues(Proc: TGetStrProc);
var
I: Integer;
Values: TStringList;
begin
Values := TStringList.Create;
try
FillValues(Values);
for I := 0 to Values.Count - 1 do Proc(Values[I]);
finally
Values.Free;
end;
end;
procedure TLookupFieldProperty.FillValues(const Values: TStrings);
var
DataSource: TDataSource;
begin
DataSource := GetObjectProp(GetComponent(0), 'LookupSource') as TDataSource;
// DataSource := TRxDBLookupCombo(GetComponent(0)).LookupSource;
if (DataSource is TDataSource) and Assigned(DataSource.DataSet) then
DataSource.DataSet.GetFieldNames(Values);
end;
{ TLookupDisplayProperty }
function TLookupDisplayProperty.GetAttributes: TPropertyAttributes;
begin
Result:=inherited GetAttributes + [paDialog]
end;
procedure TLookupDisplayProperty.Edit;
var
DualListDialog1: TDualListDialog;
Cmp1:TRxDBLookupCombo;
Cmp2:TRxLookupEdit;
procedure DoInitFill;
var
i,j:integer;
LookupDisplay:string;
begin
if Assigned(Cmp1) then
LookupDisplay:=Cmp1.LookupDisplay
else
LookupDisplay:=Cmp2.LookupDisplay;
if LookupDisplay<>'' then
begin
StrToStrings(LookupDisplay, DualListDialog1.List2, ';');
for i:=DualListDialog1.List1.Count-1 downto 0 do
begin
j:=DualListDialog1.List2.IndexOf(DualListDialog1.List1[i]);
if j>=0 then
DualListDialog1.List1.Delete(i);
end;
end;
end;
function DoFillDone:string;
var
i:integer;
begin
for i:=0 to DualListDialog1.List2.Count-1 do
Result:=Result + DualListDialog1.List2[i]+';';
if Result<>'' then
Result:=Copy(Result, 1, Length(Result)-1);
end;
procedure DoSetCaptions;
begin
DualListDialog1.Label1Caption:='All fields';
DualListDialog1.Label2Caption:='Fields is LookupDisplay';
DualListDialog1.Title:='Fill fields in LookupDisplay property';
end;
begin
Cmp1:=nil;
Cmp2:=nil;
if GetComponent(0) is TRxDBLookupCombo then
Cmp1:=TRxDBLookupCombo(GetComponent(0))
else
Cmp2:=TRxLookupEdit(GetComponent(0));
DualListDialog1:=TDualListDialog.Create(Application);
try
DoSetCaptions;
FillValues(DualListDialog1.List1);
DoInitFill;
if DualListDialog1.Execute then
begin
if Assigned(Cmp1) then
Cmp1.LookupDisplay:=DoFillDone
else
Cmp2.LookupDisplay:=DoFillDone;
end;
finally
FreeAndNil(DualListDialog1);
end;
end;
end.

View File

@ -14,7 +14,8 @@ unit rxctrls;
interface interface
uses LResources, LCLType, LCLIntf, LMessages, Classes, Controls, Graphics, uses LResources, LCLType, LCLIntf, LMessages, Classes, Controls, Graphics,
StdCtrls, ExtCtrls, Forms, Buttons, Menus, RxConst, IniFiles, GraphType{, Placemnt}; StdCtrls, ExtCtrls, Forms, Buttons, Menus, RxConst, IniFiles, GraphType
{, Placemnt};
type type
TPositiveInt = 1..MaxInt; TPositiveInt = 1..MaxInt;
@ -915,7 +916,7 @@ function CheckBitmap: TBitmap;
implementation implementation
uses SysUtils, Dialogs, CommCtrl, VCLUtils, Math, RxAppUtils, ImgList, uses SysUtils, Dialogs, {CommCtrl,} VCLUtils, Math, RxAppUtils, ImgList,
ActnList ActnList
(* Consts, {$IFDEF RX_D6}, RTLConsts{$ENDIF} (* Consts, {$IFDEF RX_D6}, RTLConsts{$ENDIF}
*) *)

View File

@ -182,6 +182,7 @@ type
procedure UpdateData; procedure UpdateData;
procedure OnClosePopup(AResult:boolean); procedure OnClosePopup(AResult:boolean);
protected protected
procedure DoAutoSize; override;
procedure SetEnabled(Value: Boolean); override; procedure SetEnabled(Value: Boolean); override;
procedure KeyDown(var Key: Word; Shift: TShiftState); override; procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure KeyPress(var Key: char); override; procedure KeyPress(var Key: char); override;
@ -923,7 +924,7 @@ begin
FLookupDataLink.DataSet.First; FLookupDataLink.DataSet.First;
FRxPopUpForm:=ShowRxDBPopUpForm(Self, FLookupDataLink.DataSet, @OnClosePopup, FRxPopUpForm:=ShowRxDBPopUpForm(Self, FLookupDataLink.DataSet, @OnClosePopup,
FPopUpFormOptions, FLookupDisplay, LookupDisplayIndex, ButtonWidth); FPopUpFormOptions, FLookupDisplay, LookupDisplayIndex, ButtonWidth, Font);
end end
end; end;
@ -969,7 +970,7 @@ begin
FillPopupWidth(FPopUpFormOptions, FRxPopUpForm); FillPopupWidth(FPopUpFormOptions, FRxPopUpForm);
FRxPopUpForm:=nil; FRxPopUpForm:=nil;
if AResult then if AResult and Assigned(FDataLink.DataSource) then
begin begin
FDataLink.Edit; FDataLink.Edit;
UpdateData; UpdateData;
@ -981,6 +982,11 @@ begin
Parent.Repaint; Parent.Repaint;
end; end;
procedure TRxCustomDBLookupCombo.DoAutoSize;
begin
Height:=Canvas.TextHeight('Wg')+10;
end;
procedure TRxCustomDBLookupCombo.SetEnabled(Value: Boolean); procedure TRxCustomDBLookupCombo.SetEnabled(Value: Boolean);
begin begin
inherited SetEnabled(Value); inherited SetEnabled(Value);
@ -1049,7 +1055,7 @@ begin
inherited SetParent(AParent); inherited SetParent(AParent);
if FButton <> nil then if FButton <> nil then
begin begin
FButton.Parent := Parent; // FButton.Parent := Parent;
CheckButtonVisible; CheckButtonVisible;
end; end;
end; end;
@ -1067,7 +1073,7 @@ begin
end; end;
inherited DoSetBounds(ALeft, ATop, AWidth, AHeight); inherited DoSetBounds(ALeft, ATop, AWidth, AHeight);
DoPositionButton; // DoPositionButton;
end; end;
procedure TRxCustomDBLookupCombo.DoPositionButton; procedure TRxCustomDBLookupCombo.DoPositionButton;
@ -1160,6 +1166,7 @@ begin
if TextMargin > 0 then Inc(TextMargin); if TextMargin > 0 then Inc(TextMargin);
X := 2 + TextMargin; X := 2 + TextMargin;
Canvas.FillRect(R); Canvas.FillRect(R);
R.Right:=R.Right - GetButtonWidth;
if FDisplayAll then if FDisplayAll then
PaintDisplayValues(Canvas, R, TextMargin) PaintDisplayValues(Canvas, R, TextMargin)
else else
@ -1234,10 +1241,14 @@ begin
FButton.Width := Self.Height; FButton.Width := Self.Height;
FButton.Height := Self.Height; FButton.Height := Self.Height;
FButton.FreeNotification(Self); FButton.FreeNotification(Self);
FButton.Parent:=Self;
CheckButtonVisible; CheckButtonVisible;
FButton.OnClick := @DoButtonClick; FButton.OnClick := @DoButtonClick;
FButton.Cursor := crArrow; FButton.Cursor := crArrow;
FButton.ControlStyle := FButton.ControlStyle + [csNoDesignSelectable]; FButton.ControlStyle := FButton.ControlStyle + [csNoDesignSelectable];
FButton.Align:=alRight;
FButton.BorderSpacing.Around:=2;
ControlStyle := ControlStyle - [csSetCaption]; ControlStyle := ControlStyle - [csSetCaption];
FDirectInput := True; FDirectInput := True;
ParentColor:=false; ParentColor:=false;
@ -1248,6 +1259,7 @@ begin
ButtonWidth:=15; ButtonWidth:=15;
Ctl3D:=true; Ctl3D:=true;
TabStop:=true; TabStop:=true;
end; end;
destructor TRxCustomDBLookupCombo.Destroy; destructor TRxCustomDBLookupCombo.Destroy;

View File

@ -24,7 +24,7 @@ translate to Lazarus by alexs in 2005 - 2007
<License Value="free ware <License Value="free ware
"/> "/>
<Version Major="1" Minor="1" Release="5" Build="98"/> <Version Major="1" Minor="1" Release="5" Build="98"/>
<Files Count="43"> <Files Count="44">
<Item1> <Item1>
<Filename Value="rxlookup.pas"/> <Filename Value="rxlookup.pas"/>
<UnitName Value="rxlookup"/> <UnitName Value="rxlookup"/>
@ -198,21 +198,25 @@ translate to Lazarus by alexs in 2005 - 2007
<Filename Value="rxdbgrid.lrs"/> <Filename Value="rxdbgrid.lrs"/>
<Type Value="LRS"/> <Type Value="LRS"/>
</Item43> </Item43>
<Item44>
<Filename Value="rxceeditlookupfields.pas"/>
<UnitName Value="rxceeditlookupfields"/>
</Item44>
</Files> </Files>
<Type Value="RunAndDesignTime"/> <Type Value="RunAndDesignTime"/>
<RequiredPkgs Count="4"> <RequiredPkgs Count="4">
<Item1> <Item1>
<PackageName Value="FCL"/> <PackageName Value="rx"/>
<MinVersion Major="1" Valid="True"/>
</Item1> </Item1>
<Item2> <Item2>
<PackageName Value="IDEIntf"/> <PackageName Value="LCL"/>
</Item2> </Item2>
<Item3> <Item3>
<PackageName Value="LCL"/> <PackageName Value="IDEIntf"/>
</Item3> </Item3>
<Item4> <Item4>
<PackageName Value="rx"/> <PackageName Value="FCL"/>
<MinVersion Major="1" Valid="True"/>
</Item4> </Item4>
</RequiredPkgs> </RequiredPkgs>
<UsageOptions> <UsageOptions>

View File

@ -13,7 +13,7 @@ uses
rxtbrsetup, fduallst, rxxpman, pagemngr, rxappicon, seldsfrm, rxctrls, rxtbrsetup, fduallst, rxxpman, pagemngr, rxappicon, seldsfrm, rxctrls,
rxlogin, rxdbgrid_findunit, rxdbgrid_columsunit, rxpopupunit, rxlogin, rxdbgrid_findunit, rxdbgrid_columsunit, rxpopupunit,
rxcustomchartpanel, rxsortmemds, AutoPanel, pickdate, rxiconv, rxcustomchartpanel, rxsortmemds, AutoPanel, pickdate, rxiconv,
LazarusPackageIntf; rxceEditLookupFields, LazarusPackageIntf;
implementation implementation

View File

@ -184,7 +184,7 @@ type
function ShowRxDBPopUpForm(AControl:TWinControl; ADataSet:TDataSet; function ShowRxDBPopUpForm(AControl:TWinControl; ADataSet:TDataSet;
AOnPopUpCloseEvent:TPopUpCloseEvent; APopUpFormOptions:TPopUpFormOptions; AOnPopUpCloseEvent:TPopUpCloseEvent; APopUpFormOptions:TPopUpFormOptions;
AFieldList:string; ALookupDisplayIndex, BtnWidtn: integer):TPopUpForm; AFieldList:string; ALookupDisplayIndex, BtnWidtn: integer; const Font:TFont):TPopUpForm;
procedure FillPopupWidth(APopUpFormOptions:TPopUpFormOptions; ARxPopUpForm:TPopUpForm); procedure FillPopupWidth(APopUpFormOptions:TPopUpFormOptions; ARxPopUpForm:TPopUpForm);
@ -194,12 +194,19 @@ uses dbutils, math;
{.$DEFINE LINUX} {.$DEFINE LINUX}
function ShowRxDBPopUpForm(AControl:TWinControl; ADataSet:TDataSet; function ShowRxDBPopUpForm(AControl:TWinControl; ADataSet:TDataSet;
AOnPopUpCloseEvent:TPopUpCloseEvent; APopUpFormOptions:TPopUpFormOptions; AOnPopUpCloseEvent:TPopUpCloseEvent; APopUpFormOptions:TPopUpFormOptions;
AFieldList:string; ALookupDisplayIndex, BtnWidtn: integer):TPopUpForm; AFieldList:string; ALookupDisplayIndex, BtnWidtn: integer; const Font:TFont):TPopUpForm;
begin begin
Result:=TPopUpForm.CreatePopUp(AControl, APopUpFormOptions, AFieldList, BtnWidtn); Result:=TPopUpForm.CreatePopUp(AControl, APopUpFormOptions, AFieldList, BtnWidtn);
Result.FOnPopUpCloseEvent:=AOnPopUpCloseEvent; Result.FOnPopUpCloseEvent:=AOnPopUpCloseEvent;
Result.DataSet:=ADataSet; Result.DataSet:=ADataSet;
Result.LookupDisplayIndex:=ALookupDisplayIndex; Result.LookupDisplayIndex:=ALookupDisplayIndex;
if Assigned(Font) then
begin
Result.FGrid.Font.Assign(Font);
// Result.Font.Assign(Font);
end;
{$IFDEF LINUX} {$IFDEF LINUX}
if Result.ShowModal = mrOk then if Result.ShowModal = mrOk then
if Assigned(AOnPopUpCloseEvent) then if Assigned(AOnPopUpCloseEvent) then
@ -470,6 +477,7 @@ begin
FGrid.TitleStyle:=FPopUpFormOptions.TitleStyle; FGrid.TitleStyle:=FPopUpFormOptions.TitleStyle;
FGrid.BorderStyle:=FPopUpFormOptions.BorderStyle; FGrid.BorderStyle:=FPopUpFormOptions.BorderStyle;
FGrid.OnGetCellProps:=FPopUpFormOptions.OnGetCellProps; FGrid.OnGetCellProps:=FPopUpFormOptions.OnGetCellProps;
end; end;
{ TPopUpFormOptions } { TPopUpFormOptions }

View File

@ -15,7 +15,7 @@ unit rxstrutils;
interface interface
uses SysUtils ; uses SysUtils, Classes;
type type
{$IFNDEF RX_D4} {$IFNDEF RX_D4}
@ -207,8 +207,10 @@ function RomanToInt(const S: string): Longint;
{ RomanToInt converts the given string to an integer value. If the string { RomanToInt converts the given string to an integer value. If the string
doesn't contain a valid roman numeric value, the 0 value is returned. } doesn't contain a valid roman numeric value, the 0 value is returned. }
procedure StrToStrings(const S:string; const List:TStrings; const Delims:Char);
const const
CRLF = #13#10; // CRLF = #13#10;
DigitChars = ['0'..'9']; DigitChars = ['0'..'9'];
{$IFNDEF CBUILDER} {$IFNDEF CBUILDER}
Brackets = ['(',')','[',']','{','}']; Brackets = ['(',')','[',']','{','}'];
@ -1081,4 +1083,27 @@ begin
end; end;
end; end;
procedure StrToStrings(const S:string; const List:TStrings; const Delims:Char);
var
i,j:integer;
begin
if S<>'' then
begin
j:=1;
for i:=1 to Length(S) do
begin
if S[i] = Delims then
begin
if i>j+1 then
begin
List.Add(Copy(S, j, i-j));
end;
j:=i+1;
end;
end;
if j<Length(S) then
List.Add(Copy(S, j, Length(S)));
end;
end;
end. end.