Subject | RE: [IBO] Trouble with TDateTimeEnh |
---|---|
Author | Paul Hope |
Post date | 2007-04-30T12:03:48Z |
Hi Geoff
I found the following line ( marked //+++++++++++ ) in IB_Grid seems to fix
it but I have no idea if it may have other implications
function TIB_CustomGrid.PositionControl( ACol, ARow: longint;
ARect: TRect ): boolean;
var
ii: integer;
cellCol: TIB_Column;
tmpColor: TColor;
tmpFont: TFont;
tmpIntf: IIB_GridWinControl;
tmpForm: TCustomForm;
begin
Result := false;
if not HasFocus then
Exit;
if DataLink.Prepared and not RowSelect then
begin
cellCol := GridFields[ DataCol[ ACol ]];
for ii := 0 to ControlCount - 1 do
begin
if Controls[ ii ].GetInterface(IIB_GridWinControl,tmpIntf) then
begin
if Assigned( CellCol ) and ( CellCol = tmpIntf.DisplayColumn ) then
begin
with ARect do
tmpIntf.SetBounds( Left, Top, Right - Left, Bottom - Top );
tmpIntf.SetBorderStyle( FEditorBorderStyle );//bsNone;
// Much of this is copied from SysUpdateEditor
// I actually believe this sort of processing probably appropriate
// for all dropped controls, but for the moment I will do this
// only for my TCustomEditEnh derivatives. Without this the color
// of the edit controls tend to follow the "highlight" color
// at inappropriate moments.
// Regretably this is a duplication of processing, since the
// GetCellColor and GetCellFont functions have already been called
// prior to this function - giving use the passed parameters -
// however this is also the case in SysUpdateEditor so it is not
// really anything new.
tmpColor := Self.Color;
tmpFont := tmpIntf.GetFont;
if Assigned( tmpFont ) then
GetCellProps( Col, Row, [gdFocused], tmpColor, tmpFont );
tmpIntf.SetColor( tmpColor );
tmpIntf.SetVisible( true );
// TControl.CanFocus does not check if the form can be focused
// (at least in Delphi5). IMO opinion this is a VCL bug but
perhaps
// they had some reason for this. Whatever we need to check
// if the form can be focused as well as the particular control.
// Could have dont this in the individual interfaces but central
// seems neater.
tmpForm := GetParentForm( Controls[ ii ] );
if tmpIntf.CanFocus and
(tmpForm <> nil) and tmpForm.Visible and tmpForm.Enabled then
tmpIntf.SetFocus;
// Have to FORCE a BoundsChanged calculation due to some
// weird processing with WM_CTL* messages.
// (even though, more often than not, no change has occurred)
tmpIntf.BoundsChanged;
Result := true;
Break;
end
else
begin
tmpIntf.SetVisible( false );
Setfocus; // ++++++++++++++++++++
end;
end;
end;
end;
end;
I'm using WIN 2000 pro sp4 but have tried it on XP sp2 with IBO 4.3Aa and it
worked fine - cant resolve between IBO version and operating system.
Regards
Paul
I found the following line ( marked //+++++++++++ ) in IB_Grid seems to fix
it but I have no idea if it may have other implications
function TIB_CustomGrid.PositionControl( ACol, ARow: longint;
ARect: TRect ): boolean;
var
ii: integer;
cellCol: TIB_Column;
tmpColor: TColor;
tmpFont: TFont;
tmpIntf: IIB_GridWinControl;
tmpForm: TCustomForm;
begin
Result := false;
if not HasFocus then
Exit;
if DataLink.Prepared and not RowSelect then
begin
cellCol := GridFields[ DataCol[ ACol ]];
for ii := 0 to ControlCount - 1 do
begin
if Controls[ ii ].GetInterface(IIB_GridWinControl,tmpIntf) then
begin
if Assigned( CellCol ) and ( CellCol = tmpIntf.DisplayColumn ) then
begin
with ARect do
tmpIntf.SetBounds( Left, Top, Right - Left, Bottom - Top );
tmpIntf.SetBorderStyle( FEditorBorderStyle );//bsNone;
// Much of this is copied from SysUpdateEditor
// I actually believe this sort of processing probably appropriate
// for all dropped controls, but for the moment I will do this
// only for my TCustomEditEnh derivatives. Without this the color
// of the edit controls tend to follow the "highlight" color
// at inappropriate moments.
// Regretably this is a duplication of processing, since the
// GetCellColor and GetCellFont functions have already been called
// prior to this function - giving use the passed parameters -
// however this is also the case in SysUpdateEditor so it is not
// really anything new.
tmpColor := Self.Color;
tmpFont := tmpIntf.GetFont;
if Assigned( tmpFont ) then
GetCellProps( Col, Row, [gdFocused], tmpColor, tmpFont );
tmpIntf.SetColor( tmpColor );
tmpIntf.SetVisible( true );
// TControl.CanFocus does not check if the form can be focused
// (at least in Delphi5). IMO opinion this is a VCL bug but
perhaps
// they had some reason for this. Whatever we need to check
// if the form can be focused as well as the particular control.
// Could have dont this in the individual interfaces but central
// seems neater.
tmpForm := GetParentForm( Controls[ ii ] );
if tmpIntf.CanFocus and
(tmpForm <> nil) and tmpForm.Visible and tmpForm.Enabled then
tmpIntf.SetFocus;
// Have to FORCE a BoundsChanged calculation due to some
// weird processing with WM_CTL* messages.
// (even though, more often than not, no change has occurred)
tmpIntf.BoundsChanged;
Result := true;
Break;
end
else
begin
tmpIntf.SetVisible( false );
Setfocus; // ++++++++++++++++++++
end;
end;
end;
end;
end;
> Hi Paul,You were quite right (of course ;-) ) speedbutton test had no effect.
>
> Sorry for the delay getting back to you.
>
> > Commenting out the changes to ExStyle doesn't help :-/
>
> @#$#@$ I was really hopeful that we had found the explanation.
>
> I am not sure where to go from here, I cannot see the problem
> with my own set up here. I have yet to get IBO 4.7.16 fully
> integrated into my arrangements here, maybe when I get that
> done I will see the problem.
>
> > I was surprised that hiding and showing the form when it was in the
> > state of the third column highlighted but not focused
> caused the third
> > column to be focused - could it be a painting/refresh
> problem rather
> > than a focus moving problem?
>
> I would not have thought so. You could try installing a test
> refresh/repaint in response to a speedbutton (no focus
> change) just to check and be certain. It sounds like the
> sort of thing that could even be related to Windows itself -
> are you running on XP SP1 + latest patches etc? (If not, what?)
>
I'm using WIN 2000 pro sp4 but have tried it on XP sp2 with IBO 4.3Aa and it
worked fine - cant resolve between IBO version and operating system.
Regards
Paul