Subject Re: [IBO] ib_grid ib_lookupcombo flicker
Author Dany M
jeffplata wrote:
> (Using ibo 4.5b)
>
> I noticed the grid flickers when I leave a cell that has lookupcombo in
> it. Very visible when using Win95 P100 machines. Any way to fix this?
>

I donät know if I should open my mouth here at all, but since you did
not get any other reply...

There are other standing issues with embedded controls in grids that
Jason is aware of. These issues are on low priority as there seem to be
a general idea around that embedding controls is a bad idea :(
Personally I think this is alarming as I use embedded controls
extensively to achieve an efficients UI. Both me and my users like it.

The flicker has been up in this ng before, do a search but I suspect you
won't find any solution. From the top of my head I remember advice on
using less number of columns &c.

I started a small project to rid the flickering a long time ago but got
into some roadblock when the coding got too intricate. I was also trying
to solve an issue when TrackGridRow is true where the embedded control
is painted even though the current row has scrolled out of view. This is
also an old issue. There is another issue with clicking in the grid with
the mouse that is related to having the embedded controls paint in the
correct color and another where the focus dissapears when entering an
empty grid with the keyboard.

You could take up on this code but I'm not at all sure if it is the
correct approach. *Hopefully* Jason will have time to address these
issues in the future.

All of this is very intricate and I would not hold IBO up against it as
there probably are not many other things out there that handle this
stuff perfectly.

Here is the small code changes that I was doing (not complete and maybe
not on the right track) it is very experimental :) lots of comment out
and in...

type
TIB_NFGrid = class(TIB_Grid)
private
procedure WMVScroll(var Msg: TWMVScroll); message WM_VSCROLL;
end;

...

procedure TIB_DanyGrid.WMVScroll(var Msg: TWMVScroll);
var
ii: integer;
ALink: TIB_DataLink;
tmpIntf: IIB_GridWinControl;
begin
// if Msg.ScrollCode = SB_THUMBTRACK then Memo1.Lines.Add('SB_THUMBTRACK')
// else if Msg.ScrollCode = SB_THUMBPOSITION then
Memo1.Lines.Add('SB_THUMBPOSITION')
// else if Msg.ScrollCode = SB_LINEUP then Memo1.Lines.Add('SB_LINEUP')
// else if Msg.ScrollCode = SB_LINEDOWN then Memo1.Lines.Add('SB_LINEDOWN')
// else if Msg.ScrollCode = SB_PAGEUP then Memo1.Lines.Add('SB_PAGEUP')
// else if Msg.ScrollCode = SB_PAGEDOWN then Memo1.Lines.Add('SB_PAGEDOWN')
// else if Msg.ScrollCode = SB_BOTTOM then Memo1.Lines.Add('SB_BOTTOM')
// else if Msg.ScrollCode = SB_TOP then Memo1.Lines.Add('SB_TOP')
// else if Msg.ScrollCode = SB_ENDSCROLL then
Memo1.Lines.Add('SB_ENDSCROLL');


if Msg.ScrollCode in [SB_THUMBTRACK, SB_THUMBPOSITION] then
// Only do this once, message comes lots of times...
if FIsThumbTrackingLevel = 0 then
try
// So that we will remember there was no focused control
//FFocusedBeforeTrackingControl := nil;

// So that we will remeber threr was a focused control
//for ii := 0 to ControlCount - 1 do
//if Controls[ii] is TWinControl then
//if (( Controls[ii] as TWinControl ).Focused ) or
// ( Assigned( Screen.ActiveForm ) and
// ( Controls[ii] = Screen.ActiveForm.ActiveControl )) then
//begin
// FFocusedBeforeTrackingControl := TWinControl(Controls[ii]);
// FFocusedBeforeTrackingControl.Visible := false;
// break;
//end;

for ii := 0 to ControlCount - 1 do
if Controls[ii] is TWinControl then begin
ALink := TIB_DataLink( TWinControl(Controls[ii]).Perform(
CM_GETDATALINK, 0, 0 ));
if Assigned(ALink) then
ALink.DataSource := nil;
end;
finally
Inc(FIsThumbTrackingLevel);
end;

Inherited;

if Msg.ScrollCode in [SB_ENDSCROLL] then
try
for ii := 0 to ControlCount - 1 do
if Controls[ii] is TWinControl then begin
ALink := TIB_DataLink( TWinControl(Controls[ii]).Perform(
CM_GETDATALINK, 0, 0 ));
if Assigned(ALink) then ALink.DataSource := DataSource;
end;

//if Assigned ( FFocusedBeforeTrackingControl ) and
if (Row >= TopRowNum) and (Row <= TopRowNum + VisibleGridRows)
then begin

// Find out wich control (if any) correspond to the selected col
// and show that control if the current row is withing the
visible scope
for ii := 0 to ControlCount - 1 do
begin
if (Controls[ii] is TWinControl) and
(Controls[ ii ].GetInterface(IIB_GridWinControl,tmpIntf)) and
Assigned( SelectedField ) and ( SelectedField =
tmpIntf.DisplayColumn ) then
begin
TWinControl(Controls[ ii ]).Visible := true;
TWinControl(Controls[ ii ]).SetFocus;
Break;
end;
end;

//FFocusedBeforeTrackingControl.Visible := true;
//FFocusedBeforeTrackingControl.SetFocus;
//Memo1.Lines.Add('RESET SETFOCUS');
end;
finally
Dec(FIsThumbTrackingLevel);
end;

end;

Regards,

/Dany

> TIA
>
>
>
>
>
> ___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or InterBase
> without the need for BDE, ODBC or any other layer.
> ___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info papers,
> keyword-searchable FAQ, community code contributions and more !
> Yahoo! Groups Links
>
>
>
>
>
>