Subject Re: [IBO] IB_LookupEnh question - drawing images on buttons
Author Geoff Worboys
> Exactly what I want to achieve is to change Button2
> from ellipsis (normal state) to query in Droppeddown
> state. That's all for know.

I hope the demo I sent you will explain how this can be achieved (even
though it means writing your own glyph for Button1 as well).


> Yes. Even tried to draw a down arror in IB_Grid top
> left cell. So every additional info is kindly welcome.

All the drawing functions (other than those that are being deprecated)
use the TDrawInfoEnh structure for their input. Probably the best
place to see how this structure is used is to take a look at the old
versions of the functions in Telesis_Utils.pas. For example the
DrawGlyph looks like...

procedure DrawGlyph( Cvs: TCanvas; var Rect: TRect;
Proport, Stretch: Boolean;
ImgList: TImageList; ImgIdx: integer );
var
DrawInfo: TDrawInfoEnh;
begin
DrawInfo.Rect := Rect;
DrawInfo.Stretch := Stretch;
with DrawInfo do begin
VectorGlyph := vgNone;
Canvas := Cvs;
VectorColor := Cvs.Brush.Color;
BkColor := Cvs.Brush.Color;
VectorBrush := Cvs.Brush.Style;
// Rect := already done
Border := bbFlat;
Proportional := Proport;
Enabled := true;
Pressed := false;
ImageList := ImgList;
ImageIndex := ImgIdx;
ImageDisabled := -1;
ImagePressed := -1;
end;
DrawGlyph( DrawInfo );
end;

You can see that all this old version of the function is doing is
assigning the DrawInfo properties and calling the new version of the
function.

If you want to use the DrawStandardImage function you only need to
know the rule that - if the DrawInfo.VectorGlyph property is set to
vgNone then it will attempt to draw a glyph from the Image*
properties - otherwise it will try to draw the vectorglyph and ignore
the Image* properties. Similarly for the DrawEditEnhButton function.

Obviously I need to find some time to write some demo apps for this
sort of thing, but they will have to wait until I have time.

HTH

Geoff Worboys
Telesis Computing