fixed focus catch for combobox csDropDownList

git-svn-id: trunk@5890 -
This commit is contained in:
mattias 2004-08-30 10:49:20 +00:00
parent c892e4ee98
commit 56ae7a60a2
17 changed files with 211 additions and 98 deletions

View File

@ -264,10 +264,8 @@ Type
procedure Loaded; override; procedure Loaded; override;
procedure Notification(AComponent: TComponent; procedure Notification(AComponent: TComponent;
Operation: TOperation); override; Operation: TOperation); override;
procedure Click; override; procedure Click; override;
procedure EditingDone; override;
procedure WMKillFocus(var Message: TLMKillFocus); message LM_KILLFOCUS;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -343,7 +341,7 @@ Type
function GetButtonValue(Index: Integer): string; function GetButtonValue(Index: Integer): string;
procedure UpdateRadioButtonStates; override; procedure UpdateRadioButtonStates; override;
procedure Loaded; override; procedure Loaded; override;
procedure WMKillFocus(var Message: TLMKillFocus); message LM_KILLFOCUS; procedure EditingDone; override;
public public
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -397,7 +395,7 @@ Type
procedure Notification(AComponent: TComponent; procedure Notification(AComponent: TComponent;
Operation: TOperation); override; Operation: TOperation); override;
procedure Loaded; override; procedure Loaded; override;
procedure WMKillFocus(var Message: TLMKillFocus); message LM_KILLFOCUS; procedure EditingDone; override;
public public
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -462,7 +460,7 @@ Type
procedure UpdateData(Sender: TObject); virtual; procedure UpdateData(Sender: TObject); virtual;
procedure FocusRequest(Sender: TObject); virtual; procedure FocusRequest(Sender: TObject); virtual;
procedure Loaded; override; procedure Loaded; override;
procedure WMKillFocus(var Message: TLMKillFocus); message LM_KILLFOCUS; procedure EditingDone; override;
public public
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -480,7 +478,7 @@ Type
property Enabled; property Enabled;
property Font; property Font;
property ItemHeight; property ItemHeight;
property Items write SetItems; property Items;
property ItemWidth; property ItemWidth;
property MaxLength default -1; property MaxLength default -1;
property OnChange; property OnChange;
@ -531,7 +529,7 @@ Type
procedure UpdateData(Sender: TObject); virtual; procedure UpdateData(Sender: TObject); virtual;
procedure FocusRequest(Sender: TObject); virtual; procedure FocusRequest(Sender: TObject); virtual;
procedure Loaded; override; procedure Loaded; override;
procedure WMKillFocus(var Message: TLMKillFocus); message LM_KILLFOCUS; procedure EditingDone; override;
public public
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -690,8 +688,7 @@ Type
procedure Loaded; override; procedure Loaded; override;
procedure Notification(AComponent: TComponent; procedure Notification(AComponent: TComponent;
Operation: TOperation); override; Operation: TOperation); override;
procedure EditingDone; override;
procedure WMKillFocus(var Message: TLMKillFocus); message LM_KILLFOCUS;
public public
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -1250,6 +1247,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.20 2004/08/30 10:49:20 mattias
fixed focus catch for combobox csDropDownList
Revision 1.19 2004/08/22 22:57:35 mattias Revision 1.19 2004/08/22 22:57:35 mattias
added OnActiveChange from Joost added OnActiveChange from Joost

View File

@ -45,9 +45,9 @@ interface
{$ENDIF} {$ENDIF}
uses uses
Classes, SysUtils, LCLStrConsts, LCLType, LCLProc, LCLIntf, InterfaceBase, Classes, SysUtils, Math, LCLStrConsts, LCLType, LCLProc, LCLIntf,
LResources, GraphType, Graphics, Menus, LMessages, CustomTimer, ActnList, InterfaceBase, LResources, GraphType, Graphics, Menus, LMessages, CustomTimer,
ClipBrd, CustApp, LCLClasses, Controls; ActnList, ClipBrd, CustApp, LCLClasses, Controls;
type type
TProcedure = procedure; TProcedure = procedure;
@ -1163,9 +1163,7 @@ implementation
uses uses
WSForms, // Widgetset uses circle is allowed WSForms; // Widgetset uses circle is allowed
Buttons,
Math;
var var
FocusMessages: Boolean; FocusMessages: Boolean;

View File

@ -241,9 +241,10 @@ end;
Returns the selected part of text-field. Returns the selected part of text-field.
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TCustomComboBox.GetSelText : string; function TCustomComboBox.GetSelText: string;
begin begin
if FStyle < csDropDownList then debugln('TCustomComboBox.GetSelText ');
if FStyle in [csDropDown, csSimple] then
Result:= Copy(Text, SelStart, SelLength) Result:= Copy(Text, SelStart, SelLength)
else else
Result:= ''; Result:= '';
@ -256,11 +257,12 @@ end;
Replace the selected part of text-field with "val". Replace the selected part of text-field with "val".
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure TCustomComboBox.SetSelText(const Val : string); procedure TCustomComboBox.SetSelText(const Val: string);
var var
OldText, NewText: string; OldText, NewText: string;
begin begin
if FStyle < csDropDownList then begin debugln('TCustomComboBox.SetSelText ',Val);
if FStyle in [csDropDown, csSimple] then begin
OldText:=Text; OldText:=Text;
NewText:=LeftStr(OldText,SelStart-1)+Val NewText:=LeftStr(OldText,SelStart-1)+Val
+RightStr(OldText,length(OldText)-SelStart-SelLength+1); +RightStr(OldText,length(OldText)-SelStart-SelLength+1);
@ -332,10 +334,16 @@ end;
Select entire text. Select entire text.
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure TCustomComboBox.SelectAll; procedure TCustomComboBox.SelectAll;
var
CurText: String;
begin begin
if (FStyle < csDropDownList) and (Text <> '') then begin debugln('TCustomComboBox.SelectAll ');
SetSelStart(0); if (FStyle in [csDropDown, csSimple]) then begin
SetSelLength(Length(Text)); CurText:=Text;
if (CurText <> '') then begin
SetSelStart(0);
SetSelLength(Length(CurText));
end;
end; end;
end; end;
@ -350,7 +358,7 @@ procedure TCustomComboBox.SetStyle(Val : TComboBoxStyle);
begin begin
if Val <> FStyle then begin if Val <> FStyle then begin
FStyle:= Val; FStyle:= Val;
if HandleAllocated and (not (csLoading in ComponentState)) then if HandleAllocated and ([csLoading,csDestroying]*ComponentState=[]) then
CNSendMessage(LM_SETPROPERTIES, Self, nil); CNSendMessage(LM_SETPROPERTIES, Self, nil);
end; end;
end; end;
@ -359,7 +367,7 @@ procedure TCustomComboBox.SetArrowKeysTraverseList(Value : Boolean);
begin begin
if Value <> FArrowKeysTraverseList then begin if Value <> FArrowKeysTraverseList then begin
FArrowKeysTraverseList := Value; FArrowKeysTraverseList := Value;
if HandleAllocated and (not (csLoading in ComponentState)) then if HandleAllocated and ([csLoading,csDestroying]*ComponentState=[]) then
CNSendMessage(LM_SETPROPERTIES, Self, nil); CNSendMessage(LM_SETPROPERTIES, Self, nil);
end; end;
end; end;
@ -399,6 +407,16 @@ begin
end; end;
end; end;
end; end;
if Style=csDropDownList then begin
debugln('TCustomComboBox.KeyDown ');
// DropDownList: allow only navigation keys
if not (Key in [VK_UP,VK_DOWN,VK_END,VK_HOME,VK_PRIOR,VK_NEXT,VK_TAB,
VK_RETURN])
then begin
Key:=0;
end;
end;
if Skip then if Skip then
Key := 0 Key := 0
@ -406,15 +424,6 @@ begin
inherited KeyDown(Key, Shift); inherited KeyDown(Key, Shift);
end; end;
procedure TCustomComboBox.KeyPress(var Key : TCharacter);
begin
if (Style=csDropDownList) and (Ord(Key)>31) then
Key:=#0
else
Inherited KeyPress(Key);
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
function TCustomComboBox.SelectItem(const AnItem: String): Boolean; function TCustomComboBox.SelectItem(const AnItem: String): Boolean;
@ -790,6 +799,9 @@ end;
{ {
$Log$ $Log$
Revision 1.43 2004/08/30 10:49:20 mattias
fixed focus catch for combobox csDropDownList
Revision 1.42 2004/08/13 16:40:47 mazen Revision 1.42 2004/08/13 16:40:47 mazen
+ TCharater type used to allow UTF8 keyboard with gtk2 + TCharater type used to allow UTF8 keyboard with gtk2

View File

@ -174,7 +174,12 @@ Begin
//if WindowMenu = AComponent then WindowMenu := nil; //if WindowMenu = AComponent then WindowMenu := nil;
//if ObjectMenuItem = AComponent then ObjectMenuItem := nil; //if ObjectMenuItem = AComponent then ObjectMenuItem := nil;
end; end;
if FActiveControl=AComponent then FActiveControl:=nil; if FActiveControl=AComponent then begin
{$IFDEF VerboseFocus}
debugln('TCustomForm.Notification opRemove FActiveControl=',DbgSName(AComponent));
{$ENDIF}
FActiveControl:=nil;
end;
if AComponent=FDefaultControl then if AComponent=FDefaultControl then
FDefaultControl:=nil; FDefaultControl:=nil;
if AComponent=FCancelControl then if AComponent=FCancelControl then
@ -336,6 +341,7 @@ procedure TCustomForm.SetWindowFocus;
var var
NewFocusControl: TWinControl; NewFocusControl: TWinControl;
begin begin
if [csLoading,csDestroying]*ComponentState<>[] then exit;
if (FActiveControl <> nil) and (FDesigner = nil) then if (FActiveControl <> nil) and (FDesigner = nil) then
NewFocusControl := FActiveControl NewFocusControl := FActiveControl
else else
@ -343,7 +349,7 @@ begin
{$IFDEF VerboseFocus} {$IFDEF VerboseFocus}
DebugLn('TCustomForm.SetWindowFocus ',Name,':',Classname , DebugLn('TCustomForm.SetWindowFocus ',Name,':',Classname ,
' NewFocusControl=',NewFocusControl.Name,':',NewFocusControl.ClassName, ' NewFocusControl=',NewFocusControl.Name,':',NewFocusControl.ClassName,
' HndAlloc=',NewFocusControl.HandleAllocated); ' HndAlloc=',dbgs(NewFocusControl.HandleAllocated));
{$ENDIF} {$ENDIF}
if (not NewFocusControl.HandleAllocated) if (not NewFocusControl.HandleAllocated)
or (not NewFocusControl.Visible) or (not NewFocusControl.Visible)
@ -387,9 +393,9 @@ procedure TCustomForm.WMShowWindow(var message: TLMShowWindow);
begin begin
{$IFDEF VerboseFocus} {$IFDEF VerboseFocus}
DbgOut('TCustomForm.WMShowWindow A ',Name,':',ClassName,' fsShowing=',fsShowing in FFormState,' Msg.Show=',Message.Show); DbgOut('TCustomForm.WMShowWindow A ',Name,':'+ClassName+' fsShowing='+dbgs(fsShowing in FFormState)+' Msg.Show='+dbgs(Message.Show));
if FActiveControl<>nil then begin if FActiveControl<>nil then begin
DbgOut(' FActiveControl=',FActiveControl.Name,':',FActiveControl.ClassName,' HandleAllocated=',FActiveControl.HandleAllocated); DbgOut(' FActiveControl=',FActiveControl.Name,':',FActiveControl.ClassName,' HandleAllocated=',dbgs(FActiveControl.HandleAllocated));
end else begin end else begin
DbgOut(' FActiveControl=nil'); DbgOut(' FActiveControl=nil');
end; end;
@ -399,12 +405,17 @@ begin
Include(FFormState, fsShowing); Include(FFormState, fsShowing);
try try
if Message.Show then begin if Message.Show then begin
if FActiveControl = nil then if FActiveControl = nil then begin
FActiveControl := FindFirstControl; FActiveControl := FindFirstControl;
if (FActiveControl<>nil) and FActiveControl.HandleAllocated
and (FActiveControl.Visible) and (FActiveControl.Enabled) then begin
{$IFDEF VerboseFocus} {$IFDEF VerboseFocus}
DebugLn('TCustomForm.WMShowWindow B ',FActiveControl.Name,':',FActiveControl.ClassName); DebugLn('TCustomForm.WMShowWindow Set FActiveControl := FindFirstControl = ',DbgSName(FActiveControl));
{$ENDIF}
end;
if ([csLoading,csDestroying]*ComponentState=[])
and (FActiveControl<>nil) and FActiveControl.HandleAllocated
and FActiveControl.Visible and FActiveControl.Enabled then begin
{$IFDEF VerboseFocus}
DebugLn('TCustomForm.WMShowWindow SetFocus ',DbgSName(FActiveControl));
{$ENDIF} {$ENDIF}
LCLIntf.SetFocus(FActiveControl.Handle); LCLIntf.SetFocus(FActiveControl.Handle);
end; end;
@ -427,7 +438,7 @@ end;
procedure TCustomForm.WMActivate(var Message : TLMActivate); procedure TCustomForm.WMActivate(var Message : TLMActivate);
begin begin
{$IFDEF VerboseFocus} {$IFDEF VerboseFocus}
DebugLn('TCustomForm.WMActivate A ',Name,':',ClassName,' Msg.Active=',Message.Active); DebugLn('TCustomForm.WMActivate A ',Name,':',ClassName,' Msg.Active=',dbgs(Message.Active));
{$ENDIF} {$ENDIF}
if (FormStyle <> fsMDIForm) or (csDesigning in ComponentState) then if (FormStyle <> fsMDIForm) or (csDesigning in ComponentState) then
SetActive(Message.Active {<> WA_INACTIVE}); SetActive(Message.Active {<> WA_INACTIVE});
@ -555,8 +566,12 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure TCustomForm.DefocusControl(Control: TWinControl; Removing: Boolean); procedure TCustomForm.DefocusControl(Control: TWinControl; Removing: Boolean);
begin begin
if Control.ContainsControl(FActiveControl) then if Control.ContainsControl(FActiveControl) then begin
{$IFDEF VerboseFocus}
debugln('TCustomForm.DefocusControl Control=',DbgSName(Control),' FActiveControl=',DbgSName(FActiveControl));
{$ENDIF}
ActiveControl := nil; ActiveControl := nil;
end;
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -794,15 +809,20 @@ begin
if (Msg = LM_SetFocus) and not (csDesigning in ComponentState) if (Msg = LM_SetFocus) and not (csDesigning in ComponentState)
then begin then begin
FocusHandle := 0; FocusHandle := 0;
if FormStyle = fsMDIFORM if FormStyle = fsMDIFORM
then begin then begin
// ToDo // ToDo
end end
else begin else begin
if (FActiveControl <> nil) and (FActiveControl <> Self) if (FActiveControl <> nil) and (FActiveControl <> Self)
and (FActiveControl.Visible) and (FActiveControl.Enabled) and FActiveControl.Visible and FActiveControl.Enabled
then FocusHandle := FActiveControl.Handle; and ([csLoading,csDestroying]*ComponentState=[])
then
// get or create handle of FActiveControl
FocusHandle := FActiveControl.Handle;
end; end;
TheMessage.Result:=0; TheMessage.Result:=0;
if FocusHandle <> 0 if FocusHandle <> 0
then begin then begin
@ -1082,17 +1102,16 @@ Begin
{$IFDEF VerboseFocus} {$IFDEF VerboseFocus}
write('TCustomForm.SetActiveControl ',Name,':',ClassName,' FActive=',FActive); write('TCustomForm.SetActiveControl ',Name,':',ClassName,' FActive=',FActive);
if FActiveControl<>nil then if FActiveControl<>nil then
DebugLn(' OldActiveControl=',FActiveControl.Name,':',FActiveControl.ClassName) DebugLn(' OldActiveControl=',DbgSName(FActiveControl))
else else
DebugLn(' OldActiveControl=nil'); DebugLn(' OldActiveControl=nil');
if AWinControl<>nil then if AWinControl<>nil then
DebugLn(' NewActiveControl=',AWinControl.Name,':',AWinControl.ClassName) DebugLn(' NewActiveControl=',DbgSName(AWinControl))
else else
DebugLn(' NewActiveControl=nil'); DebugLn(' NewActiveControl=nil');
{$ENDIF} {$ENDIF}
FActiveControl := AWinControl; FActiveControl := AWinControl;
if not (csLoading in ComponentState) then if ([csLoading,csDestroying]*ComponentState=[]) then begin
begin
if FActive then SetWindowFocus; if FActive then SetWindowFocus;
ActiveChanged; ActiveChanged;
end; end;
@ -1335,6 +1354,8 @@ end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
TCustomForm Method SetFocusedControl TCustomForm Method SetFocusedControl
Switch focus.
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TCustomForm.SetFocusedControl(Control: TWinControl): Boolean; function TCustomForm.SetFocusedControl(Control: TWinControl): Boolean;
var var
@ -1350,10 +1371,9 @@ begin
ParentForm.SetFocusedControl(Control); ParentForm.SetFocusedControl(Control);
exit; exit;
end; end;
// update FActiveControl // update FActiveControl
if FDesigner = nil then if (FDesigner = nil) and (not (csLoading in ComponentState)) then
if Control <> Self then if Control <> Self then
FActiveControl := Control FActiveControl := Control
else else
@ -1369,8 +1389,8 @@ begin
Screen.FActiveForm := nil; Screen.FActiveForm := nil;
{$IFDEF VerboseFocus} {$IFDEF VerboseFocus}
DbgOut('TCustomForm.SetFocusedControl Self=',Name,':',ClassName,' '); DbgOut('TCustomForm.SetFocusedControl Self=',DbgSName(Self));
DbgOut(' Control=',Control.Name,':',Control.ClassName,' Control.HandleAllocated=',dbgs(Control.HandleAllocated)); DbgOut(' Control=',DbgSName(Control),' Control.HandleAllocated=',dbgs(Control.HandleAllocated));
DebugLn(); DebugLn();
{$ENDIF} {$ENDIF}
@ -1490,7 +1510,8 @@ begin
// activate focus if visible // activate focus if visible
if Visible then begin if Visible then begin
if (FActiveControl<>nil) and FActiveControl.HandleAllocated if (FActiveControl<>nil) and FActiveControl.HandleAllocated
and FActiveControl.Visible and FActiveControl.Enabled then begin and FActiveControl.Visible and FActiveControl.Enabled
and ([csLoading,csDestroying]*ComponentState=[]) then begin
{$IFDEF VerboseFocus} {$IFDEF VerboseFocus}
DebugLn('TCustomForm.CreateWnd A ',FActiveControl.Name,':',FActiveControl.ClassName); DebugLn('TCustomForm.CreateWnd A ',FActiveControl.Name,':',FActiveControl.ClassName);
{$ENDIF} {$ENDIF}
@ -1510,6 +1531,9 @@ begin
if ActiveControl <> nil then if ActiveControl <> nil then
begin begin
Control := ActiveControl; Control := ActiveControl;
{$IFDEF VerboseFocus}
Debugln('TCustomForm.Loaded Self=',DbgSName(Self),' FActiveControl=',DbgSName(FActiveControl));
{$ENDIF}
FActiveControl := nil; FActiveControl := nil;
if Control.CanFocus then SetActiveControl(Control); if Control.CanFocus then SetActiveControl(Control);
end; end;
@ -1784,6 +1808,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.155 2004/08/30 10:49:20 mattias
fixed focus catch for combobox csDropDownList
Revision 1.154 2004/08/27 08:55:22 micha Revision 1.154 2004/08/27 08:55:22 micha
implement tapplication.minimize for win32, stub for gtk implement tapplication.minimize for win32, stub for gtk

View File

@ -123,13 +123,10 @@ begin
end; end;
end; end;
procedure TDBCalendar.WMKillFocus(var Message: TLMKillFocus); procedure TDBCalendar.EditingDone;
begin begin
//I am not sure where else to do this :/
//we need to make sure the field is updated
//if we leave the control after changes
FDataLink.UpdateRecord; FDataLink.UpdateRecord;
inherited EditingDone;
end; end;
{ Public Methods } { Public Methods }
@ -155,6 +152,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.4 2004/08/30 10:49:20 mattias
fixed focus catch for combobox csDropDownList
Revision 1.3 2004/04/10 17:58:57 mattias Revision 1.3 2004/04/10 17:58:57 mattias
implemented mainunit hints for include files implemented mainunit hints for include files

View File

@ -143,9 +143,10 @@ begin
DataChange(Self); DataChange(Self);
end; end;
procedure TDBCheckBox.WMKillFocus(var Message: TLMKillFocus); procedure TDBCheckBox.EditingDone;
begin begin
FDataLink.UpdateRecord; FDataLink.UpdateRecord;
inherited EditingDone;
end; end;
function TDBCheckBox.ValueEqualsField(const AValue, AFieldText: string function TDBCheckBox.ValueEqualsField(const AValue, AFieldText: string

View File

@ -132,9 +132,10 @@ begin
DataChange(Self); DataChange(Self);
end; end;
procedure TDBComboBox.WMKillFocus(var Message: TLMKillFocus); procedure TDBComboBox.EditingDone;
begin begin
FDataLink.UpdateRecord; FDataLink.UpdateRecord;
inherited EditingDone;
end; end;
constructor TDBComboBox.Create(TheOwner: TComponent); constructor TDBComboBox.Create(TheOwner: TComponent);

View File

@ -169,14 +169,10 @@ begin
FDataLink.Modified; FDataLink.Modified;
end; end;
procedure TDBListBox.EditingDone;
procedure TDBListBox.WMKillFocus(var Message: TLMKillFocus);
begin begin
//I am not sure where else to do this :/
//we need to make sure the field is updated
//if we leave the control after changes
FDataLink.UpdateRecord; FDataLink.UpdateRecord;
inherited EditingDone;
end; end;
{ Public Methods } { Public Methods }
@ -200,6 +196,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.6 2004/08/30 10:49:20 mattias
fixed focus catch for combobox csDropDownList
Revision 1.5 2004/08/13 16:40:47 mazen Revision 1.5 2004/08/13 16:40:47 mazen
+ TCharater type used to allow UTF8 keyboard with gtk2 + TCharater type used to allow UTF8 keyboard with gtk2

View File

@ -140,9 +140,10 @@ begin
DataChange(Self); DataChange(Self);
end; end;
procedure TDBMemo.WMKillFocus(var Message: TLMKillFocus); procedure TDBMemo.EditingDone;
begin begin
FDataLink.UpdateRecord; FDataLink.UpdateRecord;
inherited EditingDone;
end; end;
destructor TDBMemo.Destroy; destructor TDBMemo.Destroy;

View File

@ -149,9 +149,10 @@ begin
DataChange(Self); DataChange(Self);
end; end;
procedure TDBRadioGroup.WMKillFocus(var Message: TLMKillFocus); procedure TDBRadioGroup.EditingDone;
begin begin
FDataLink.UpdateRecord; FDataLink.UpdateRecord;
inherited EditingDone;
end; end;
constructor TDBRadioGroup.Create(TheOwner: TComponent); constructor TDBRadioGroup.Create(TheOwner: TComponent);

View File

@ -2015,7 +2015,7 @@ var
Form : TCustomForm; Form : TCustomForm;
begin begin
{$IFDEF VerboseFocus} {$IFDEF VerboseFocus}
DebugLn('[TWinControl.SetFocus] ',Name,':',ClassName,' Visible=',Visible,' HandleAllocated=',HandleAllocated); DebugLn('[TWinControl.SetFocus] ',Name,':',ClassName,' Visible=',dbgs(Visible),' HandleAllocated=',dbgs(HandleAllocated));
{$ENDIF} {$ENDIF}
Form := GetParentForm(Self); Form := GetParentForm(Self);
if Form <> nil then if Form <> nil then
@ -3827,6 +3827,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.267 2004/08/30 10:49:20 mattias
fixed focus catch for combobox csDropDownList
Revision 1.266 2004/08/26 19:09:34 mattias Revision 1.266 2004/08/26 19:09:34 mattias
moved navigation key handling to TApplication and added options for custom navigation moved navigation key handling to TApplication and added options for custom navigation

View File

@ -7798,8 +7798,7 @@ begin
then then
Assert(False, Format('Trace: [TGtkWidgetSet.SetProperties] %s', [Sender.ClassName])) Assert(False, Format('Trace: [TGtkWidgetSet.SetProperties] %s', [Sender.ClassName]))
else else
RaiseException('TGtkWidgetSet.SetProperties: ' RaiseException('TGtkWidgetSet.SetProperties: '+DbgSName(Sender));
+' Sender.ClassName='+Sender.ClassName);
wHandle:= Pointer(TWinControl(Sender).Handle); wHandle:= Pointer(TWinControl(Sender).Handle);
Widget:= GTK_WIDGET(wHandle); Widget:= GTK_WIDGET(wHandle);
@ -7807,17 +7806,21 @@ begin
case TControl(Sender).fCompStyle of case TControl(Sender).fCompStyle of
csComboBox: csComboBox:
begin begin
//debugln('TGtkWidgetSet.SetProperties ',DbgSName(Sender),' ',dbgs(TCustomComboBox(Sender).ArrowKeysTraverseList));
case TCustomComboBox(Sender).Style of case TCustomComboBox(Sender).Style of
csDropDownList : csDropDownList :
begin begin
gtk_combo_set_value_in_list(GTK_COMBO(wHandle),GdkTrue, GdkFalse); // do not set ok_if_empty = true, otherwise it can hang focus
gtk_combo_set_value_in_list(GTK_COMBO(wHandle),GdkTrue,GdkTrue);
gtk_combo_set_use_arrows_always(GTK_COMBO(wHandle),GdkTrue); gtk_combo_set_use_arrows_always(GTK_COMBO(wHandle),GdkTrue);
gtk_combo_set_case_sensitive(GTK_COMBO(wHandle),GdkFalse); gtk_combo_set_case_sensitive(GTK_COMBO(wHandle),GdkFalse);
end; end;
else else
begin begin
gtk_combo_set_value_in_list(GTK_COMBO(wHandle),GdkFalse,GdkFalse); // do not set ok_if_empty = true, otherwise it can hang focus
gtk_combo_set_value_in_list(GTK_COMBO(wHandle),GdkFalse,GdkTrue);
gtk_combo_set_use_arrows_always(GTK_COMBO(wHandle),GdkFalse); gtk_combo_set_use_arrows_always(GTK_COMBO(wHandle),GdkFalse);
gtk_combo_set_case_sensitive(GTK_COMBO(wHandle),GdkTrue);
end; end;
end; end;
@ -9251,6 +9254,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.536 2004/08/30 10:49:20 mattias
fixed focus catch for combobox csDropDownList
Revision 1.535 2004/08/28 10:22:13 mattias Revision 1.535 2004/08/28 10:22:13 mattias
added hints for long props in OI from Andrew Haines added hints for long props in OI from Andrew Haines

View File

@ -639,6 +639,7 @@ begin
Result:=HexStr(Cardinal(Widget),8); Result:=HexStr(Cardinal(Widget),8);
if Widget=nil then exit; if Widget=nil then exit;
Result:=Result+'='+GetWidgetClassName(Widget); Result:=Result+'='+GetWidgetClassName(Widget);
Result:=Result+' '+WidgetFlagsToString(Widget);
LCLObject:=GetNearestLCLObject(Widget); LCLObject:=GetNearestLCLObject(Widget);
Result:=Result+' LCLObject='+HexStr(Cardinal(LCLObject),8); Result:=Result+' LCLObject='+HexStr(Cardinal(LCLObject),8);
if LCLObject=nil then exit; if LCLObject=nil then exit;
@ -772,6 +773,8 @@ begin
Result:=Result+'V'; Result:=Result+'V';
if GTK_WIDGET_DRAWABLE(Widget) then if GTK_WIDGET_DRAWABLE(Widget) then
Result:=Result+'D'; Result:=Result+'D';
if GTK_WIDGET_CAN_FOCUS(Widget) then
Result:=Result+'F';
end; end;
Result:=Result+']'; Result:=Result+']';
end; end;
@ -7187,6 +7190,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.297 2004/08/30 10:49:20 mattias
fixed focus catch for combobox csDropDownList
Revision 1.296 2004/08/29 10:13:59 mattias Revision 1.296 2004/08/29 10:13:59 mattias
fixed makefile fixed makefile

View File

@ -7718,12 +7718,8 @@ begin
Widget:=PGtkWidget(hWnd); Widget:=PGtkWidget(hWnd);
{$IfDef VerboseFocus} {$IfDef VerboseFocus}
DebugLn(''); DebugLn('');
write('[TGtkWidgetSet.SetFocus] A hWnd=',HexStr(Cardinal(hWnd),8)); write('[TGtkWidgetSet.SetFocus] A hWnd=',GetWidgetDebugReport(Widget));
LCLObject:=TWinControl(GetLCLObject(Widget)); LCLObject:=TWinControl(GetLCLObject(Widget));
if LCLObject<>nil then
DebugLn(' LCLObject=',LCLObject.Name,':',LCLObject.ClassName)
else
DebugLn(' LCLObject=nil');
{$EndIf} {$EndIf}
if hwnd = 0 then begin if hwnd = 0 then begin
Result:=0; Result:=0;
@ -7736,22 +7732,15 @@ begin
TopLevel := gtk_widget_get_toplevel(Widget); TopLevel := gtk_widget_get_toplevel(Widget);
{$IfDef VerboseFocus} {$IfDef VerboseFocus}
DbgOut('[TGtkWidgetSet.SetFocus] B hWnd=',HexStr(Cardinal(hWnd),8)); Debugln('[TGtkWidgetSet.SetFocus] B');
DbgOut(' HndVisible=',GTK_WIDGET_VISIBLE(Widget)); DbgOut(' TopLevel=',HexStr(Cardinal(TopLevel),8));
DbgOut(' HndRealized=',GTK_WIDGET_REALIZED(Widget)); DbgOut(' OldFocus=',GetWidgetDebugReport(PGtkWidget(Result)));
DbgOut(' HndMapped=',GTK_WIDGET_MAPPED(Widget));
DebugLn(''); DbgOut(' ');
DbgOut(' TopLevel=',HexStr(Cardinal(TopLevel),8));
DbgOut(' OldFocus=',HexStr(Cardinal(Result),8));
AWinControl:=TWinControl(GetNearestLCLObject(PGtkWidget(Result)));
if AWinControl<>nil then
DbgOut(' OldLCLParent=',AWinControl.Name,':',AWinControl.ClassName)
else
DbgOut(' OldLCLParent=nil');
DebugLn(''); DebugLn('');
if not GTK_WIDGET_VISIBLE(Widget) then if not GTK_WIDGET_VISIBLE(Widget) then
RaiseException('TGtkWidgetSet.SetFocus: Widget is not visible'); RaiseException('TGtkWidgetSet.SetFocus: Widget is not visible');
{$EndIf} {$EndIf}
if Result=hWnd then exit;
if GtkWidgetIsA(TopLevel, gtk_window_get_type) if GtkWidgetIsA(TopLevel, gtk_window_get_type)
then begin then begin
@ -7811,7 +7800,7 @@ begin
{$EndIf} {$EndIf}
gtk_window_set_focus(PGtkWindow(TopLevel),NewFocusWidget); gtk_window_set_focus(PGtkWindow(TopLevel),NewFocusWidget);
{$IfDef VerboseFocus} {$IfDef VerboseFocus}
DebugLn(' I NewTopLevel FocusWidget=',HexStr(Cardinal(PGtkWindow(TopLevel)^.Focus_Widget),8),' Success=',PGtkWindow(TopLevel)^.Focus_Widget=NewFocusWidget); DebugLn(' I NewTopLevel FocusWidget=',HexStr(Cardinal(PGtkWindow(TopLevel)^.Focus_Widget),8),' Success=',dbgs(PGtkWindow(TopLevel)^.Focus_Widget=NewFocusWidget));
{$EndIf} {$EndIf}
end; end;
end; end;
@ -8729,6 +8718,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.363 2004/08/30 10:49:20 mattias
fixed focus catch for combobox csDropDownList
Revision 1.362 2004/08/19 18:50:53 mattias Revision 1.362 2004/08/19 18:50:53 mattias
splitted IDE component owner hierachy to reduce notification time splitted IDE component owner hierachy to reduce notification time

View File

@ -533,7 +533,7 @@ function GTKAPIWidgetClient_FocusIn(AWidget: PGTKWidget;
Event: PGdkEventFocus): GTKEventResult; cdecl; Event: PGdkEventFocus): GTKEventResult; cdecl;
begin begin
{$IFDEF VerboseFocus} {$IFDEF VerboseFocus}
DebugLn('GTKAPIWidgetClient_FocusIn ',HexStr(Cardinal(AWidget),8),' ',event^.thein); DebugLn('GTKAPIWidgetClient_FocusIn ',HexStr(Cardinal(AWidget),8),' ',dbgs(event^.thein));
{$ENDIF} {$ENDIF}
gtk_widget_set_flags(AWidget, GTK_HAS_FOCUS); gtk_widget_set_flags(AWidget, GTK_HAS_FOCUS);
@ -551,7 +551,7 @@ function GTKAPIWidgetClient_FocusOut(AWidget: PGTKWidget;
Event: PGdkEventFocus): GTKEventResult; cdecl; Event: PGdkEventFocus): GTKEventResult; cdecl;
begin begin
{$IFDEF VerboseFocus} {$IFDEF VerboseFocus}
DebugLn('GTKAPIWidgetClient_FocusOut ',HexStr(Cardinal(AWidget),8),' ',event^.thein); DebugLn('GTKAPIWidgetClient_FocusOut ',HexStr(Cardinal(AWidget),8),' ',dbgs(event^.thein));
{$ENDIF} {$ENDIF}
gtk_widget_unset_flags(AWidget, GTK_HAS_FOCUS); gtk_widget_unset_flags(AWidget, GTK_HAS_FOCUS);
@ -1110,6 +1110,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.64 2004/08/30 10:49:20 mattias
fixed focus catch for combobox csDropDownList
Revision 1.63 2004/08/28 10:22:13 mattias Revision 1.63 2004/08/28 10:22:13 mattias
added hints for long props in OI from Andrew Haines added hints for long props in OI from Andrew Haines

View File

@ -129,6 +129,16 @@ procedure DebugLn(const s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16:
procedure DbgOut(const s: string); procedure DbgOut(const s: string);
procedure DbgOut(const s1,s2: string); procedure DbgOut(const s1,s2: string);
procedure DbgOut(const s1,s2,s3: string);
procedure DbgOut(const s1,s2,s3,s4: string);
procedure DbgOut(const s1,s2,s3,s4,s5: string);
procedure DbgOut(const s1,s2,s3,s4,s5,s6: string);
procedure DbgOut(const s1,s2,s3,s4,s5,s6,s7: string);
procedure DbgOut(const s1,s2,s3,s4,s5,s6,s7,s8: string);
procedure DbgOut(const s1,s2,s3,s4,s5,s6,s7,s8,s9: string);
procedure DbgOut(const s1,s2,s3,s4,s5,s6,s7,s8,s9,s10: string);
procedure DbgOut(const s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11: string);
procedure DbgOut(const s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12: string);
function DbgS(const c: cardinal): string; function DbgS(const c: cardinal): string;
function DbgS(const i: integer): string; function DbgS(const i: integer): string;
@ -137,7 +147,7 @@ function DbgS(const p: TPoint): string;
function DbgS(const p: pointer): string; function DbgS(const p: pointer): string;
function DbgS(const e: extended): string; function DbgS(const e: extended): string;
function DbgS(const b: boolean): string; function DbgS(const b: boolean): string;
function DbgSName(const p: TPersistent): string; function DbgSName(const p: TObject): string;
function DbgS(const i1,i2,i3,i4: integer): string; function DbgS(const i1,i2,i3,i4: integer): string;
@ -800,6 +810,57 @@ begin
DbgOut(s1+s2); DbgOut(s1+s2);
end; end;
procedure DbgOut(const s1, s2, s3: string);
begin
DbgOut(s1+s2+s3);
end;
procedure DbgOut(const s1, s2, s3, s4: string);
begin
DbgOut(s1+s2+s3+s4);
end;
procedure DbgOut(const s1, s2, s3, s4, s5: string);
begin
DbgOut(s1+s2+s3+s4+s5);
end;
procedure DbgOut(const s1, s2, s3, s4, s5, s6: string);
begin
DbgOut(s1+s2+s3+s4+s5+s6);
end;
procedure DbgOut(const s1, s2, s3, s4, s5, s6, s7: string);
begin
DbgOut(s1+s2+s3+s4+s5+s6+s7);
end;
procedure DbgOut(const s1, s2, s3, s4, s5, s6, s7, s8: string);
begin
DbgOut(s1+s2+s3+s4+s5+s6+s7+s8);
end;
procedure DbgOut(const s1, s2, s3, s4, s5, s6, s7, s8, s9: string);
begin
DbgOut(s1+s2+s3+s4+s5+s6+s7+s8+s9);
end;
procedure DbgOut(const s1, s2, s3, s4, s5, s6, s7, s8, s9, s10: string);
begin
DbgOut(s1+s2+s3+s4+s5+s6+s7+s8+s9+s10);
end;
procedure DbgOut(const s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11: string);
begin
DbgOut(s1+s2+s3+s4+s5+s6+s7+s8+s9+s10+s11);
end;
procedure DbgOut(const s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12: string
);
begin
DbgOut(s1+s2+s3+s4+s5+s6+s7+s8+s9+s10+s11+s12);
end;
function DbgS(const c: cardinal): string; function DbgS(const c: cardinal): string;
begin begin
Result:=IntToStr(c); Result:=IntToStr(c);
@ -836,7 +897,7 @@ begin
if b then Result:='True' else Result:='False'; if b then Result:='True' else Result:='False';
end; end;
function DbgSName(const p: TPersistent): string; function DbgSName(const p: TObject): string;
begin begin
if p=nil then if p=nil then
Result:='nil' Result:='nil'

View File

@ -262,7 +262,6 @@ type
procedure SetSorted(Val : boolean); virtual; procedure SetSorted(Val : boolean); virtual;
procedure SetStyle(Val : TComboBoxStyle); virtual; procedure SetStyle(Val : TComboBoxStyle); virtual;
procedure KeyDown(var Key : Word; Shift : TShiftState); override; procedure KeyDown(var Key : Word; Shift : TShiftState); override;
procedure KeyPress(var Key : TCharacter); override;
property DropDownCount: Integer read FDropDownCount write SetDropDownCount default 8; property DropDownCount: Integer read FDropDownCount write SetDropDownCount default 8;
property Items: TStrings read FItems write SetItems; property Items: TStrings read FItems write SetItems;
@ -1172,6 +1171,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.164 2004/08/30 10:49:20 mattias
fixed focus catch for combobox csDropDownList
Revision 1.163 2004/08/26 19:09:33 mattias Revision 1.163 2004/08/26 19:09:33 mattias
moved navigation key handling to TApplication and added options for custom navigation moved navigation key handling to TApplication and added options for custom navigation