git-svn-id: https://svn.code.sf.net/p/kolmck/code@93 91bb2d04-0c0c-4d2d-88a5-bbb6f4c1fa07
This commit is contained in:
dkolmck
2010-12-03 15:28:22 +00:00
parent e8ca1a22b8
commit 60caec3b22
2 changed files with 354 additions and 363 deletions

239
KOL.pas
View File

@ -14,7 +14,7 @@
Key Objects Library (C) 2000 by Kladov Vladimir. Key Objects Library (C) 2000 by Kladov Vladimir.
**************************************************************** ****************************************************************
* VERSION 3.00.Z7 * VERSION 3.00.Z8
**************************************************************** ****************************************************************
K.O.L. - is a set of objects to create small programs K.O.L. - is a set of objects to create small programs
@ -12415,6 +12415,10 @@ type
{* This event is called on reading each item while scanning directory. {* This event is called on reading each item while scanning directory.
To use it, first create PDirList object with empty path to scan, then To use it, first create PDirList object with empty path to scan, then
assign OnItem event and call ScanDirectory with correct path. } assign OnItem event and call ScanDirectory with correct path. }
procedure DeleteItem( Idx: Integer );
{* Allows to delete an item from the directory list (not from the disk!) }
procedure AddItem( FindData: PFindFileData );
{* Allows to add arbitrary item to the list. }
end; end;
function NewDirList( const DirPath, Filter: KOLString; Attr: DWORD ): PDirList; function NewDirList( const DirPath, Filter: KOLString; Attr: DWORD ): PDirList;
@ -25738,9 +25742,52 @@ begin
end; end;
end; end;
{$IFDEF WIN_GDI} //vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv procedure TDirList.DeleteItem(Idx: Integer);
begin
FListPositions.Delete( Idx );
end;
procedure TDirList.AddItem(FindData: PFindFileData);
begin
if fStoreFiles = nil then
begin
{$IFDEF DIRLIST_FASTER}
fStoreFiles := NewMemBlkStream_WriteOnly( 32 * Sizeof( FindData ) );
{$ELSE}
fStoreFiles := NewMemoryStream( );
fStoreFiles.Capacity := 64 * Sizeof( FindData );
{$ENDIF}
FListPositions := NewList;
end;
{$IFDEF DIRLIST_FASTER}{$ELSE}
FListPositions.Add( Pointer( fStoreFiles.Position ) );
{$ENDIF}
{$IFDEF UNICODE_CTRLS}
{$IFDEF SPEED_FASTER}
{$IFDEF DIRLIST_OPTIMIZE_ASCII}
FindData.dwReserved0 := 0;
P := @ FindData.cFileName[0];
while P^ <> #0 do
begin
if PWord( P )^ > 255 then
begin
inc( FindData.dwReserved0 );
break;
end;
inc( P );
end;
{$ENDIF}
{$ENDIF}
{$ENDIF}
fStoreFiles.Write( FindData^, Sizeof( FindData^ ) );
{$IFDEF DIRLIST_FASTER}
FListPositions.Add( fStoreFiles.fData.fJustWrittenBlkAddress );
{$ENDIF}
end;
{$IFDEF WIN_GDI} //vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// R E G I S T R Y // R E G I S T R Y //
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
{ -- registry -- } { -- registry -- }
@ -34755,7 +34802,7 @@ begin
Result := TRUE; Result := TRUE;
{$IFDEF NIL_EVENTS} {$IFDEF NIL_EVENTS}
if assigned( Self_.EV.fOnChar ) then if assigned( Sender.EV.fOnChar ) then
{$ENDIF} {$ENDIF}
begin begin
C := KOLChar( Msg.wParam ); C := KOLChar( Msg.wParam );
@ -53946,7 +53993,10 @@ var BFH : TBitmapFileHeader;
end else end else
while n > 0 do while n > 0 do
begin begin
Strm.WriteVal( 1, 1 ); if n = 1 then
Strm.WriteVal( 01, 1 )
else
Strm.WriteVal( 02, 1 );
Strm.WriteVal( P[i] shl 4 or P[i+1], 1 ); Strm.WriteVal( P[i] shl 4 or P[i+1], 1 );
inc( i, 2 ); inc( i, 2 );
dec( n, 2 ); dec( n, 2 );
@ -63084,10 +63134,7 @@ begin
Result := FALSE; Result := FALSE;
if (Msg.message = WM_PAINT) {or (Msg.message = WM_PRINT)} then if (Msg.message = WM_PAINT) {or (Msg.message = WM_PRINT)} then
begin begin WasOnPaint := Self_.EV.fOnPaint;
//if not Result then
begin
WasOnPaint := Self_.EV.fOnPaint;
Self_.{$IFDEF EVENTS_DYNAMIC} ProvideUniqueEvents {$ELSE} EV {$ENDIF} Self_.{$IFDEF EVENTS_DYNAMIC} ProvideUniqueEvents {$ELSE} EV {$ENDIF}
.fOnPaint2 := Self_.EV.fOnPaint; .fOnPaint2 := Self_.EV.fOnPaint;
//Self_.fPaintMsg := Msg; //Self_.fPaintMsg := Msg;
@ -63119,10 +63166,8 @@ begin
if not Result then if not Result then
{Result :=} WndProcPaint( Self_, Msg, Rslt ); {Result :=} WndProcPaint( Self_, Msg, Rslt );
Self_.EV.fOnPaint := WasOnPaint; Self_.EV.fOnPaint := WasOnPaint;
end;
Result := TRUE; Result := TRUE;
end end else
else
if (Msg.message >= WM_MOUSEFIRST) and (Msg.message <= WM_MOUSELAST) then if (Msg.message >= WM_MOUSEFIRST) and (Msg.message <= WM_MOUSELAST) then
begin begin
Pt.X := SmallInt( LoWord( Msg.lParam ) ); Pt.X := SmallInt( LoWord( Msg.lParam ) );
@ -63297,46 +63342,35 @@ begin
C.EV.fLeave := C.LeaveGraphButton; C.EV.fLeave := C.LeaveGraphButton;
C.RefDec; C.RefDec;
end; end;
end; end;////////////////////////////////////////////////////////////////////////////
function WndProc_FormHavingGraphCtl( Self_: PControl; var Msg: TMsg; var Rslt: Integer ): Boolean; function WndProc_FormHavingGraphCtl( Self_: PControl; var Msg: TMsg; var Rslt: Integer ): Boolean;
var Msg2: TMsg; var Msg2: TMsg;
begin begin Result := FALSE;
Result := FALSE;
if Msg.message = WM_ACTIVATE then if Msg.message = WM_ACTIVATE then
begin begin if Self_.DF.fCurrentControl <> nil then
if Self_.DF.fCurrentControl <> nil then
Self_.DF.fCurrentControl.Invalidate; Self_.DF.fCurrentControl.Invalidate;
end end else
else
if (Msg.message >= WM_KEYFIRST) and (Msg.message <= WM_KEYLAST) then if (Msg.message >= WM_KEYFIRST) and (Msg.message <= WM_KEYLAST) then
begin begin if (Self_.DF.fCurrentControl <> nil)
if (Self_.DF.fCurrentControl <> nil)
and {$IFDEF USE_FLAGS} (G6_GraphicCtl in Self_.DF.fCurrentControl.fFlagsG6) and {$IFDEF USE_FLAGS} (G6_GraphicCtl in Self_.DF.fCurrentControl.fFlagsG6)
{$ELSE} not Self_.DF.fCurrentControl.fWindowed {$ENDIF} then {$ELSE} not Self_.DF.fCurrentControl.fWindowed {$ENDIF} then
begin begin if (Msg.message = WM_KEYDOWN) and ((Msg.wParam = 32) or (Msg.wParam = 13)) then
if (Msg.message = WM_KEYDOWN) and ((Msg.wParam = 32) or (Msg.wParam = 13)) then begin if not PeekMessage( Msg2, Msg.hwnd, WM_CHAR, WM_CHAR, pm_noRemove )
begin or (Msg2.wParam <> Msg.wParam) then
if not PeekMessage( Msg2, Msg.hwnd, WM_CHAR, WM_CHAR, pm_noRemove ) or
(Msg2.wParam <> Msg.wParam) then
Msg.message := WM_CHAR; Msg.message := WM_CHAR;
end end else
else
if (Msg.message = WM_SYSKEYDOWN) and ((Msg.wParam = 32) or (Msg.wParam = 13)) then if (Msg.message = WM_SYSKEYDOWN) and ((Msg.wParam = 32) or (Msg.wParam = 13)) then
begin begin if not PeekMessage( Msg2, Msg.hwnd, WM_SYSCHAR, WM_SYSCHAR, pm_noRemove ) or
if not PeekMessage( Msg2, Msg.hwnd, WM_SYSCHAR, WM_SYSCHAR, pm_noRemove ) or
(Msg2.wParam <> Msg.wParam) then (Msg2.wParam <> Msg.wParam) then
Msg.message := WM_SYSCHAR; Msg.message := WM_SYSCHAR;
end; end;
if Assigned( Self_.DF.fCurrentControl.fKeyboardProcess ) and if Assigned( Self_.DF.fCurrentControl.fKeyboardProcess ) and
Self_.DF.fCurrentControl.fKeyboardProcess( Msg, Rslt ) then Self_.DF.fCurrentControl.fKeyboardProcess( Msg, Rslt ) then
else else Rslt := Self_.DF.fCurrentControl.WndProc( Msg );
Rslt := Self_.DF.fCurrentControl.WndProc( Msg );
Result := TRUE; Result := TRUE;
end; end;
end; end;
end; end;////////////////////////////////////////////////////////////////////////////
{$IFDEF GRAPHCTL_HOTTRACK} {$IFDEF GRAPHCTL_HOTTRACK}
procedure TControl.MouseLeaveFromParentOfGraphCtl(Sender: PObj); procedure TControl.MouseLeaveFromParentOfGraphCtl(Sender: PObj);
var C: PControl; var C: PControl;
@ -63371,23 +63405,18 @@ end;
function _NewGraphCtl( AParent: PControl; ATabStop: Boolean; function _NewGraphCtl( AParent: PControl; ATabStop: Boolean;
ACommandActions: TCommandActionsParam ): PControl; ACommandActions: TCommandActionsParam ): PControl;
var IdxActions: Integer; var IdxActions: Integer;
begin begin new( Result, Create );
new( Result, Create ); {$IFDEF DEBUG_OBJKIND} Result.fObjKind := 'TControl:GraphicControl';
{$IFDEF DEBUG_OBJKIND}
Result.fObjKind := 'TControl:GraphicControl';
{$ENDIF} {$ENDIF}
{$IFDEF COMMANDACTIONS_OBJ} {$IFDEF COMMANDACTIONS_OBJ}
IdxActions := Integer( ACommandActions ); IdxActions := Integer( ACommandActions );
if IdxActions >= 120 then if IdxActions >= 120 then
IdxActions := PByte( ACommandActions )^; IdxActions := PByte( ACommandActions )^;
if AllActions_Objs[IdxActions] <> nil then if AllActions_Objs[IdxActions] <> nil then
begin begin Result.fCommandActions := AllActions_Objs[IdxActions];
Result.fCommandActions := AllActions_Objs[IdxActions];
Result.fCommandActions.RefInc; Result.fCommandActions.RefInc;
end end else
else begin new( Result.fCommandActions, Create );
begin
new( Result.fCommandActions, Create );
{$IFDEF DEBUG_OBJKIND} {$IFDEF DEBUG_OBJKIND}
Result.fCommandActions.fObjKind := 'TCommandActionsObj'; Result.fCommandActions.fObjKind := 'TCommandActionsObj';
{$ENDIF} {$ENDIF}
@ -63398,8 +63427,7 @@ begin
Move( ACommandActions^, Result.fCommandActions.aClear, Sizeof( TCommandActions ) ); Move( ACommandActions^, Result.fCommandActions.aClear, Sizeof( TCommandActions ) );
end; end;
Result.Add2AutoFree( Result.fCommandActions ); Result.Add2AutoFree( Result.fCommandActions );
{$ELSE} {$ELSE} {$IFDEF SAFE_CODE}
{$IFDEF SAFE_CODE}
if ACommandActions <> nil then if ACommandActions <> nil then
{$ENDIF} {$ENDIF}
Result.fCommandActions := ACommandActions^; Result.fCommandActions := ACommandActions^;
@ -63429,13 +63457,11 @@ begin
if ATabStop then if ATabStop then
Result.fLookTabKeys := [ tkTab, tkLeftRight, tkUpDown, tkPageUpPageDn ]; Result.fLookTabKeys := [ tkTab, tkLeftRight, tkUpDown, tkPageUpPageDn ];
if AParent <> nil then if AParent <> nil then
begin begin Result.Parent := AParent;
Result.Parent := AParent;
Result.Border := AParent.Border; Result.Border := AParent.Border;
AParent.AttachProc( WndProc_ParentOfGraphicCtl ); AParent.AttachProc( WndProc_ParentOfGraphicCtl );
if ATabStop then if ATabStop then
begin begin Inc( AParent.ParentForm.fTabOrder );
Inc( AParent.ParentForm.fTabOrder );
Result.fTabOrder := AParent.ParentForm.fTabOrder; Result.fTabOrder := AParent.ParentForm.fTabOrder;
end; end;
if {$IFDEF USE_FLAGS} G3_IsControl in AParent.fFlagsG3 if {$IFDEF USE_FLAGS} G3_IsControl in AParent.fFlagsG3
@ -63443,16 +63469,14 @@ begin
AParent.ParentForm.AttachProc( WndProc_FormHavingGraphCtl ); AParent.ParentForm.AttachProc( WndProc_FormHavingGraphCtl );
if {$IFDEF USE_FLAGS} G5_IsGroupbox in APArent.fFlagsG5 if {$IFDEF USE_FLAGS} G5_IsGroupbox in APArent.fFlagsG5
{$ELSE} AParent.fIsGroupBox {$ENDIF} then {$ELSE} AParent.fIsGroupBox {$ENDIF} then
begin begin AParent.Style := AParent.Style and
AParent.Style := AParent.Style and
not BS_GROUPBOX; // otherwise the groupbox is flickering A LOT! not BS_GROUPBOX; // otherwise the groupbox is flickering A LOT!
AParent.Parent.AttachProc( WndProc_ParentOfGraphicCtl ); AParent.Parent.AttachProc( WndProc_ParentOfGraphicCtl );
end; end;
Result.fFont := Result.fFont.Assign( AParent.fFont ); Result.fFont := Result.fFont.Assign( AParent.fFont );
if Result.fFont <> nil then if Result.fFont <> nil then
begin begin Result.fFont.fParentGDITool := AParent.fFont;
Result.fFont.fParentGDITool := AParent.fFont;
Result.fFont.fOnChange := Result.FontChanged; Result.fFont.fOnChange := Result.FontChanged;
Result.FontChanged( Result.fFont ); Result.FontChanged( Result.fFont );
end; end;
@ -63465,14 +63489,10 @@ begin
if WinVer < wvXP then if WinVer < wvXP then
DoNotDrawGraphCtlsUsingXPStyles := TRUE; DoNotDrawGraphCtlsUsingXPStyles := TRUE;
{$ENDIF} {$ENDIF}
end; end;////////////////////////////////////////////////////////////////////////////
function NewGraphLabel( AParent: PControl; const ACaption: AnsiString ): PControl; function NewGraphLabel( AParent: PControl; const ACaption: AnsiString ): PControl;
begin begin {$IFDEF INPACKAGE} Result := NewLabel( AParent, ACaption );
{$IFDEF INPACKAGE} {$ELSE} Result := _NewGraphCtl( AParent, FALSE,
Result := NewLabel( AParent, ACaption );
{$ELSE}
Result := _NewGraphCtl( AParent, FALSE,
{$IFDEF PACK_COMMANDACTIONS} LabelActions_Packed {$IFDEF PACK_COMMANDACTIONS} LabelActions_Packed
{$ELSE} @LabelActions {$ENDIF} ); {$ELSE} @LabelActions {$ENDIF} );
Result.aAutoSzX := 1; Result.aAutoSzX := 1;
@ -63480,32 +63500,21 @@ begin
Result.EV.fPaintProc := Result.GraphicLabelPaint; Result.EV.fPaintProc := Result.GraphicLabelPaint;
Result.Caption := ACaption; Result.Caption := ACaption;
{$ENDIF} {$ENDIF}
end; end;////////////////////////////////////////////////////////////////////////////
function NewWordWrapGraphLabel( AParent: PControl; const ACaption: KOLString ): PControl; function NewWordWrapGraphLabel( AParent: PControl; const ACaption: KOLString ): PControl;
begin begin {$IFDEF INPACKAGE} Result := NewWordWrapLabel( AParent, ACaption );
{$IFDEF INPACKAGE} {$ELSE} Result := NewGraphLabel( AParent, ACaption );
Result := NewWordWrapLabel( AParent, ACaption );
{$ELSE}
Result := NewGraphLabel( AParent, ACaption );
{$IFDEF USE_FLAGS} include( Result.fFlagsG1, G1_WordWrap ); {$IFDEF USE_FLAGS} include( Result.fFlagsG1, G1_WordWrap );
{$ELSE} Result.fWordWrap := TRUE; {$ENDIF} {$ELSE} Result.fWordWrap := TRUE; {$ENDIF}
{$ENDIF} {$ENDIF}
end; end;////////////////////////////////////////////////////////////////////////////
function NewGraphPaintBox( AParent: PControl ): PControl; function NewGraphPaintBox( AParent: PControl ): PControl;
begin begin {$IFDEF INPACKAGE} Result := NewPaintbox( AParent );
{$IFDEF INPACKAGE} {$ELSE} Result := NewGraphLabel( AParent, '' ); {$ENDIF}
Result := NewPaintbox( AParent ); end;////////////////////////////////////////////////////////////////////////////
{$ELSE}
Result := NewGraphLabel( AParent, '' );
{$ENDIF}
end;
procedure ClickGraphCheck(Sender: PObj); procedure ClickGraphCheck(Sender: PObj);
var Ctl: PControl; var Ctl: PControl;
begin begin Ctl := Pointer( Sender );
Ctl := Pointer( Sender );
if not Ctl.Enabled then Exit; if not Ctl.Enabled then Exit;
Ctl.Focused := TRUE; Ctl.Focused := TRUE;
if Assigned( Ctl.OnEnter ) then if Assigned( Ctl.OnEnter ) then
@ -63518,76 +63527,57 @@ begin
Ctl.Invalidate; Ctl.Invalidate;
if Assigned( Ctl.OnClick ) then if Assigned( Ctl.OnClick ) then
Ctl.OnClick( Ctl ); Ctl.OnClick( Ctl );
end; end;////////////////////////////////////////////////////////////////////////////
function NewGraphCheckBox( AParent: PControl; const ACaption: KOLString ): PControl; function NewGraphCheckBox( AParent: PControl; const ACaption: KOLString ): PControl;
begin begin {$IFDEF INPACKAGE} Result := NewCheckbox( AParent, ACaption );
{$IFDEF INPACKAGE} {$ELSE} Result := NewGraphButton( AParent, ACaption );
Result := NewCheckbox( AParent, ACaption );
{$ELSE}
Result := NewGraphButton( AParent, ACaption );
Result.TextAlign := taLeft; Result.TextAlign := taLeft;
Result.aAutoSzX := GetSystemMetrics( SM_CXMENUCHECK ) + 4; Result.aAutoSzX := GetSystemMetrics( SM_CXMENUCHECK ) + 4;
Result.EV.fPaintProc := Result.GraphicCheckBoxPaint; Result.EV.fPaintProc := Result.GraphicCheckBoxPaint;
Result.EV.fGraphCtlMouseEvent := Result.GraphicCheckBoxMouse; Result.EV.fGraphCtlMouseEvent := Result.GraphicCheckBoxMouse;
Result.PP.fControlClick := @ ClickGraphCheck; Result.PP.fControlClick := @ ClickGraphCheck;
{$ENDIF} {$ENDIF}
end; end;////////////////////////////////////////////////////////////////////////////
procedure ClickGraphRadio(Sender: PObj); procedure ClickGraphRadio(Sender: PObj);
var Ctl, C: PControl; var Ctl, C: PControl;
i: Integer; i: Integer;
begin begin Ctl := Pointer( Sender );
Ctl := Pointer( Sender );
if not Ctl.Enabled then Exit; if not Ctl.Enabled then Exit;
Ctl.Focused := TRUE; Ctl.Focused := TRUE;
Ctl.Checked := TRUE; Ctl.Checked := TRUE;
if Ctl.Parent <> nil then if Ctl.Parent <> nil then
for i := 0 to Ctl.Parent.ChildCount-1 do for i := 0 to Ctl.Parent.ChildCount-1 do
begin begin C := Ctl.Parent.Children[ i ];
C := Ctl.Parent.Children[ i ];
if (C <> Ctl) and (@ C.PP.fControlClick = @ ClickGraphRadio) then if (C <> Ctl) and (@ C.PP.fControlClick = @ ClickGraphRadio) then
C.Checked := FALSE; C.Checked := FALSE;
end; end;
end; end;////////////////////////////////////////////////////////////////////////////
function NewGraphRadioBox( AParent: PControl; const ACaption: KOLString ): PControl; function NewGraphRadioBox( AParent: PControl; const ACaption: KOLString ): PControl;
begin begin {$IFDEF INPACKAGE} Result := NewRadiobox( AParent, ACaption );
{$IFDEF INPACKAGE}
Result := NewRadiobox( AParent, ACaption );
if (@ ClickGraphRadio) <> nil then; if (@ ClickGraphRadio) <> nil then;
{$ELSE} {$ELSE} Result := NewGraphButton( AParent, ACaption );
Result := NewGraphButton( AParent, ACaption );
Result.TextAlign := taLeft; Result.TextAlign := taLeft;
Result.aAutoSzX := GetSystemMetrics( SM_CXMENUCHECK ) + 4; Result.aAutoSzX := GetSystemMetrics( SM_CXMENUCHECK ) + 4;
Result.EV.fPaintProc := Result.GraphicRadioBoxPaint; Result.EV.fPaintProc := Result.GraphicRadioBoxPaint;
Result.PP.fControlClick := @ ClickGraphRadio; Result.PP.fControlClick := @ ClickGraphRadio;
if AParent <> nil then if AParent <> nil then
begin begin AParent.PropInt[ RADIO_LAST ] := Result.fMenu;
//AParent.fRadioLast := Result.fMenu;
AParent.PropInt[ RADIO_LAST ] := Result.fMenu;
//if AParent.fRadio1st = 0 then
if AParent.PropInt[ RADIO_1ST ] = 0 then if AParent.PropInt[ RADIO_1ST ] = 0 then
begin begin AParent.PropInt[ RADIO_1ST ] := Result.fMenu;
//AParent.fRadio1st := Result.fMenu;
AParent.PropInt[ RADIO_1ST ] := Result.fMenu;
Result.SetRadioChecked; Result.SetRadioChecked;
end; end;
end; end;
{$ENDIF} {$ENDIF}
end; end;////////////////////////////////////////////////////////////////////////////
procedure GraphButtonSetFocus(Ctl: PControl); procedure GraphButtonSetFocus(Ctl: PControl);
var PF, CC: PControl; var PF, CC: PControl;
W: HWnd; W: HWnd;
begin begin if {$IFDEF USE_FLAGS} not(F2_Tabstop in Ctl.fStyle.f2_Style)
if {$IFDEF USE_FLAGS} not(F2_Tabstop in Ctl.fStyle.f2_Style)
{$ELSE} not Ctl.fTabStop {$ENDIF} then Exit; {$ELSE} not Ctl.fTabStop {$ENDIF} then Exit;
PF := Ctl.ParentForm; PF := Ctl.ParentForm;
if (PF.DF.fCurrentControl <> nil) and (PF.DF.fCurrentControl <> Ctl) and if (PF.DF.fCurrentControl <> nil) and (PF.DF.fCurrentControl <> Ctl) and
(PF.DF.fCurrentControl <> Ctl.fParent) then (PF.DF.fCurrentControl <> Ctl.fParent) then
begin begin CC := PF.DF.fCurrentControl;
CC := PF.DF.fCurrentControl;
CC.RefInc; CC.RefInc;
Ctl.fParent.Focused := TRUE; Ctl.fParent.Focused := TRUE;
if Assigned( CC.EV.fLeave ) then if Assigned( CC.EV.fLeave ) then
@ -63596,28 +63586,23 @@ begin
Windows.SetFocus( 0 ); Windows.SetFocus( 0 );
CC.RefDec; CC.RefDec;
end else end else
begin begin W := GetFocus;
W := GetFocus;
if (W <> Ctl.Parent.fHandle) and (W <> 0) then if (W <> Ctl.Parent.fHandle) and (W <> 0) then
begin begin Windows.SetFocus( 0 );
Windows.SetFocus( 0 );
Ctl.fParent.Focused := TRUE; Ctl.fParent.Focused := TRUE;
end; end;
end; end;
if Ctl.fParent.fHandle <> 0 then if Ctl.fParent.fHandle <> 0 then
begin begin {$IFDEF USE_FLAGS} include( Ctl.fFlagsG6, G6_Focused );
{$IFDEF USE_FLAGS} include( Ctl.fFlagsG6, G6_Focused );
{$ELSE} Ctl.fFocused := TRUE; {$ENDIF} {$ELSE} Ctl.fFocused := TRUE; {$ENDIF}
Ctl.fParent.Postmsg( CM_FOCUSGRAPHCTL, Integer( Ctl ), 0 ); Ctl.fParent.Postmsg( CM_FOCUSGRAPHCTL, Integer( Ctl ), 0 );
Ctl.RefInc; Ctl.RefInc;
end; end;
if Assigned( Ctl.EV.fOnEnter ) then if Assigned( Ctl.EV.fOnEnter ) then
Ctl.EV.fOnEnter( Ctl ); Ctl.EV.fOnEnter( Ctl );
end; end;////////////////////////////////////////////////////////////////////////////
function NewGraphButton( AParent: PControl; const ACaption: KOLString ): PControl; function NewGraphButton( AParent: PControl; const ACaption: KOLString ): PControl;
begin begin {$IFDEF INPACKAGE}
{$IFDEF INPACKAGE}
Result := NewButton( AParent, ACaption ); Result := NewButton( AParent, ACaption );
{$ELSE} {$ELSE}
Result := _NewGraphCtl( AParent, TRUE, Result := _NewGraphCtl( AParent, TRUE,
@ -63631,12 +63616,10 @@ begin
Result.fSetFocus := @GraphButtonSetFocus; Result.fSetFocus := @GraphButtonSetFocus;
Result.fKeyboardProcess := Result.GraphButtonKeyboardProcess; Result.fKeyboardProcess := Result.GraphButtonKeyboardProcess;
{$ENDIF} {$ENDIF}
end; end;////////////////////////////////////////////////////////////////////////////
function EditGraphEdit(Ctl: PControl): PControl; function EditGraphEdit(Ctl: PControl): PControl;
var E: PControl; var E: PControl;
begin begin E := NewEditBox( Ctl.fParent, Ctl.DF.fEditOptions );
E := NewEditBox( Ctl.fParent, Ctl.DF.fEditOptions );
E.SetBoundsRect( Ctl.BoundsRect ); E.SetBoundsRect( Ctl.BoundsRect );
E.SetAlign( Ctl.Align ); E.SetAlign( Ctl.Align );
E.fTabOrder := Ctl.fTabOrder; E.fTabOrder := Ctl.fTabOrder;

View File

@ -7543,6 +7543,14 @@ asm //cmd //opd
CALL TControl.ParentForm CALL TControl.ParentForm
CMP EAX, EBX CMP EAX, EBX
JE @@ret0 JE @@ret0
{$IFDEF USE_FLAGS}
TEST [EAX].fFlagsG6, 1 shl G6_KeyPreview
{$ELSE}
CMP [EAX].fKeyPreview, 0
{$ENDIF}
JZ @@ret0
{$IFDEF USE_FLAGS} {$IFDEF USE_FLAGS}
OR [EAX].TControl.fFlagsG4, 1 shl G4_Pushed OR [EAX].TControl.fFlagsG4, 1 shl G4_Pushed
{$ELSE} {$ELSE}
@ -14821,6 +14829,6 @@ asm
POP EDI POP EDI
end; end;
//{$ENDIF} {$ENDIF}
//======================================== THE END OF FILE KOL_ASM.inc //======================================== THE END OF FILE KOL_ASM.inc