[Lazarus] DrawText function problems

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Sun Apr 13 17:35:17 CEST 2008


On Sun, Apr 13, 2008 at 10:16 AM, Lee Jenkins <lee at datatrakpos.com> wrote:
>  BTW, in Delphi the behavior that I mentioned above is present.  Which made it a
>  simple task to create custom buttons.  With the current behavior of Lazarus, it
>  leave custom buttons made like this in a "visually down" state.

Ahhh ... so this is what this is about?

I would have used a TCustomControl descendent to do that.

Your code works fine in gtk2, the caption is drawn as expected. The
button doesn't go back when the mouse leaves it. Pay attention to how
real system buttons work. It doesn't go back on MouseUp. It goes back
when the mouse leaves the button, so I added a handler for
OnMouseLeave:

procedure TDTImageButton.HandleMouseLeave(Sender: TObject);
begin
  HandleMouseUp(Sender, mbLeft, [], 0, 0); // Just a hack, you should
actually have the code from you MouseUp here, and correct your MouseUp
end;

You would also need a handler for OnMouseEnter and some logic to see
again when the mouse goes back to the button to put it down again.

Other hints. You don't need those ifdefs for fpc, so use mode delphi.

In Lazarus you can use LCLIntf and LCLType instead of the WIndows unit.

> Even when Auto drag is not set or BeginDrag is not called?

I was just pointing which events may occur with that mouse gesture.

-- 
Felipe Monteiro de Carvalho



More information about the Lazarus mailing list