[Lazarus] Odd issue with breakpoints

Martin lazarus at mfriebe.de
Wed Apr 7 21:49:47 CEST 2010


Zitat von Kjow <antispammoni at gmail.com>:

> 2010/4/7 Kjow <antispammoni at gmail.com>:
>> Error: Incompatible types: got "Empty Set" expected "TMouseButton"
>
> Whops, I've mistyped, it works!
> But how to read the values from a function?
>
> e.g.
>
> function ButtonPress(Button: TMouseButtons): string;
> begin
>   case Button of
>     ...: Result:= 'you pressed' ;
>   end;
> end;

The mouse buttons are combined in TShiftState.
For example: OnMouseDown gets the Shift parameter, which contains the  
pressed mouse buttons and the pressed modifier keys.
There is already a function to convert TShiftState into a string in  
unit LCLProc:

procedure TMainForm.FormMouseDown(Sender: TObject; Button: TMouseButton;
   Shift: TShiftState; X, Y: Integer);
begin
   writeln('TMainForm.FormMouseDown ',dbgs(Shift));
   // when only the right mouse button is pressed
   // it will write: [ssRight]
end;


Mattias







More information about the Lazarus mailing list