parent
174e8f077c
commit
e9d9e0d2e9
|
|
@ -2483,6 +2483,7 @@ type TComboBox = class(TcustomComboBox)
|
|||
"visible","anchors","align","enabled","parentcolor","parentfont",
|
||||
"height","width","left","top",
|
||||
"readonly","itemindex",
|
||||
"checkbox","multisel",
|
||||
"items","dropdowncount","oncloseup","ondropdown","onselchanged","oneditchanged");
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3257,12 +3257,24 @@ type tcustomsynhighlighter = class(TSynHighLighter)
|
|||
if n then
|
||||
begin
|
||||
st := fcbgestate[n];
|
||||
if fswordpairs[n][1]=lttk then
|
||||
if fswordpairs[n,2] then
|
||||
begin
|
||||
st.GetRight();
|
||||
if st.state then
|
||||
begin
|
||||
st.GetRight();
|
||||
end else
|
||||
begin
|
||||
st.GetLeft();
|
||||
end
|
||||
end else
|
||||
begin
|
||||
st.GetLeft();
|
||||
if fswordpairs[n][1]=lttk then
|
||||
begin
|
||||
st.GetRight();
|
||||
end else
|
||||
begin
|
||||
st.GetLeft();
|
||||
end
|
||||
end
|
||||
d.FMATe := st.GetSate();
|
||||
end
|
||||
|
|
@ -3446,6 +3458,7 @@ type tcustomsynhighlighter = class(TSynHighLighter)
|
|||
begin
|
||||
fswordpairs[v1,0]:= v0;
|
||||
fswordpairs[v1,1]:= v1;
|
||||
fswordpairs[v1,2] := (v0=v1);
|
||||
fswordpairshash[v0]:=v1;
|
||||
fswordpairshash[v1]:=v1;
|
||||
fswordpairshashdata[i] := v;
|
||||
|
|
|
|||
|
|
@ -1794,6 +1794,7 @@ type tpairstate =class //
|
|||
begin
|
||||
echo "²ã¼¶:",FCJ," ÐòºÅ:",FIndexs[FIndex],"״̬:", FCstate;
|
||||
end
|
||||
property state read FState;
|
||||
function Clone();
|
||||
begin
|
||||
r := new tpairstate(FType);
|
||||
|
|
|
|||
|
|
@ -654,6 +654,20 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
|
|||
**}
|
||||
FMergers := array();
|
||||
end
|
||||
//*******************
|
||||
property ItemCount read GetItemCount write SetItemCount;
|
||||
property ItemHeight read FRowHeight write SetRowHeigt;
|
||||
property MouseSizeCell read FMouseSizeColumnWidth write FMouseSizeColumnWidth;
|
||||
property FixedRows read FFixedRows write SetFixedRows;
|
||||
property FixedColumns read FColumFixed write SetFixedColumns;
|
||||
property ColumnCount read GetColumnCount;
|
||||
property VariableRows read FVariableRows write SetVariableRows;
|
||||
{**
|
||||
@param(ItemCount)(integer) 行数 %%
|
||||
@param(MouseSizeCell)(bool) 鼠标改变列宽 %%
|
||||
@param(FixedRows)(integer) 固定的行数作为列标 %%
|
||||
**}
|
||||
private
|
||||
function GetGridMargin();
|
||||
begin
|
||||
return array(FMarginLeft,FMarginTop,FMarginRight,FMarginBottom);
|
||||
|
|
@ -687,20 +701,6 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
|
|||
end
|
||||
if f then DoControlAlign();
|
||||
end
|
||||
//*******************
|
||||
property ItemCount read GetItemCount write SetItemCount;
|
||||
property ItemHeight read FRowHeight write SetRowHeigt;
|
||||
property MouseSizeCell read FMouseSizeColumnWidth write FMouseSizeColumnWidth;
|
||||
property FixedRows read FFixedRows write SetFixedRows;
|
||||
property FixedColumns read FColumFixed write SetFixedColumns;
|
||||
property ColumnCount read GetColumnCount;
|
||||
property VariableRows read FVariableRows write SetVariableRows;
|
||||
{**
|
||||
@param(ItemCount)(integer) 行数 %%
|
||||
@param(MouseSizeCell)(bool) 鼠标改变列宽 %%
|
||||
@param(FixedRows)(integer) 固定的行数作为列标 %%
|
||||
**}
|
||||
private
|
||||
function allwidth();
|
||||
begin
|
||||
return FxWidth;
|
||||
|
|
|
|||
|
|
@ -1398,8 +1398,21 @@ type teditable=class(TSLUIBASE) //
|
|||
r[3]-= 1;
|
||||
return r;
|
||||
end
|
||||
function WMKEYUP(o,e);virtual;
|
||||
begin
|
||||
if FOnKeyUp then
|
||||
begin
|
||||
CallMessgeFunction(FOnKeyUp,o,e);
|
||||
if e.skip then return ;
|
||||
end
|
||||
end
|
||||
function WMKEYDOWN(o,e);virtual;//按键
|
||||
begin
|
||||
if FOnKeyDown then
|
||||
begin
|
||||
CallMessgeFunction(FOnKeyDown,o,e);
|
||||
if e.skip then return ;
|
||||
end
|
||||
fsft := ssShift in e.shiftstate;
|
||||
fctl := ssCtrl in e.shiftstate;
|
||||
case e.CharCode of
|
||||
|
|
@ -1463,6 +1476,11 @@ type teditable=class(TSLUIBASE) //
|
|||
end
|
||||
function WMCHAR(o,e);virtual;//字符
|
||||
begin
|
||||
if fOnKeyPress then
|
||||
begin
|
||||
CallMessgeFunction(fOnKeyPress,o,e);
|
||||
if e.skip then return ;
|
||||
end
|
||||
if fcanundo then fredolist.clear();//清空
|
||||
c := e.CharCode;
|
||||
case c of
|
||||
|
|
@ -1638,6 +1656,9 @@ type teditable=class(TSLUIBASE) //
|
|||
FOnMaxText := 0;
|
||||
FOnUpdate := 0;
|
||||
FOnChange := 0;
|
||||
FOnKeyUp := nil;
|
||||
FOnKeyDown := nil;
|
||||
fOnKeyPress := nil;
|
||||
Fplaceholder := 0;
|
||||
FHost := nil;
|
||||
FFont := nil;
|
||||
|
|
@ -1655,6 +1676,9 @@ type teditable=class(TSLUIBASE) //
|
|||
property ClientRect read FClientRect write FClientRect; //区域
|
||||
property host read FHost write SetHost;
|
||||
property HasFocus read FSetFocused;
|
||||
property OnKeyPress read FOnKeyPress write FOnKeyPress;
|
||||
property OnKeyDown read FOnKeyDown write FOnKeyDown;
|
||||
property onkeyup read FOnKeyUp write FOnKeyUp;
|
||||
property Focusedborder read FFocusBorder write FFocusBorder;
|
||||
private
|
||||
fcanundo;
|
||||
|
|
@ -1668,6 +1692,9 @@ type teditable=class(TSLUIBASE) //
|
|||
FOnMaxText;
|
||||
FOnUpdate;
|
||||
FOnChange;
|
||||
FOnKeyPress;
|
||||
FOnKeyDown;
|
||||
FOnKeyUp;
|
||||
Fplaceholder;
|
||||
FSetFocused;
|
||||
FFocusBorder;
|
||||
|
|
@ -2301,7 +2328,6 @@ type tcustomedit=class(TCustomControl)
|
|||
function Create(AOwner);override;
|
||||
begin
|
||||
inherited;
|
||||
|
||||
end
|
||||
function AfterConstruction();override;
|
||||
begin
|
||||
|
|
@ -2560,7 +2586,7 @@ type tthreeEntry=class(TCustomControl)
|
|||
if not ifarray(r)then return array(0,0,0,0);
|
||||
return r;
|
||||
end
|
||||
function WMCHAR(o,e):WM_CHAR;override;
|
||||
function WMCHAR(o,e);override;
|
||||
begin
|
||||
case e.char of
|
||||
"0" to "9":return inherited;
|
||||
|
|
@ -2693,7 +2719,7 @@ type tthreeEntry=class(TCustomControl)
|
|||
begin
|
||||
if v.HasFocus then return v.SetFocus();
|
||||
end
|
||||
for i,v in FEditable do
|
||||
for i,v in FEntrys do
|
||||
begin
|
||||
return v.SetFocus();
|
||||
end
|
||||
|
|
@ -3291,24 +3317,39 @@ type TcustomListBox=class(TCustomListBoxbase)
|
|||
**}
|
||||
if FMultisel=1 then
|
||||
begin
|
||||
flg := false;
|
||||
if isValidIndex(n)then
|
||||
begin
|
||||
if FSelBegin=n then return ;
|
||||
FSelBegin := FSelEnd := n;
|
||||
InvalidateRect(nil,false);
|
||||
flg := true;
|
||||
|
||||
end else
|
||||
if ifarray(n) and isValidIndex(n[1])and isValidIndex(n[0])then
|
||||
begin
|
||||
FSelBegin := MinValue(n);
|
||||
FSelEnd := MaxValue(n);
|
||||
n1 := MinValue(n);
|
||||
n2 := MaxValue(n);
|
||||
if n1<>FSelBegin or n2<>FSelEnd then
|
||||
begin
|
||||
FSelBegin := n1;
|
||||
FSelEnd := n2;
|
||||
flg := true;
|
||||
end
|
||||
end
|
||||
if flg then
|
||||
begin
|
||||
InvalidateRect(nil,false);
|
||||
if FselectionChange then
|
||||
CallMessgeFunction(FselectionChange,self(true),new tuieventbase(0,0,0,0));
|
||||
end
|
||||
return;
|
||||
end else
|
||||
if FMultisel=2 then
|
||||
begin
|
||||
FMultisel3Data := array();
|
||||
FMultisel3Data2 := array();
|
||||
if isValidIndex(n)then
|
||||
begin
|
||||
FMultisel3Data[n]:= true;
|
||||
FMultisel3Data2[n]:= true;
|
||||
end else
|
||||
if ifarray(n)then
|
||||
begin
|
||||
|
|
@ -3316,10 +3357,17 @@ type TcustomListBox=class(TCustomListBoxbase)
|
|||
begin
|
||||
if isValidIndex(v)then
|
||||
begin
|
||||
FMultisel3Data[v]:= true;
|
||||
FMultisel3Data2[v]:= true;
|
||||
end
|
||||
end
|
||||
end
|
||||
if FMultisel3Data2<>FMultisel3Data then
|
||||
begin
|
||||
FMultisel3Data := FMultisel3Data2;
|
||||
InvalidateRect(nil,false);
|
||||
if FselectionChange then
|
||||
CallMessgeFunction(FselectionChange,self(true),new tuieventbase(0,0,0,0));
|
||||
end
|
||||
return;
|
||||
end
|
||||
if not(isValidIndex2(n)) or n=FSelBegin then return;
|
||||
|
|
@ -3972,9 +4020,12 @@ type TcustomComboBox=class(TCustomComboBoxbase)
|
|||
function create(AOwner);override;
|
||||
begin
|
||||
inherited;
|
||||
fmultisel := false;
|
||||
fcheckbox := false;
|
||||
FEdit := new TcustomEdit(self);
|
||||
FEdit.OnKeyDown := function(o,e)
|
||||
begin
|
||||
if FMultisel then return ;
|
||||
case e.charcode of
|
||||
VK_UP:
|
||||
begin
|
||||
|
|
@ -3990,9 +4041,11 @@ type TcustomComboBox=class(TCustomComboBoxbase)
|
|||
end
|
||||
FEdit.onchange := function(o,e);
|
||||
begin
|
||||
if not o.Readonly then
|
||||
if not(o.Readonly) then
|
||||
begin
|
||||
feditischanging := true;
|
||||
CallMessgeFunction(Foneditchanged,o,e);
|
||||
if FMultisel then return feditischanging:=false;
|
||||
t := o.Text;
|
||||
if t = getCurrentItemText() then return ;
|
||||
for i,v in items do
|
||||
|
|
@ -4000,15 +4053,17 @@ type TcustomComboBox=class(TCustomComboBoxbase)
|
|||
if t = v then
|
||||
begin
|
||||
ItemIndex := i;
|
||||
feditischanging := false;
|
||||
return ;
|
||||
end
|
||||
end
|
||||
ItemIndex := -1;
|
||||
feditischanging := false;
|
||||
end
|
||||
end
|
||||
FEdit.onupdate := function(o,e);
|
||||
begin
|
||||
if not o.Readonly then
|
||||
if not(o.Readonly) then
|
||||
begin
|
||||
CallMessgeFunction(FoneditUpdate,o,e);
|
||||
end
|
||||
|
|
@ -4019,13 +4074,11 @@ type TcustomComboBox=class(TCustomComboBoxbase)
|
|||
FListBox.WsPopUp := true;
|
||||
FListBox.onselectionchange := function(o,e);
|
||||
begin
|
||||
if feditischanging then return ;
|
||||
r := getCurrentItemText();
|
||||
if r then
|
||||
begin
|
||||
FEdit.Text := r;
|
||||
ShowDropDown(false);
|
||||
CallMessgeFunction(OnSelchanged,self,e);
|
||||
end
|
||||
FEdit.Text := r;
|
||||
ShowDropDown(false);
|
||||
CallMessgeFunction(OnSelchanged,self(true),e);
|
||||
end
|
||||
FEdit.Readonly := Freadonly;
|
||||
FListBox.parent := self;
|
||||
|
|
@ -4123,9 +4176,22 @@ type TcustomComboBox=class(TCustomComboBoxbase)
|
|||
@explan(说明)获取选中的子项字符串 %%
|
||||
@return(string) 子项字符串 %%
|
||||
**}
|
||||
return getItemText(FListBox.GetCurrentSelection());
|
||||
idx := FListBox.GetCurrentSelection();
|
||||
if FMultisel then
|
||||
begin
|
||||
r := "";
|
||||
for i,v in idx do
|
||||
begin
|
||||
r+=getItemText(v)+";";
|
||||
end
|
||||
if r then r[length(r):]:="";
|
||||
return r;
|
||||
end
|
||||
return getItemText(idx);
|
||||
end
|
||||
property readonly:bool read Freadonly write setReadOnly;
|
||||
property Multisel:bool read fmultisel write setMultisel;
|
||||
property checkbox:bool read fcheckbox write setcheckbox;
|
||||
property textheight read FTextHeight Write FTextHeight;
|
||||
property itemheight read FItemHeight write FItemHeight;
|
||||
property items:strings read Getitems write setItems;
|
||||
|
|
@ -4137,6 +4203,32 @@ type TcustomComboBox=class(TCustomComboBoxbase)
|
|||
{**
|
||||
@param(oneditchanged)(function[tcomboBox,tuieventbase])文本被改变回调,文本显示后调用%%
|
||||
**}
|
||||
|
||||
private
|
||||
function setMultisel(v);
|
||||
begin
|
||||
nv := v?true:false;
|
||||
if nv<>FMultisel then
|
||||
begin
|
||||
FMultisel := nv;
|
||||
if FMultisel then
|
||||
begin
|
||||
FListBox.Multisel := 2;
|
||||
end else
|
||||
begin
|
||||
FListBox.Multisel := 0;
|
||||
end
|
||||
end
|
||||
end
|
||||
function setcheckbox(v);
|
||||
begin
|
||||
nv := v?true:false;
|
||||
if nv<>fcheckbox then
|
||||
begin
|
||||
fcheckbox := nv;
|
||||
FListBox.checkbox := nv;
|
||||
end
|
||||
end
|
||||
function setReadOnly(v);
|
||||
begin
|
||||
nv := v?true:false;
|
||||
|
|
@ -4146,15 +4238,19 @@ type TcustomComboBox=class(TCustomComboBoxbase)
|
|||
FEdit.Readonly := nv;
|
||||
end
|
||||
end
|
||||
private
|
||||
function GetItemIndex();override;
|
||||
begin
|
||||
if FMultisel and (csDesigning in ComponentState) then return -1;
|
||||
return FListBox.GetCurrentSelection();
|
||||
end
|
||||
function SetItemIndex(idx);override;
|
||||
begin
|
||||
if FMultisel and (csDesigning in ComponentState) then return -1;
|
||||
return FListBox.SetCurrentSelection(idx);
|
||||
end
|
||||
feditischanging;//¸Ä±äÕýÔڻص÷
|
||||
fmultisel;
|
||||
fcheckbox;
|
||||
FTextHeight;
|
||||
FItemHeight;
|
||||
Freadonly;
|
||||
|
|
@ -5357,19 +5453,6 @@ type TCustomSpinEdit = class(TCustomControl)
|
|||
end
|
||||
end;
|
||||
end
|
||||
type TSpinCEdit=class(tcustomedit)
|
||||
function create(AOwner);override;
|
||||
begin
|
||||
inherited;
|
||||
border := false;
|
||||
caption := "0";
|
||||
end
|
||||
function SetDesigning(f,fc);
|
||||
begin
|
||||
if f then Enabled := false;
|
||||
else Enabled := true;
|
||||
end
|
||||
end
|
||||
FChar;
|
||||
protected
|
||||
function UpdateControl();virtual;
|
||||
|
|
@ -5378,15 +5461,13 @@ type TCustomSpinEdit = class(TCustomControl)
|
|||
end
|
||||
function GetValue();virtual;
|
||||
begin
|
||||
if FEdit.HandleAllocated()then
|
||||
r := FEdit.text;
|
||||
r := StrToIntDef(r,FValue);
|
||||
if r <> FValue then
|
||||
begin
|
||||
r := FEdit.text;
|
||||
r := StrToIntDef(r,FValue);
|
||||
if r <> FValue then
|
||||
begin
|
||||
FValue := r;
|
||||
end
|
||||
FValue := r;
|
||||
end
|
||||
|
||||
return FValue;
|
||||
end
|
||||
procedure SetValue(const AValue:Double);virtual;
|
||||
|
|
@ -5457,6 +5538,14 @@ type TCustomSpinEdit = class(TCustomControl)
|
|||
end
|
||||
end
|
||||
public
|
||||
function dosetfocus(o,e);override;
|
||||
begin
|
||||
FEdit.setFocus();
|
||||
end
|
||||
function dokillfocus(o,e);override;
|
||||
begin
|
||||
FEdit.killFocus();
|
||||
end
|
||||
function editkeypress(o,e);virtual;
|
||||
begin
|
||||
c := e.wparam;
|
||||
|
|
@ -5480,9 +5569,11 @@ type TCustomSpinEdit = class(TCustomControl)
|
|||
height := 25;
|
||||
Width := 60;
|
||||
FUDwidth := 20;
|
||||
FEdit := new TSpinCEdit(self);
|
||||
FEdit := new teditable(self);
|
||||
FEdit.Visible := true;
|
||||
FEdit.border := true;
|
||||
FEdit.OnKeyPress := thisfunction(editkeypress);
|
||||
FEdit.parent := self;
|
||||
FEdit.host := self(true);
|
||||
FUPrect := array();
|
||||
FDownrect := array();
|
||||
CI_UP := 1;
|
||||
|
|
@ -5495,21 +5586,15 @@ type TCustomSpinEdit = class(TCustomControl)
|
|||
end
|
||||
function Recycling();override;
|
||||
begin
|
||||
FEdit.OnKeyPress := nil;
|
||||
FEdit.Recycling();
|
||||
fedit := nil;
|
||||
inherited;
|
||||
end
|
||||
|
||||
function DoControlAlign(rect);override;
|
||||
begin
|
||||
rect := ClientRect;
|
||||
{$ifdef linux}
|
||||
if csDesigning in ComponentState then
|
||||
begin
|
||||
rect[0]+=2;
|
||||
rect[1]+=2;
|
||||
rect[3]-=2;
|
||||
end
|
||||
{$endif}
|
||||
FEdit.SetBounds(rect[0],rect[1],rect[2]-FUDwidth,rect[3]);
|
||||
FEdit.ClientRect := array(rect[0],rect[1],rect[2]-FUDwidth,rect[3]);
|
||||
cl := rect; //ClientRect();
|
||||
cl[0]:= cl[2]-FUDwidth;
|
||||
cl2 := cl;
|
||||
|
|
@ -5519,21 +5604,51 @@ type TCustomSpinEdit = class(TCustomControl)
|
|||
FUPrect := cl;
|
||||
FDownrect := CL2;
|
||||
end
|
||||
function WMKEYDOWN(o,e);override;
|
||||
begin
|
||||
if csDesigning in ComponentState then return ;
|
||||
fedit.WMKEYDOWN(o,e);
|
||||
if e.CharCode=VK_UP then
|
||||
begin
|
||||
doIncrease(o,e);
|
||||
end else
|
||||
if e.CharCode = VK_DOWN then
|
||||
begin
|
||||
doDcrease(o,e);
|
||||
end
|
||||
end
|
||||
function WMCHAR(o,e);override;
|
||||
begin
|
||||
if csDesigning in ComponentState then return ;
|
||||
FEdit.WMCHAR(o,e);
|
||||
end
|
||||
function MouseDown(o,e);override;
|
||||
begin
|
||||
if csDesigning in ComponentState then return ;
|
||||
p := e.pos;
|
||||
if pointinrect(p,FEdit.ClientRect)then
|
||||
begin
|
||||
return FEdit.MouseDown(o,e);
|
||||
end
|
||||
end
|
||||
function MouseUp(o,e);override;
|
||||
begin
|
||||
if csDesigning in ComponentState then return ;
|
||||
FEdit.MouseUp(o,e);
|
||||
if FCI=CI_DOWN then
|
||||
begin
|
||||
doDcrease(o,e);
|
||||
//InValidateRect(nil,false);
|
||||
return ;
|
||||
end else
|
||||
if FCI=CI_UP then
|
||||
begin
|
||||
doIncrease(o,e);
|
||||
//InValidateRect(nil,false);
|
||||
return ;
|
||||
end
|
||||
end
|
||||
function MouseMove(o,e);override;
|
||||
begin
|
||||
if csDesigning in ComponentState then return ;
|
||||
p := e.pos;
|
||||
if pointinrect(p,FUPrect)then
|
||||
begin
|
||||
|
|
@ -5545,10 +5660,12 @@ type TCustomSpinEdit = class(TCustomControl)
|
|||
end else
|
||||
begin
|
||||
FCI := 0;
|
||||
FEdit.MouseMove(o,e);
|
||||
end
|
||||
end
|
||||
function paint();override;
|
||||
begin
|
||||
FEdit.paint();
|
||||
DrawItem(CI_UP,CIS_NONE);
|
||||
DrawItem(CI_DOWN,CIS_NONE);
|
||||
end
|
||||
|
|
@ -5876,7 +5993,7 @@ type tcustomipaddr = class(TCustomControl)
|
|||
FPrev.ExecuteCommand("ecsel",array(10,1));
|
||||
end
|
||||
end
|
||||
function WMCHAR(o,e):WM_CHAR;override;
|
||||
function WMCHAR(o,e);override;
|
||||
begin
|
||||
case e.char of
|
||||
"0" to "9" :
|
||||
|
|
|
|||
Loading…
Reference in New Issue