mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-07 12:20:25 +02:00
updated New LCL TSemaphorDBGrid and changes in SemaphorGrid example from Salvatore
git-svn-id: trunk@7057 -
This commit is contained in:
parent
95dcb145e6
commit
092848eb6d
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -648,6 +648,7 @@ examples/grid_semaphor/example/unit1.lfm svneol=native#text/plain
|
||||
examples/grid_semaphor/example/unit1.lrs svneol=native#text/pascal
|
||||
examples/grid_semaphor/example/unit1.pas svneol=native#text/pascal
|
||||
examples/grid_semaphor/readme.txt svneol=native#text/plain
|
||||
examples/grid_semaphor/semaphordbgridicon.lrs svneol=native#text/pascal
|
||||
examples/grid_semaphor/semaphorgridlpk.lpk svneol=native#text/pascal
|
||||
examples/grid_semaphor/semaphorgridlpk.pas svneol=native#text/pascal
|
||||
examples/grid_semaphor/semaphorgrids.pas svneol=native#text/pascal
|
||||
|
@ -1,22 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<PathDelim Value="/"/>
|
||||
<Version Value="5"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<SaveClosedFiles Value="False"/>
|
||||
<SaveOnlyProjectUnits Value="True"/>
|
||||
</Flags>
|
||||
<MainUnit Value="0"/>
|
||||
<ActiveEditorIndexAtStart Value="1"/>
|
||||
<ActiveEditorIndexAtStart Value="0"/>
|
||||
<IconPath Value="./"/>
|
||||
<TargetFileExt Value=".exe"/>
|
||||
<Title Value="project1"/>
|
||||
</General>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<CursorPos X="1" Y="21"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<CursorPos X="40" Y="32"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<Loaded Value="True"/>
|
||||
@ -25,21 +25,20 @@
|
||||
<UsageCount Value="28"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<CursorPos X="26" Y="151"/>
|
||||
<CursorPos X="23" Y="168"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<Loaded Value="True"/>
|
||||
<ResourceFilename Value="unit1.lrs"/>
|
||||
<TopLine Value="127"/>
|
||||
<ResourceFilename Value="Unit1.lrs"/>
|
||||
<TopLine Value="150"/>
|
||||
<UnitName Value="Unit1"/>
|
||||
<UsageCount Value="28"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<DestinationDirectory Value="$(TestDir)\publishedproject\"/>
|
||||
<IgnoreBinaries Value="False"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||
@ -47,7 +46,7 @@
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
|
||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
@ -61,7 +60,7 @@
|
||||
</RequiredPackages>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="4"/>
|
||||
<Version Value="5"/>
|
||||
<SearchPaths>
|
||||
<SrcPath Value="$(LazarusDir)/lcl/;$(LazarusDir)/lcl/interfaces/$(LCLWidgetType)/"/>
|
||||
</SearchPaths>
|
||||
|
@ -1,17 +1,17 @@
|
||||
object Form1: TForm1
|
||||
ActiveControl = Button1
|
||||
Caption = 'Try SemaphorGrid'
|
||||
ClientHeight = 299
|
||||
ClientWidth = 536
|
||||
OnCreate = Form1Create
|
||||
PixelsPerInch = 96
|
||||
HorzScrollBar.Page = 537
|
||||
VertScrollBar.Page = 300
|
||||
HorzScrollBar.Page = 535
|
||||
VertScrollBar.Page = 298
|
||||
Left = 18
|
||||
Height = 299
|
||||
Top = 141
|
||||
Width = 536
|
||||
object Button1: TButton
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'Toggle Semaphor'
|
||||
OnClick = Button1Click
|
||||
TabOrder = 0
|
||||
@ -21,6 +21,7 @@ object Form1: TForm1
|
||||
Width = 112
|
||||
end
|
||||
object Button2: TButton
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'Next Semafore Style'
|
||||
OnClick = Button2Click
|
||||
TabOrder = 1
|
||||
@ -30,6 +31,7 @@ object Form1: TForm1
|
||||
Width = 126
|
||||
end
|
||||
object Button3: TButton
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'Next Alignment'
|
||||
OnClick = Button3Click
|
||||
TabOrder = 2
|
||||
@ -39,6 +41,7 @@ object Form1: TForm1
|
||||
Width = 114
|
||||
end
|
||||
object Button4: TButton
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'Close'
|
||||
OnClick = Button4Click
|
||||
TabOrder = 3
|
||||
@ -48,6 +51,7 @@ object Form1: TForm1
|
||||
Width = 75
|
||||
end
|
||||
object Button5: TButton
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'Save to File'
|
||||
OnClick = Button5Click
|
||||
TabOrder = 4
|
||||
@ -57,6 +61,7 @@ object Form1: TForm1
|
||||
Width = 88
|
||||
end
|
||||
object Button6: TButton
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'Load from File'
|
||||
OnClick = Button6Click
|
||||
TabOrder = 5
|
||||
@ -66,6 +71,7 @@ object Form1: TForm1
|
||||
Width = 96
|
||||
end
|
||||
object Button7: TButton
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'AutoWidth'
|
||||
OnClick = Button7Click
|
||||
TabOrder = 6
|
||||
@ -75,6 +81,7 @@ object Form1: TForm1
|
||||
Width = 67
|
||||
end
|
||||
object Button8: TButton
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'AutoHeight'
|
||||
OnClick = Button8Click
|
||||
TabOrder = 7
|
||||
@ -84,6 +91,7 @@ object Form1: TForm1
|
||||
Width = 72
|
||||
end
|
||||
object Button9: TButton
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'Sort Cols[4]'
|
||||
OnClick = Button9Click
|
||||
TabOrder = 8
|
||||
@ -93,6 +101,7 @@ object Form1: TForm1
|
||||
Width = 75
|
||||
end
|
||||
object RadioButton1: TRadioButton
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'Ascending'
|
||||
Checked = True
|
||||
State = cbChecked
|
||||
@ -103,6 +112,7 @@ object Form1: TForm1
|
||||
Width = 92
|
||||
end
|
||||
object RadioButton2: TRadioButton
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'Descending'
|
||||
TabOrder = 10
|
||||
Left = 259
|
||||
@ -111,6 +121,7 @@ object Form1: TForm1
|
||||
Width = 102
|
||||
end
|
||||
object Button10: TButton
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'Hide/Show Cols[1]'
|
||||
OnClick = Button10Click
|
||||
TabOrder = 11
|
||||
@ -120,6 +131,7 @@ object Form1: TForm1
|
||||
Width = 142
|
||||
end
|
||||
object Button11: TButton
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'Clear'
|
||||
OnClick = Button11Click
|
||||
TabOrder = 12
|
||||
@ -129,6 +141,7 @@ object Form1: TForm1
|
||||
Width = 44
|
||||
end
|
||||
object CheckBox1: TCheckBox
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'OnlyValue'
|
||||
TabOrder = 13
|
||||
Left = 60
|
||||
@ -137,6 +150,7 @@ object Form1: TForm1
|
||||
Width = 90
|
||||
end
|
||||
object Panel1: TPanel
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'Panel1'
|
||||
ClientHeight = 154
|
||||
ClientWidth = 464
|
||||
@ -154,6 +168,7 @@ object Form1: TForm1
|
||||
StringYellow = 'maybe'
|
||||
StringGreen = 'yes'
|
||||
SemaphorShape = ssDisk
|
||||
BorderSpacing.OnChange = nil
|
||||
Color = clWhite
|
||||
ColCount = 5
|
||||
DefaultColWidth = 64
|
||||
@ -169,6 +184,20 @@ object Form1: TForm1
|
||||
VisibleRowCount = 4
|
||||
Height = 148
|
||||
Width = 456
|
||||
ColWidths = (
|
||||
64
|
||||
64
|
||||
64
|
||||
64
|
||||
64
|
||||
)
|
||||
RowHeights = (
|
||||
24
|
||||
24
|
||||
24
|
||||
24
|
||||
24
|
||||
)
|
||||
Cells = (
|
||||
24
|
||||
0
|
||||
@ -247,6 +276,7 @@ object Form1: TForm1
|
||||
end
|
||||
end
|
||||
object Button12: TButton
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'Sort Cols[1]'
|
||||
OnClick = Button12Click
|
||||
TabOrder = 15
|
||||
@ -256,6 +286,7 @@ object Form1: TForm1
|
||||
Width = 75
|
||||
end
|
||||
object ToggleBox1: TToggleBox
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'UnEditable'
|
||||
OnClick = ToggleBox1Click
|
||||
TabOrder = 16
|
||||
@ -265,6 +296,7 @@ object Form1: TForm1
|
||||
Width = 90
|
||||
end
|
||||
object CheckBox2: TCheckBox
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'Only Float'
|
||||
OnClick = CheckBox2Click
|
||||
TabOrder = 17
|
||||
@ -276,12 +308,14 @@ object Form1: TForm1
|
||||
object SaveDialog1: TSaveDialog
|
||||
Title = 'Save file as'
|
||||
FilterIndex = 0
|
||||
Title = 'Save file as'
|
||||
left = 40
|
||||
top = 360
|
||||
end
|
||||
object OpenDialog1: TOpenDialog
|
||||
Title = 'Open existing file'
|
||||
FilterIndex = 0
|
||||
Title = 'Open existing file'
|
||||
left = 8
|
||||
top = 360
|
||||
end
|
||||
|
@ -1,64 +1,73 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TForm1','FORMDATA',[
|
||||
'TPF0'#6'TForm1'#5'Form1'#13'ActiveControl'#7#7'Button1'#7'Caption'#6#16'Try '
|
||||
+'SemaphorGrid'#12'ClientHeight'#3'+'#1#11'ClientWidth'#3#24#2#8'OnCreate'#7
|
||||
+#11'Form1Create'#13'PixelsPerInch'#2'`'#18'HorzScrollBar.Page'#3#25#2#18'Ver'
|
||||
+'tScrollBar.Page'#3','#1#4'Left'#2#18#6'Height'#3'+'#1#3'Top'#3#141#0#5'Widt'
|
||||
+'h'#3#24#2#0#7'TButton'#7'Button1'#7'Caption'#6#15'Toggle Semaphor'#7'OnClic'
|
||||
+'k'#7#12'Button1Click'#8'TabOrder'#2#0#4'Left'#2#8#6'Height'#2#25#3'Top'#3
|
||||
+#232#0#5'Width'#2'p'#0#0#7'TButton'#7'Button2'#7'Caption'#6#19'Next Semafore'
|
||||
+' Style'#7'OnClick'#7#12'Button2Click'#8'TabOrder'#2#1#4'Left'#3#128#0#6'Hei'
|
||||
+'ght'#2#25#3'Top'#3#232#0#5'Width'#2'~'#0#0#7'TButton'#7'Button3'#7'Caption'
|
||||
+#6#14'Next Alignment'#7'OnClick'#7#12'Button3Click'#8'TabOrder'#2#2#4'Left'#2
|
||||
+#8#6'Height'#2#25#3'Top'#3#8#1#5'Width'#2'r'#0#0#7'TButton'#7'Button4'#7'Cap'
|
||||
+'tion'#6#5'Close'#7'OnClick'#7#12'Button4Click'#8'TabOrder'#2#3#4'Left'#3'K'
|
||||
+#1#6'Height'#2#25#3'Top'#3#8#1#5'Width'#2'K'#0#0#7'TButton'#7'Button5'#7'Cap'
|
||||
+'tion'#6#12'Save to File'#7'OnClick'#7#12'Button5Click'#8'TabOrder'#2#4#4'Le'
|
||||
+'ft'#3#128#0#6'Height'#2#25#3'Top'#3#8#1#5'Width'#2'X'#0#0#7'TButton'#7'Butt'
|
||||
+'on6'#7'Caption'#6#14'Load from File'#7'OnClick'#7#12'Button6Click'#8'TabOrd'
|
||||
+'er'#2#5#4'Left'#3#227#0#6'Height'#2#25#3'Top'#3#8#1#5'Width'#2'`'#0#0#7'TBu'
|
||||
+'tton'#7'Button7'#7'Caption'#6#9'AutoWidth'#7'OnClick'#7#12'Button7Click'#8
|
||||
+'TabOrder'#2#6#4'Left'#3#8#1#6'Height'#2#17#3'Top'#3#232#0#5'Width'#2'C'#0#0
|
||||
+#7'TButton'#7'Button8'#7'Caption'#6#10'AutoHeight'#7'OnClick'#7#12'Button8Cl'
|
||||
+'ick'#8'TabOrder'#2#7#4'Left'#3'N'#1#6'Height'#2#17#3'Top'#3#232#0#5'Width'#2
|
||||
+'H'#0#0#7'TButton'#7'Button9'#7'Caption'#6#12'Sort Cols[4]'#7'OnClick'#7#12
|
||||
'TPF0'#6'TForm1'#5'Form1'#7'Caption'#6#16'Try SemaphorGrid'#12'ClientHeight'#3
|
||||
+'+'#1#11'ClientWidth'#3#24#2#8'OnCreate'#7#11'Form1Create'#13'PixelsPerInch'
|
||||
+#2'`'#18'HorzScrollBar.Page'#3#23#2#18'VertScrollBar.Page'#3'*'#1#4'Left'#2
|
||||
+#18#6'Height'#3'+'#1#3'Top'#3#141#0#5'Width'#3#24#2#0#7'TButton'#7'Button1'
|
||||
+#22'BorderSpacing.OnChange'#13#7'Caption'#6#15'Toggle Semaphor'#7'OnClick'#7
|
||||
+#12'Button1Click'#8'TabOrder'#2#0#4'Left'#2#8#6'Height'#2#25#3'Top'#3#232#0#5
|
||||
+'Width'#2'p'#0#0#7'TButton'#7'Button2'#22'BorderSpacing.OnChange'#13#7'Capti'
|
||||
+'on'#6#19'Next Semafore Style'#7'OnClick'#7#12'Button2Click'#8'TabOrder'#2#1
|
||||
+#4'Left'#3#128#0#6'Height'#2#25#3'Top'#3#232#0#5'Width'#2'~'#0#0#7'TButton'#7
|
||||
+'Button3'#22'BorderSpacing.OnChange'#13#7'Caption'#6#14'Next Alignment'#7'On'
|
||||
+'Click'#7#12'Button3Click'#8'TabOrder'#2#2#4'Left'#2#8#6'Height'#2#25#3'Top'
|
||||
+#3#8#1#5'Width'#2'r'#0#0#7'TButton'#7'Button4'#22'BorderSpacing.OnChange'#13
|
||||
+#7'Caption'#6#5'Close'#7'OnClick'#7#12'Button4Click'#8'TabOrder'#2#3#4'Left'
|
||||
+#3'K'#1#6'Height'#2#25#3'Top'#3#8#1#5'Width'#2'K'#0#0#7'TButton'#7'Button5'
|
||||
+#22'BorderSpacing.OnChange'#13#7'Caption'#6#12'Save to File'#7'OnClick'#7#12
|
||||
+'Button5Click'#8'TabOrder'#2#4#4'Left'#3#128#0#6'Height'#2#25#3'Top'#3#8#1#5
|
||||
+'Width'#2'X'#0#0#7'TButton'#7'Button6'#22'BorderSpacing.OnChange'#13#7'Capti'
|
||||
+'on'#6#14'Load from File'#7'OnClick'#7#12'Button6Click'#8'TabOrder'#2#5#4'Le'
|
||||
+'ft'#3#227#0#6'Height'#2#25#3'Top'#3#8#1#5'Width'#2'`'#0#0#7'TButton'#7'Butt'
|
||||
+'on7'#22'BorderSpacing.OnChange'#13#7'Caption'#6#9'AutoWidth'#7'OnClick'#7#12
|
||||
+'Button7Click'#8'TabOrder'#2#6#4'Left'#3#8#1#6'Height'#2#17#3'Top'#3#232#0#5
|
||||
+'Width'#2'C'#0#0#7'TButton'#7'Button8'#22'BorderSpacing.OnChange'#13#7'Capti'
|
||||
+'on'#6#10'AutoHeight'#7'OnClick'#7#12'Button8Click'#8'TabOrder'#2#7#4'Left'#3
|
||||
+'N'#1#6'Height'#2#17#3'Top'#3#232#0#5'Width'#2'H'#0#0#7'TButton'#7'Button9'
|
||||
+#22'BorderSpacing.OnChange'#13#7'Caption'#6#12'Sort Cols[4]'#7'OnClick'#7#12
|
||||
+'Button9Click'#8'TabOrder'#2#8#4'Left'#3#176#0#6'Height'#2#20#3'Top'#3#167#0
|
||||
+#5'Width'#2'K'#0#0#12'TRadioButton'#12'RadioButton1'#7'Caption'#6#9'Ascendin'
|
||||
+'g'#7'Checked'#9#5'State'#7#9'cbChecked'#8'TabOrder'#2#9#4'Left'#3#3#1#6'Hei'
|
||||
+'ght'#2#23#3'Top'#3#164#0#5'Width'#2'\'#0#0#12'TRadioButton'#12'RadioButton2'
|
||||
+#7'Caption'#6#10'Descending'#8'TabOrder'#2#10#4'Left'#3#3#1#6'Height'#2#23#3
|
||||
+'Top'#3#185#0#5'Width'#2'f'#0#0#7'TButton'#8'Button10'#7'Caption'#6#17'Hide/'
|
||||
+'Show Cols[1]'#7'OnClick'#7#13'Button10Click'#8'TabOrder'#2#11#4'Left'#2#8#6
|
||||
+'Height'#2#25#3'Top'#3#164#0#5'Width'#3#142#0#0#0#7'TButton'#8'Button11'#7'C'
|
||||
+'aption'#6#5'Clear'#7'OnClick'#7#13'Button11Click'#8'TabOrder'#2#12#4'Left'#2
|
||||
+#8#6'Height'#2#25#3'Top'#3#196#0#5'Width'#2','#0#0#9'TCheckBox'#9'CheckBox1'
|
||||
+#7'Caption'#6#9'OnlyValue'#8'TabOrder'#2#13#4'Left'#2'<'#6'Height'#2#23#3'To'
|
||||
+'p'#3#196#0#5'Width'#2'Z'#0#0#6'TPanel'#6'Panel1'#7'Caption'#6#6'Panel1'#12
|
||||
+'ClientHeight'#3#154#0#11'ClientWidth'#3#208#1#11'FullRepaint'#8#8'TabOrder'
|
||||
+#2#14#4'Left'#2#8#6'Height'#3#154#0#3'Top'#2#8#5'Width'#3#208#1#0#13'TSemaph'
|
||||
+'orGrid'#13'SemaphorGrid1'#9'Alignment'#7#8'taCenter'#5'CHSEP'#6#1#255#8'Sem'
|
||||
+'aphor'#9#9'StringRed'#6#2'no'#12'StringYellow'#6#5'maybe'#11'StringGreen'#6
|
||||
+#3'yes'#13'SemaphorShape'#7#6'ssDisk'#5'Color'#7#7'clWhite'#8'ColCount'#2#5
|
||||
+#15'DefaultColWidth'#2'@'#16'DefaultRowHeight'#2#24#10'FixedColor'#7#9'clBtn'
|
||||
+'Face'#13'GridLineWidth'#2#0#7'Options'#11#15'goFixedVertLine'#15'goFixedHor'
|
||||
+'zLine'#10'goVertLine'#10'goHorzLine'#13'goRangeSelect'#14'goSmoothScroll'#0
|
||||
+#8'RowCount'#2#5#10'ScrollBars'#7#10'ssAutoBoth'#8'TabOrder'#2#0#7'TabStop'#9
|
||||
+#15'VisibleColCount'#2#4#15'VisibleRowCount'#2#4#6'Height'#3#148#0#5'Width'#3
|
||||
+#200#1#5'Cells'#1#2#24#2#0#2#0#6#3'a\n'#2#0#2#1#6#1'a'#2#0#2#2#6#1'b'#2#0#2#3
|
||||
+#6#1'c'#2#0#2#4#6#1'd'#2#1#2#0#6#1'1'#2#1#2#1#6#2'no'#2#1#2#2#6#5'alpha'#2#1
|
||||
+#2#3#6#3'zed'#2#1#2#4#6#5'maybe'#2#2#2#0#6#1'2'#2#2#2#1#6#3'yes'#2#2#2#2#6#9
|
||||
+'Salvatore'#2#2#2#3#6#6'0.9877'#2#2#2#4#6#3'yes'#2#3#2#0#6#1'3'#2#3#2#2#6#2
|
||||
+'no'#2#3#2#3#6#7'Coppola'#2#3#2#4#6#5'maybe'#2#4#2#0#6#1'4'#2#4#2#1#6#1'5'#2
|
||||
+#4#2#2#6#2'12'#2#4#2#3#6#2'-1'#2#4#2#4#6#1'2'#0#0#0#0#7'TButton'#8'Button12'
|
||||
+#7'Caption'#6#12'Sort Cols[1]'#7'OnClick'#7#13'Button12Click'#8'TabOrder'#2
|
||||
+#15#4'Left'#3#176#0#6'Height'#2#18#3'Top'#3#190#0#5'Width'#2'K'#0#0#10'TTogg'
|
||||
+'leBox'#10'ToggleBox1'#7'Caption'#6#10'UnEditable'#7'OnClick'#7#15'ToggleBox'
|
||||
+'1Click'#8'TabOrder'#2#16#4'Left'#3#128#1#6'Height'#2#25#3'Top'#3#167#0#5'Wi'
|
||||
+'dth'#2'Z'#0#0#9'TCheckBox'#9'CheckBox2'#7'Caption'#6#10'Only Float'#7'OnCli'
|
||||
+'ck'#7#14'CheckBox2Click'#8'TabOrder'#2#17#4'Left'#3#128#1#6'Height'#2#23#3
|
||||
+'Top'#3#203#0#5'Width'#2'Y'#0#0#11'TSaveDialog'#11'SaveDialog1'#5'Title'#6#12
|
||||
+'Save file as'#11'FilterIndex'#2#0#4'left'#2'('#3'top'#3'h'#1#0#0#11'TOpenDi'
|
||||
+'alog'#11'OpenDialog1'#5'Title'#6#18'Open existing file'#11'FilterIndex'#2#0
|
||||
+#4'left'#2#8#3'top'#3'h'#1#0#0#0
|
||||
+#5'Width'#2'K'#0#0#12'TRadioButton'#12'RadioButton1'#22'BorderSpacing.OnChan'
|
||||
+'ge'#13#7'Caption'#6#9'Ascending'#7'Checked'#9#5'State'#7#9'cbChecked'#8'Tab'
|
||||
+'Order'#2#9#4'Left'#3#3#1#6'Height'#2#23#3'Top'#3#164#0#5'Width'#2'\'#0#0#12
|
||||
+'TRadioButton'#12'RadioButton2'#22'BorderSpacing.OnChange'#13#7'Caption'#6#10
|
||||
+'Descending'#8'TabOrder'#2#10#4'Left'#3#3#1#6'Height'#2#23#3'Top'#3#185#0#5
|
||||
+'Width'#2'f'#0#0#7'TButton'#8'Button10'#22'BorderSpacing.OnChange'#13#7'Capt'
|
||||
+'ion'#6#17'Hide/Show Cols[1]'#7'OnClick'#7#13'Button10Click'#8'TabOrder'#2#11
|
||||
+#4'Left'#2#8#6'Height'#2#25#3'Top'#3#164#0#5'Width'#3#142#0#0#0#7'TButton'#8
|
||||
+'Button11'#22'BorderSpacing.OnChange'#13#7'Caption'#6#5'Clear'#7'OnClick'#7
|
||||
+#13'Button11Click'#8'TabOrder'#2#12#4'Left'#2#8#6'Height'#2#25#3'Top'#3#196#0
|
||||
+#5'Width'#2','#0#0#9'TCheckBox'#9'CheckBox1'#22'BorderSpacing.OnChange'#13#7
|
||||
+'Caption'#6#9'OnlyValue'#8'TabOrder'#2#13#4'Left'#2'<'#6'Height'#2#23#3'Top'
|
||||
+#3#196#0#5'Width'#2'Z'#0#0#6'TPanel'#6'Panel1'#22'BorderSpacing.OnChange'#13
|
||||
+#7'Caption'#6#6'Panel1'#12'ClientHeight'#3#154#0#11'ClientWidth'#3#208#1#11
|
||||
+'FullRepaint'#8#8'TabOrder'#2#14#4'Left'#2#8#6'Height'#3#154#0#3'Top'#2#8#5
|
||||
+'Width'#3#208#1#0#13'TSemaphorGrid'#13'SemaphorGrid1'#9'Alignment'#7#8'taCen'
|
||||
+'ter'#5'CHSEP'#6#1#255#8'Semaphor'#9#9'StringRed'#6#2'no'#12'StringYellow'#6
|
||||
+#5'maybe'#11'StringGreen'#6#3'yes'#13'SemaphorShape'#7#6'ssDisk'#22'BorderSp'
|
||||
+'acing.OnChange'#13#5'Color'#7#7'clWhite'#8'ColCount'#2#5#15'DefaultColWidth'
|
||||
+#2'@'#16'DefaultRowHeight'#2#24#10'FixedColor'#7#9'clBtnFace'#13'GridLineWid'
|
||||
+'th'#2#0#7'Options'#11#15'goFixedVertLine'#15'goFixedHorzLine'#10'goVertLine'
|
||||
+#10'goHorzLine'#13'goRangeSelect'#14'goSmoothScroll'#0#8'RowCount'#2#5#10'Sc'
|
||||
+'rollBars'#7#10'ssAutoBoth'#8'TabOrder'#2#0#7'TabStop'#9#15'VisibleColCount'
|
||||
+#2#4#15'VisibleRowCount'#2#4#6'Height'#3#148#0#5'Width'#3#200#1#9'ColWidths'
|
||||
+#1#2'@'#2'@'#2'@'#2'@'#2'@'#0#10'RowHeights'#1#2#24#2#24#2#24#2#24#2#24#0#5
|
||||
+'Cells'#1#2#24#2#0#2#0#6#3'a\n'#2#0#2#1#6#1'a'#2#0#2#2#6#1'b'#2#0#2#3#6#1'c'
|
||||
+#2#0#2#4#6#1'd'#2#1#2#0#6#1'1'#2#1#2#1#6#2'no'#2#1#2#2#6#5'alpha'#2#1#2#3#6#3
|
||||
+'zed'#2#1#2#4#6#5'maybe'#2#2#2#0#6#1'2'#2#2#2#1#6#3'yes'#2#2#2#2#6#9'Salvato'
|
||||
+'re'#2#2#2#3#6#6'0.9877'#2#2#2#4#6#3'yes'#2#3#2#0#6#1'3'#2#3#2#2#6#2'no'#2#3
|
||||
+#2#3#6#7'Coppola'#2#3#2#4#6#5'maybe'#2#4#2#0#6#1'4'#2#4#2#1#6#1'5'#2#4#2#2#6
|
||||
+#2'12'#2#4#2#3#6#2'-1'#2#4#2#4#6#1'2'#0#0#0#0#7'TButton'#8'Button12'#22'Bord'
|
||||
+'erSpacing.OnChange'#13#7'Caption'#6#12'Sort Cols[1]'#7'OnClick'#7#13'Button'
|
||||
+'12Click'#8'TabOrder'#2#15#4'Left'#3#176#0#6'Height'#2#18#3'Top'#3#190#0#5'W'
|
||||
+'idth'#2'K'#0#0#10'TToggleBox'#10'ToggleBox1'#22'BorderSpacing.OnChange'#13#7
|
||||
+'Caption'#6#10'UnEditable'#7'OnClick'#7#15'ToggleBox1Click'#8'TabOrder'#2#16
|
||||
+#4'Left'#3#128#1#6'Height'#2#25#3'Top'#3#167#0#5'Width'#2'Z'#0#0#9'TCheckBox'
|
||||
+#9'CheckBox2'#22'BorderSpacing.OnChange'#13#7'Caption'#6#10'Only Float'#7'On'
|
||||
+'Click'#7#14'CheckBox2Click'#8'TabOrder'#2#17#4'Left'#3#128#1#6'Height'#2#23
|
||||
,#3'Top'#3#203#0#5'Width'#2'Y'#0#0#11'TSaveDialog'#11'SaveDialog1'#5'Title'#6
|
||||
+#12'Save file as'#11'FilterIndex'#2#0#5'Title'#6#12'Save file as'#4'left'#2
|
||||
+'('#3'top'#3'h'#1#0#0#11'TOpenDialog'#11'OpenDialog1'#5'Title'#6#18'Open exi'
|
||||
+'sting file'#11'FilterIndex'#2#0#5'Title'#6#18'Open existing file'#4'left'#2
|
||||
+#8#3'top'#3'h'#1#0#0#0
|
||||
]);
|
||||
|
@ -86,7 +86,6 @@ implementation
|
||||
procedure TForm1.Button1Click(Sender: TObject);
|
||||
begin
|
||||
SemaphorGrid1.Semaphor:=not SemaphorGrid1.Semaphor;
|
||||
SemaphorGrid1.ReDrawGrid;//should not are here
|
||||
end;
|
||||
|
||||
procedure TForm1.Button10Click(Sender: TObject);
|
||||
@ -119,7 +118,6 @@ begin
|
||||
SemaphorShape:=succ(SemaphorShape)
|
||||
else
|
||||
SemaphorShape:=ssTopBar;
|
||||
ReDrawGrid;//should not are here
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -1,40 +1,80 @@
|
||||
Hi for all,
|
||||
|
||||
I'm not so able to improve the source code of the Lazarus Project, it's too complicated
|
||||
|
||||
for my knowledge, but nevertheless I wanna try to contribute designing derivative
|
||||
|
||||
components wich are more accessible for me.
|
||||
|
||||
|
||||
|
||||
I think TSemaphorGrid is quite original and it seems to work fine on both
|
||||
|
||||
Windows and Linux OS except "HideCol" under Linux that sometimes show a bit
|
||||
|
||||
of text contained in the hidden cells.
|
||||
|
||||
|
||||
|
||||
All the Info you need for TSemaphorGrid are in the source code.
|
||||
|
||||
I've commented the main methods in the abstract and other important steps in the code.
|
||||
|
||||
I've registered it in the 'Additional' page of Lazarus IDE components because I use it
|
||||
|
||||
instead of TStringGrid and if you want you can change this.
|
||||
|
||||
|
||||
|
||||
TSemaphorGrid come in a Lazarus Package "SemaphorGridLPK.lpk", just install it in the
|
||||
|
||||
Lazarus IDE by Components-->Open package file(.lpk)
|
||||
|
||||
Compile and install it
|
||||
|
||||
In the ".\example" direcory there is a Lazarus project (.lpi) that use TSemaphorGrid
|
||||
|
||||
with the main properties and methods.
|
||||
|
||||
|
||||
|
||||
ABSTRACT:
|
||||
|
||||
SEMAFORO (Semaphor) in Italian Language means Traffic Lights. If Semaphor is
|
||||
|
||||
set to true,when TSemaphorGrid detect in a non Fixed Cells a string like
|
||||
|
||||
StringGreen or StringYellow or StringRed, it show a colored sign in the
|
||||
|
||||
corrispondent cells (shape choosed in SemaphorShape). It can be Case Sensitive
|
||||
|
||||
(SemaphorCaseSensitive). If Semaphor is false, nothing happen.
|
||||
|
||||
|
||||
|
||||
SemaphorGrid is able to store and restore data by indipendent method
|
||||
|
||||
LoadFromFileG and SaveToFileG wich manage also accented chars in data and
|
||||
|
||||
similar. Data are separeted by CHSEP. LoadFromFileG has autoadjust wich allow
|
||||
|
||||
SemaphorGrid to AutosizeColumns. SemaphorGrid, at the moment, is unable to store
|
||||
|
||||
setting grid (only Column Hidden and in general ColWidth). With the method
|
||||
|
||||
ExportToExcel, SemaphorGrid is able set CHSEP so that the file generated is
|
||||
|
||||
MS Excel compatible. SemaphorGrid is also able to sort a column wrapping all
|
||||
|
||||
the Grid with the method SortFromColumn with indipendent sorting method (maybe
|
||||
|
||||
it should be better to use onCompareCell)
|
||||
|
||||
|
||||
|
||||
Thanks for the Lazarus Project
|
||||
|
||||
|
||||
|
||||
Salvatore
|
||||
|
||||
|
15
examples/grid_semaphor/semaphordbgridicon.lrs
Normal file
15
examples/grid_semaphor/semaphordbgridicon.lrs
Normal file
@ -0,0 +1,15 @@
|
||||
LazarusResources.Add('TSemaphorDBGrid','XPM',[
|
||||
'/* XPM */'#13#10'static char * TSemaphorDBGrid_xpm[] = {'#13#10'"21 21 9 1",'
|
||||
+#13#10'" '#9'c None",'#13#10'".'#9'c #040404",'#13#10'"+'#9'c #048404",'#13
|
||||
+#10'"@'#9'c #7A7A7A",'#13#10'"#'#9'c #BABABA",'#13#10'"$'#9'c #FA0404",'#13
|
||||
+#10'"%'#9'c #FA04FA",'#13#10'"&'#9'c #FAFA04",'#13#10'"*'#9'c #FAFAFA",'#13
|
||||
+#10'"@@@@@@@@@@@@@@@ ",'#13#10'"@#@*####*#####@ ",'#13#10'"@@@@@@@'
|
||||
+'@@@@@@@@ ",'#13#10'"@#@****#******@ $$ ",'#13#10'"@*@*$$*#*++++*@ $$'
|
||||
+'$$ ",'#13#10'"@#@****#******@ $$$$ ",'#13#10'"@*@*&&*#*###**@ $$ ",'#13#10
|
||||
+'"@#@****#******@ ",'#13#10'"@*@..............&&..",'#13#10'"@#@.#.*###'
|
||||
+'##*###&&&&.",'#13#10'"@@@.............&&&&.",'#13#10'" .#.*****#*****&&*.'
|
||||
+'",'#13#10'" .*.##############.",'#13#10'" .#.*****#*****++*.",'#13#10'"'
|
||||
+' .*.##########++++.",'#13#10'" .#.*****#****++++.",'#13#10'" .*.#####'
|
||||
+'######++#.",'#13#10'" .#.*****#********.",'#13#10'" .*.##############."'
|
||||
+','#13#10'" .#.*****#********.",'#13#10'" .................."};'#13#10
|
||||
]);
|
@ -4,17 +4,12 @@
|
||||
<PathDelim Value="\"/>
|
||||
<Name Value="SemaphorGridLPK"/>
|
||||
<CompilerOptions>
|
||||
<Version Value="3"/>
|
||||
<Version Value="5"/>
|
||||
<PathDelim Value="\"/>
|
||||
<SearchPaths>
|
||||
<UnitOutputDirectory Value="lib\"/>
|
||||
<SrcPath Value="$(LazarusDir)\lcl\;$(LazarusDir)\lcl\interfaces\$(LCLWidgetType)\"/>
|
||||
</SearchPaths>
|
||||
<Parsing>
|
||||
<SymantecChecking>
|
||||
<DelphiCompat Value="True"/>
|
||||
</SymantecChecking>
|
||||
</Parsing>
|
||||
<CodeGeneration>
|
||||
<Generate Value="Faster"/>
|
||||
</CodeGeneration>
|
||||
@ -26,12 +21,17 @@
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Version Major="1"/>
|
||||
<Files Count="1">
|
||||
<Files Count="2">
|
||||
<Item1>
|
||||
<Filename Value="semaphorgrids.pas"/>
|
||||
<HasRegisterProc Value="True"/>
|
||||
<UnitName Value="SemaphorGrids"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Filename Value="semaphordbgrids.pas"/>
|
||||
<HasRegisterProc Value="True"/>
|
||||
<UnitName Value="SemaphorDBGrids"/>
|
||||
</Item2>
|
||||
</Files>
|
||||
<Type Value="RunAndDesignTime"/>
|
||||
<RequiredPkgs Count="2">
|
||||
|
@ -1,6 +1,5 @@
|
||||
{ This file was automatically created by Lazarus. Do not edit!
|
||||
This source is only used to compile and install
|
||||
the package SemaphorGridLPK 1.0.
|
||||
{ This file was automatically created by Lazarus. Do not edit!
|
||||
This source is only used to compile and install the package.
|
||||
}
|
||||
|
||||
unit SemaphorGridLPK;
|
||||
@ -8,13 +7,14 @@ unit SemaphorGridLPK;
|
||||
interface
|
||||
|
||||
uses
|
||||
SemaphorGrids, LazarusPackageIntf;
|
||||
SemaphorGrids, SemaphorDBGrids, LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterUnit('SemaphorGrids', @SemaphorGrids.Register);
|
||||
RegisterUnit('SemaphorDBGrids', @SemaphorDBGrids.Register);
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
@ -35,15 +35,33 @@ the Grid with the method SortFromColumn with indipendent sorting method (maybe
|
||||
it should be better to use onCompareCell)
|
||||
That's all
|
||||
Enjoy! Salvatore
|
||||
|
||||
Date: 15-Jan-2005
|
||||
- Changed SortFromColumn: now it use SortColRow, OnCompareCells and
|
||||
DoCompareChange (from Jesus Rejes A.);
|
||||
- Removed SortDate, SortNumeric, uses Windows (now useless)
|
||||
- Correct some repainting problems (from Jesus Rejes A.)
|
||||
- removed ReDrawGrid (now useless)
|
||||
|
||||
Date: 03-Apr-2005
|
||||
- Some sources cleaning
|
||||
- introduced System Metrics in AutoWidth and AutoHeight (keep in count
|
||||
scrollbars);
|
||||
|
||||
knowed bug:
|
||||
re-sorting a column that have two or more cells equal, the
|
||||
corrispondent rows are swapped, so there are more than one grid sorted by
|
||||
the same column.
|
||||
}
|
||||
|
||||
unit SemaphorGrids;
|
||||
{$mode objfpc}
|
||||
{$H+}
|
||||
interface
|
||||
|
||||
uses
|
||||
{$ifdef win32}Windows,{$endif win32} Classes, SysUtils,
|
||||
LResources, LCLtype, Forms, Controls, Graphics, Dialogs, Grids;
|
||||
Classes, SysUtils, LResources, LCLProc, LCLIntf, LCLType, Forms, Controls,
|
||||
Graphics, Dialogs, Grids;
|
||||
|
||||
const
|
||||
SemaphorMarker='S_M_0_1';
|
||||
@ -57,6 +75,9 @@ type
|
||||
TTypeSort = (tsAlphabetic, tsDate, tsNumeric, tsAutomatic);
|
||||
|
||||
type
|
||||
|
||||
{ TSemaphorGrid }
|
||||
|
||||
TSemaphorGrid = class(TStringGrid)
|
||||
private
|
||||
{ Private declarations }
|
||||
@ -71,31 +92,22 @@ type
|
||||
FSemaphorShape : TSemaphorShape;
|
||||
FSemaphorCaseSensitive : boolean;
|
||||
FSemaphorOnlyFloat : boolean;
|
||||
procedure AutoInitialize;
|
||||
FSortDirection: TDirection;
|
||||
FSortType: TTypeSort;
|
||||
procedure SetAlignment(Value: TAlignment);
|
||||
function GetAlignment: TAlignment;
|
||||
function GetCHSEP : Char;
|
||||
procedure SetCHSEP(Value : Char);
|
||||
function GetSemaphor : boolean;
|
||||
procedure SetSemaphor(Value : boolean);
|
||||
function GetStringRed : string;
|
||||
procedure SetStringRed(Value : string);
|
||||
function GetStringYellow : string;
|
||||
procedure SetStringYellow(Value : string);
|
||||
function GetStringGreen : string;
|
||||
procedure SetStringGreen(Value : string);
|
||||
function GetSemaphorShape : TSemaphorShape;
|
||||
procedure SetSemaphorShape(Value : TSemaphorShape);
|
||||
function GetSemaphorCaseSensitive : boolean;
|
||||
procedure SetSemaphorCaseSensitive(Value : boolean);
|
||||
function GetSemaphorOnlyFloat : boolean;
|
||||
procedure SetSemaphorOnlyFloat(Value : boolean);
|
||||
protected
|
||||
{ Protected declarations }
|
||||
procedure DrawCell(aCol,aRow: Integer; aRect: TRect; aState:TGridDrawState); override;
|
||||
function DoCompareCells(Acol,ARow,Bcol,BRow: Integer): Integer; override;
|
||||
procedure KeyPress(var Key: Char); override;
|
||||
procedure SortDate(var SL: TStringList);
|
||||
procedure SortNumeric(var SL: TStringList);
|
||||
public
|
||||
{ Public declarations }
|
||||
procedure LoadFromFileG(FileName:string;autoadjust:boolean);
|
||||
@ -112,93 +124,31 @@ type
|
||||
function Duplicate(var SG:TSemaphorGrid):boolean;
|
||||
procedure ClearColRow(isColumn:boolean; i:integer);
|
||||
procedure Clear(OnlyValue:boolean);
|
||||
procedure ReDrawGrid;
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
published
|
||||
{ Published declarations }
|
||||
property Constraints;
|
||||
property Alignment: TAlignment read GetAlignment write SetAlignment;
|
||||
property CHSEP : Char read GetCHSEP write SetCHSEP;
|
||||
property Semaphor : boolean read GetSemaphor write SetSemaphor;
|
||||
property StringRed : string read GetStringRed write SetStringRed;
|
||||
property StringYellow : string read GetStringYellow write SetStringYellow;
|
||||
property StringGreen : string read GetStringGreen write SetStringGreen;
|
||||
property SemaphorShape : TSemaphorShape read GetSemaphorShape write SetSemaphorShape;
|
||||
property SemaphorCaseSensitive : boolean read GetSemaphorCaseSensitive write SetSemaphorCaseSensitive;
|
||||
property SemaphorOnlyFloat : boolean read GetSemaphorOnlyFloat write SetSemaphorOnlyFloat;
|
||||
property Alignment: TAlignment read FAlignment write SetAlignment;
|
||||
property CHSEP : Char read FCHSEP write SetCHSEP;
|
||||
property Semaphor : boolean read FSemaphor write SetSemaphor;
|
||||
property StringRed : string read FStringRed write SetStringRed;
|
||||
property StringYellow : string read FStringYellow write SetStringYellow;
|
||||
property StringGreen : string read FStringGreen write SetStringGreen;
|
||||
property SemaphorShape : TSemaphorShape read FSemaphorShape write SetSemaphorShape;
|
||||
property SemaphorCaseSensitive : boolean read FSemaphorCaseSensitive write SetSemaphorCaseSensitive;
|
||||
property SemaphorOnlyFloat : boolean read FSemaphorOnlyFloat write SetSemaphorOnlyFloat;
|
||||
end;
|
||||
|
||||
procedure Register;
|
||||
|
||||
implementation
|
||||
|
||||
procedure TSemaphorGrid.SortDate(var SL: TStringList);
|
||||
var i,j:integer;
|
||||
date1, date2:TDate;
|
||||
str1,str2:string;
|
||||
founded:boolean;
|
||||
begin
|
||||
for i:=0 to SL.Count-2 do begin
|
||||
j:=i+1;
|
||||
str1:=SL.Strings[j];
|
||||
date1:=StrToDate(Copy(str1,1,pos(CHSEP,str1)-1));
|
||||
founded:=false;
|
||||
while (j<>0)and(not founded)do begin
|
||||
str2:=SL.Strings[j-1];
|
||||
date2:=StrToDate(Copy(str2,1,pos(CHSEP,str2)-1));
|
||||
if date1>=date2 then
|
||||
founded:=true
|
||||
else begin
|
||||
SL.Strings[j]:=SL.Strings[j-1];
|
||||
j:=j-1
|
||||
end;
|
||||
SL.Strings[j]:=str1;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSemaphorGrid.SortNumeric(var SL: TStringList);
|
||||
var i,j:integer;
|
||||
num1, num2:double;
|
||||
str1,str2:string;
|
||||
strn1,strn2:string;
|
||||
founded:boolean;
|
||||
begin
|
||||
for i:=0 to SL.Count-2 do begin
|
||||
j:=i+1;
|
||||
str1:=SL.Strings[j];
|
||||
strn1:=Copy(str1,1,pos(CHSEP,str1)-1);
|
||||
try
|
||||
num1:=StrToFloat(strn1);
|
||||
except
|
||||
num1:=0;
|
||||
end;
|
||||
founded:=false;
|
||||
while (j<>0)and(not founded)do begin
|
||||
str2:=SL.Strings[j-1];
|
||||
strn2:=Copy(str2,1,pos(CHSEP,str2)-1);
|
||||
try
|
||||
num2:=StrToFloat(strn2);
|
||||
except
|
||||
num2:=0;
|
||||
end;
|
||||
if num1>=num2 then
|
||||
founded:=true
|
||||
else begin
|
||||
SL.Strings[j]:=SL.Strings[j-1];
|
||||
j:=j-1
|
||||
end;
|
||||
SL.Strings[j]:=str1;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSemaphorGrid.DrawCell(aCol,aRow: Integer; aRect: TRect; aState:TGridDrawState);
|
||||
const
|
||||
dr=4;
|
||||
const dr=4;
|
||||
var Rect:TRect;
|
||||
MyStyle:TTextStyle;
|
||||
OldBrushColor: TColor;
|
||||
begin
|
||||
PrepareCanvas(aCol,aRow,aState);
|
||||
Canvas.FillRect(aRect);
|
||||
@ -442,25 +392,33 @@ begin
|
||||
end;
|
||||
|
||||
procedure TSemaphorGrid.AutoWidth;
|
||||
const dx=3;
|
||||
var j:integer;
|
||||
var j,Wtmp:integer;
|
||||
begin
|
||||
Width:=0;
|
||||
Wtmp:=0;
|
||||
if BorderStyle=bsSingle then
|
||||
Width:=Width+2*dx;
|
||||
Wtmp:=Wtmp+2*GetSystemMetrics(SM_CXFIXEDFRAME);
|
||||
for j:=0 to ColCount-1 do
|
||||
Width:=Width+ColWidths[j];
|
||||
Wtmp:=Wtmp+GridLineWidth+ColWidths[j];
|
||||
Wtmp:=Wtmp-2*GridLineWidth;
|
||||
if ScrollBarIsVisible(SB_Vert) then begin
|
||||
Wtmp:=Wtmp+GetSystemMetrics(SM_CXVSCROLL);//+GetSystemMetrics(SM_CXEDGE);
|
||||
end;
|
||||
Width:=Wtmp;
|
||||
end;
|
||||
|
||||
procedure TSemaphorGrid.AutoHeight;
|
||||
const dy=3;
|
||||
var i:integer;
|
||||
var i,Htmp:integer;
|
||||
begin
|
||||
Height:=0;
|
||||
Htmp:=0;
|
||||
if BorderStyle=bsSingle then
|
||||
Height:=Height+2*dy;
|
||||
Htmp:=Htmp+2*GetSystemMetrics(SM_CYFIXEDFRAME);
|
||||
for i:=0 to RowCount-1 do
|
||||
Height:=Height+RowHeights[i];
|
||||
Htmp:=Htmp+GridLineWidth+RowHeights[i];
|
||||
Htmp:=Htmp-2*GridLineWidth;
|
||||
if ScrollBarIsVisible(SB_Horz) then begin
|
||||
Htmp:=Htmp+GetSystemMetrics(SM_CYVSCROLL);
|
||||
end;
|
||||
Height:=Htmp;
|
||||
end;
|
||||
|
||||
{ FileName: file to export data; SelfExt: if true SemaphorGrid change the file
|
||||
@ -485,6 +443,46 @@ begin
|
||||
CHSEP:=CHSEPOld
|
||||
end;
|
||||
|
||||
function TSemaphorGrid.DoCompareCells(Acol, ARow, Bcol, BRow: Integer): Integer;
|
||||
var
|
||||
S1,S2: String;
|
||||
V1,V2: Extended;
|
||||
D1,D2: TDate;
|
||||
begin
|
||||
case FSortType of
|
||||
tsAlphabetic:
|
||||
begin
|
||||
S1 := Cells[ACol,ARow];
|
||||
S2 := Cells[BCol,BRow];
|
||||
if S1>S2 then Result := 1 else
|
||||
if S1<S2 then Result := -1
|
||||
else result := 0;
|
||||
end;
|
||||
tsNumeric, tsDate:
|
||||
begin
|
||||
if fSortType = tsNumeric then begin
|
||||
V1 := StrToFloatDef(Cells[ACol,ARow], 0.0);
|
||||
V2 := StrToFloatDef(Cells[BCol,BRow], 0.0);
|
||||
end else begin
|
||||
V1 := StrToDate(Cells[ACol,ARow]);
|
||||
V2 := StrToDate(Cells[BCol,BRow]);
|
||||
end;
|
||||
if V1>V2 then
|
||||
Result := 1
|
||||
else if V1<V2 then
|
||||
Result := -1
|
||||
else
|
||||
result := 0;
|
||||
end;
|
||||
end;
|
||||
if FSortDirection=sdDescending then begin
|
||||
if Result<0 then result:=1 else
|
||||
if result>0 then result:=-1;
|
||||
end;
|
||||
if assigned(OnCompareCells) then
|
||||
OnCompareCells(Self, ACol,ARow,BCol,BRow, Result);
|
||||
end;
|
||||
|
||||
procedure TSemaphorGrid.DeleteColumn(j:integer);
|
||||
begin
|
||||
DeleteColRow(true,j);
|
||||
@ -496,88 +494,42 @@ begin
|
||||
end;
|
||||
|
||||
procedure TSemaphorGrid.SortFromColumn(j:integer; TS:TTypeSort; SD:TDirection; autoadjust:boolean);
|
||||
label uscita;
|
||||
const basename='namerow';
|
||||
FileTemp='Filetemp.tmp';
|
||||
var i,fr:integer;
|
||||
valNum:double;
|
||||
valDate:TDate;
|
||||
strNomeFiletmp,WinTemp:string;
|
||||
MyStringsList:TStringList;
|
||||
{$ifndef linux}
|
||||
buffer: array [0..Max_path] of Char;
|
||||
{$endif linux}
|
||||
function AutomaticSortType: TTypeSort;
|
||||
var i: Integer;
|
||||
begin
|
||||
// returns the sort type of a omogeneus column j
|
||||
// for non omogeneus, Alphabetical is assumed
|
||||
Result:=tsNumeric;
|
||||
for i:=FixedRows to RowCount-1 do
|
||||
if Cells[j,i]<>'' then
|
||||
try
|
||||
StrToFloat(Cells[j,i]);
|
||||
except
|
||||
Result:=tsDate;
|
||||
break;
|
||||
end;
|
||||
if Result=tsNumeric then
|
||||
exit;
|
||||
for i:=FixedRows to RowCount-1 do
|
||||
if Cells[j,i]<>'' then
|
||||
try
|
||||
StrToDate(Cells[j,i]);
|
||||
except
|
||||
Result:=tsAlphabetic;
|
||||
break;
|
||||
end;
|
||||
end;
|
||||
begin
|
||||
if RowCount-FixedRows<=1 then
|
||||
exit;
|
||||
if TS=tsAutomatic then begin
|
||||
TS:=tsAlphabetic;
|
||||
for i:=FixedRows to RowCount-1 do begin
|
||||
if Cells[j,i]<>'' then
|
||||
try
|
||||
valNum:=StrToFloat(Cells[j,i]);
|
||||
except
|
||||
break;
|
||||
end;
|
||||
TS:=tsNumeric;
|
||||
goto uscita;
|
||||
end;
|
||||
for i:=FixedRows to RowCount-1 do begin
|
||||
if Cells[j,i]<>'' then
|
||||
try
|
||||
valDate:=StrToDate(Cells[j,i]);
|
||||
except
|
||||
break;
|
||||
end;
|
||||
TS:=tsDate;
|
||||
goto uscita;
|
||||
end;
|
||||
end;
|
||||
uscita:
|
||||
{$ifdef linux}WinTemp:='/tmp';{$else linux}
|
||||
GetTempPath(SizeOf(buffer),buffer);//uses Windows
|
||||
WinTemp:=buffer;
|
||||
{$endif linux}
|
||||
fr:=FixedRows; //save the FixedRows begin
|
||||
for i:=1 to fr do begin
|
||||
strNomeFiletmp:=WinTemp+basename+IntToStr(i)+'.tmp';
|
||||
Rows[0].SaveToFile(strNomeFiletmp);
|
||||
DeleteRow(0);
|
||||
end;//save the FixedRows end
|
||||
|
||||
ExchangeColRow(true,0,j);
|
||||
|
||||
MyStringsList:=TStringList.Create;
|
||||
SaveToFileG(WinTemp+FileTemp,false);
|
||||
MyStringsList.LoadFromFile(WinTemp+FileTemp);
|
||||
case TS of
|
||||
tsAlphabetic: MyStringsList.Sort;
|
||||
tsDate: SortDate(MyStringsList);
|
||||
tsNumeric: SortNumeric(MyStringsList);
|
||||
end;
|
||||
|
||||
if SD=sdDescending then
|
||||
for i:=0 to ((MyStringsList.Count-1)div 2) do
|
||||
MyStringsList.Exchange(i,MyStringsList.Count-1-i);
|
||||
|
||||
MyStringsList.SaveToFile(WinTemp+FileTemp);
|
||||
LoadFromFileG(WinTemp+FileTemp,autoadjust);
|
||||
DeleteFile(pchar(WinTemp+FileTemp));
|
||||
MyStringsList.Free;
|
||||
|
||||
ExchangeColRow(true,0,j);
|
||||
for i:=fr downto 1 do begin //restore the FixedRows begin
|
||||
RowCount:=RowCount+1;
|
||||
strNomeFiletmp:=WinTemp+basename+IntToStr(i)+'.tmp';
|
||||
MyStringsList:=TStringList.Create;
|
||||
MyStringsList.LoadFromFile(strNomeFiletmp);
|
||||
Rows[RowCount-1]:=MyStringsList;
|
||||
MyStringsList.Free;
|
||||
MoveColRow(false,RowCount-1,0);
|
||||
DeleteFile(PChar(strNomeFiletmp));
|
||||
end; //restore the FixedRows end
|
||||
if Ts=tsAutomatic then
|
||||
FSortType := AutomaticSortType
|
||||
else
|
||||
FSortType := Ts;
|
||||
FSortDirection := SD;
|
||||
BeginUpdate;
|
||||
SortColRow(True, J);
|
||||
if autoadjust then
|
||||
AutoAdjustColumns;
|
||||
EndUpdate(true);
|
||||
end;
|
||||
|
||||
procedure TSemaphorGrid.HideCol(j:integer);
|
||||
@ -623,14 +575,14 @@ begin
|
||||
ExWidths.Delete(1);
|
||||
ExWidths.Delete(0);
|
||||
end;
|
||||
(* alternativa
|
||||
(* as different solution
|
||||
for j:=0 to ColCount-1 do
|
||||
ShowCol(j);
|
||||
*)
|
||||
end;
|
||||
|
||||
function TSemaphorGrid.Duplicate(var SG:TSemaphorGrid):Boolean;
|
||||
var i,j:integer; //from Coppola da migliorare
|
||||
var i,j:integer; // da migliorare
|
||||
duptmp:Boolean;
|
||||
begin
|
||||
duptmp:=True;
|
||||
@ -669,25 +621,63 @@ begin
|
||||
end
|
||||
end;
|
||||
|
||||
procedure TSemaphorGrid.ReDrawGrid;
|
||||
var aCol,aRow:integer;
|
||||
aRect:TRect;
|
||||
aState:TGridDrawState;
|
||||
procedure TSemaphorGrid.SetAlignment(Value: TAlignment);
|
||||
begin
|
||||
for aRow:=0 to RowCount-1 do
|
||||
for aCol:=0 to ColCount-1 do begin
|
||||
aRect:=CellRect(aCol,aRow);
|
||||
aState:=[];
|
||||
if (aCol<FixedCols)or(aRow<FixedRows) then
|
||||
aState:=aState+[gdFixed];
|
||||
if (aCol=Col)and(aRow=Row) then
|
||||
aState:=aState+[gdFocused];
|
||||
DrawCell(aCol,aRow,aRect,aState);
|
||||
end
|
||||
If FAlignment <> Value then begin
|
||||
FAlignment := Value;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSemaphorGrid.AutoInitialize;
|
||||
procedure TSemaphorGrid.SetCHSEP(Value : Char);
|
||||
begin
|
||||
FCHSEP:=Value;
|
||||
end;
|
||||
|
||||
procedure TSemaphorGrid.SetSemaphor(Value : boolean);
|
||||
begin
|
||||
FSemaphor:=Value;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TSemaphorGrid.SetStringRed(Value : string);
|
||||
begin
|
||||
FStringRed:=Value;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TSemaphorGrid.SetStringYellow(Value : string);
|
||||
begin
|
||||
FStringYellow:=Value;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TSemaphorGrid.SetStringGreen(Value : string);
|
||||
begin
|
||||
FStringGreen:=Value;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TSemaphorGrid.SetSemaphorShape(Value : TSemaphorShape);
|
||||
begin
|
||||
FSemaphorShape:=Value;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TSemaphorGrid.SetSemaphorCaseSensitive(Value : boolean);
|
||||
begin
|
||||
FSemaphorCaseSensitive:=Value;
|
||||
invalidate;
|
||||
end;
|
||||
|
||||
procedure TSemaphorGrid.SetSemaphorOnlyFloat(Value : boolean);
|
||||
begin
|
||||
FSemaphorOnlyFloat:=Value;
|
||||
end;
|
||||
|
||||
constructor TSemaphorGrid.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
FCHSEP:=#255;
|
||||
Semaphor:=False;
|
||||
StringRed:='no';
|
||||
@ -701,105 +691,6 @@ begin
|
||||
ExWidths:=TStringList.Create;
|
||||
end;
|
||||
|
||||
procedure TSemaphorGrid.SetAlignment(Value: TAlignment);
|
||||
begin
|
||||
If FAlignment <> Value then begin
|
||||
FAlignment := Value;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TSemaphorGrid.GetAlignment: TAlignment;
|
||||
begin
|
||||
Result := FAlignment;
|
||||
end;
|
||||
|
||||
function TSemaphorGrid.GetCHSEP : Char;
|
||||
begin
|
||||
Result:=FCHSEP;
|
||||
end;
|
||||
|
||||
procedure TSemaphorGrid.SetCHSEP(Value : Char);
|
||||
begin
|
||||
FCHSEP:=Value;
|
||||
end;
|
||||
|
||||
function TSemaphorGrid.GetSemaphor : boolean;
|
||||
begin
|
||||
Result:=FSemaphor;
|
||||
end;
|
||||
|
||||
procedure TSemaphorGrid.SetSemaphor(Value : boolean);
|
||||
begin
|
||||
FSemaphor:=Value;
|
||||
end;
|
||||
|
||||
function TSemaphorGrid.GetStringRed : string;
|
||||
begin
|
||||
Result:=FStringRed;
|
||||
end;
|
||||
|
||||
procedure TSemaphorGrid.SetStringRed(Value : string);
|
||||
begin
|
||||
FStringRed:=Value;
|
||||
end;
|
||||
|
||||
function TSemaphorGrid.GetStringYellow : string;
|
||||
begin
|
||||
Result:=FStringYellow;
|
||||
end;
|
||||
|
||||
procedure TSemaphorGrid.SetStringYellow(Value : string);
|
||||
begin
|
||||
FStringYellow:=Value;
|
||||
end;
|
||||
|
||||
function TSemaphorGrid.GetStringGreen : string;
|
||||
begin
|
||||
Result:=FStringGreen;
|
||||
end;
|
||||
|
||||
procedure TSemaphorGrid.SetStringGreen(Value : string);
|
||||
begin
|
||||
FStringGreen:=Value;
|
||||
end;
|
||||
|
||||
function TSemaphorGrid.GetSemaphorShape : TSemaphorShape;
|
||||
begin
|
||||
Result:=FSemaphorShape;
|
||||
end;
|
||||
|
||||
procedure TSemaphorGrid.SetSemaphorShape(Value : TSemaphorShape);
|
||||
begin
|
||||
FSemaphorShape:=Value;
|
||||
end;
|
||||
|
||||
function TSemaphorGrid.GetSemaphorCaseSensitive : boolean;
|
||||
begin
|
||||
Result:=FSemaphorCaseSensitive;
|
||||
end;
|
||||
|
||||
procedure TSemaphorGrid.SetSemaphorCaseSensitive(Value : boolean);
|
||||
begin
|
||||
FSemaphorCaseSensitive:=Value;
|
||||
end;
|
||||
|
||||
function TSemaphorGrid.GetSemaphorOnlyFloat : boolean;
|
||||
begin
|
||||
Result:=FSemaphorOnlyFloat;
|
||||
end;
|
||||
|
||||
procedure TSemaphorGrid.SetSemaphorOnlyFloat(Value : boolean);
|
||||
begin
|
||||
FSemaphorOnlyFloat:=Value;
|
||||
end;
|
||||
|
||||
constructor TSemaphorGrid.Create(AOwner: TComponent);
|
||||
begin
|
||||
AutoInitialize;
|
||||
inherited Create(AOwner);
|
||||
end;
|
||||
|
||||
destructor TSemaphorGrid.Destroy;
|
||||
begin
|
||||
ExWidths.Free;
|
||||
@ -816,4 +707,3 @@ initialization
|
||||
|
||||
end.
|
||||
|
||||
|
||||
|
@ -1,17 +1,34 @@
|
||||
LazarusResources.Add('TSemaphorGrid','XPM',[
|
||||
|
||||
'/* XPM */'#13#10'static char * TSemaforoGrid_xpm[] = {'#13#10'"23 23 10 1",'
|
||||
|
||||
+#13#10'" '#9'c None",'#13#10'".'#9'c #000000",'#13#10'"+'#9'c #FF0000",'#13
|
||||
|
||||
+#10'"@'#9'c #C0C0C0",'#13#10'"#'#9'c #FFFFFF",'#13#10'"$'#9'c #46A057",'#13
|
||||
|
||||
+#10'"%'#9'c #FFFF00",'#13#10'"&'#9'c #008000",'#13#10'"*'#9'c #1D0101",'#13
|
||||
|
||||
+#10'"='#9'c #0E0000",'#13#10'" ",'#13#10'" ...........'
|
||||
|
||||
+'..... ++ ",'#13#10'" .@.#@@@@#@@@@@@. ++++ ",'#13#10'" ................ +'
|
||||
|
||||
+'+++ ",'#13#10'" .@.####@#######. ++ ",'#13#10'" .#.#$$#@#%%%%%#. ",'
|
||||
|
||||
+#13#10'" .@.####@#######. %% ",'#13#10'" .#.#++#@#....##. %%%% ",'#13#10'"'
|
||||
|
||||
+' .@.####@#######. %%%% ",'#13#10'" .#.#%%#@#$$$$$#. %% ",'#13#10'" .@.###'
|
||||
|
||||
+'#@#######. ",'#13#10'" .#.#..#@#++++##. && ",'#13#10'" .@.####@#####'
|
||||
|
||||
+'##. &&&& ",'#13#10'" *=.............. &&&& ",'#13#10'" + &&'
|
||||
|
||||
+' ",'#13#10'" + ",'#13#10'" ++ +++ ++ ",'#13
|
||||
|
||||
+#10'" + + + + + ",'#13#10'" +++ + + + ",'#13#10'" +'
|
||||
|
||||
+' + + + + ",'#13#10'" + + + + + + ",'#13#10'" +++ +++'
|
||||
|
||||
+' ++ ",'#13#10'" "};'#13#10
|
||||
|
||||
]);
|
||||
|
||||
|
@ -1,36 +1,72 @@
|
||||
/* XPM */
|
||||
|
||||
static char * TSemaforoGrid_xpm[] = {
|
||||
|
||||
"23 23 10 1",
|
||||
|
||||
" c None",
|
||||
|
||||
". c #000000",
|
||||
|
||||
"+ c #FF0000",
|
||||
|
||||
"@ c #C0C0C0",
|
||||
|
||||
"# c #FFFFFF",
|
||||
|
||||
"$ c #46A057",
|
||||
|
||||
"% c #FFFF00",
|
||||
|
||||
"& c #008000",
|
||||
|
||||
"* c #1D0101",
|
||||
|
||||
"= c #0E0000",
|
||||
|
||||
" ",
|
||||
|
||||
" ................ ++ ",
|
||||
|
||||
" .@.#@@@@#@@@@@@. ++++ ",
|
||||
|
||||
" ................ ++++ ",
|
||||
|
||||
" .@.####@#######. ++ ",
|
||||
|
||||
" .#.#$$#@#%%%%%#. ",
|
||||
|
||||
" .@.####@#######. %% ",
|
||||
|
||||
" .#.#++#@#....##. %%%% ",
|
||||
|
||||
" .@.####@#######. %%%% ",
|
||||
|
||||
" .#.#%%#@#$$$$$#. %% ",
|
||||
|
||||
" .@.####@#######. ",
|
||||
|
||||
" .#.#..#@#++++##. && ",
|
||||
|
||||
" .@.####@#######. &&&& ",
|
||||
|
||||
" *=.............. &&&& ",
|
||||
|
||||
" + && ",
|
||||
|
||||
" + ",
|
||||
|
||||
" ++ +++ ++ ",
|
||||
|
||||
" + + + + + ",
|
||||
|
||||
" +++ + + + ",
|
||||
|
||||
" + + + + + ",
|
||||
|
||||
" + + + + + + ",
|
||||
|
||||
" +++ +++ ++ ",
|
||||
|
||||
" "};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user