Re: [Lazarus] TMouseButton

2010-04-07 Thread Mattias Gärtner
Zitat von Kjow : 2010/4/7 Kjow : 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' ;

Re: [Lazarus] TMouseButton

2010-04-07 Thread Kjow
2010/4/7 Martin : > Case will not work. > > but > mbleft, or mbLeft + any other button >  if mbLeft in Buttons then xxx; > > for only mbLeft, no other button: >  if Buttons = [mbLeft] then xxx; > > to add / remove ... > Buttons := Buttons + mbLeft; > Include(Buttons, mbLeft); > Buttons := Buttons -

Re: [Lazarus] TMouseButton

2010-04-07 Thread Martin
On 07/04/2010 15:35, Kjow wrote: 2010/4/7 Kjow: 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 ...:

Re: [Lazarus] TMouseButton

2010-04-07 Thread Kjow
2010/4/7 Kjow : > 2010/4/7 Kjow : >> 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:= 'y

Re: [Lazarus] TMouseButton

2010-04-07 Thread Kjow
2010/4/7 Kjow : > 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; regards

Re: [Lazarus] TMouseButton

2010-04-07 Thread Kjow
2010/4/7 Vincent Snijders : > What about: > > type >  TMouseButtons = set of TMouseButton; // if it doesn't exist yet > > var >  MouseButtonPressed: TMouseButtons; > > >> MouseButtonPressed:=MouseButtonPressed + Button; //OnMouseDown > > Your mbNone becomes: >> MouseButtonPressed:=[]; > > Vincent

Re: [Lazarus] TMouseButton

2010-04-07 Thread Kjow
2010/4/7 Kjow : >> As result you don't need mbNone. Just use [] to indicate that no button is >> pressed. > 2010/4/7 Martin : >> Create a set Other question... how to pass/read [] "vaule" to/in a function? e.g. function ButtonPress(Button: TMouseButton): string; begin case Button of []: Re

Re: [Lazarus] TMouseButton

2010-04-07 Thread Kjow
2010/4/7 Paul Ishenin : > As result you don't need mbNone. Just use [] to indicate that no button is > pressed. 2010/4/7 Martin : > I wouldn't recommend that change. Some units define >  const  Foo = Array [TMouseButton] of String = (list of names for values); > > Those will break, because the cou

Re: [Lazarus] TMouseButton

2010-04-07 Thread Martin
On 07/04/2010 14:46, Kjow wrote: Hi all, I need to create an "advanced" function that manages mouse events, so I need to know when/which a button is pressed and so, when no button is pressed. I saw that in TMouseButton (row 142 of Controls unit) there isn't mbNone, so I simply edited that row:

Re: [Lazarus] TMouseButton

2010-04-07 Thread Paul Ishenin
07.04.2010 21:46, Kjow wrote: I saw that in TMouseButton (row 142 of Controls unit) there isn't mbNone, so I simply edited that row: TMouseButton = (mbNone, mbLeft, mbRight, mbMiddle, mbExtra1, mbExtra2); Now I can see when no buttons are pressed; I simply manage it with You miss that it is

Re: [Lazarus] TMouseButton

2010-04-07 Thread Vincent Snijders
Kjow schreef: Hi all, I need to create an "advanced" function that manages mouse events, so I need to know when/which a button is pressed and so, when no button is pressed. I saw that in TMouseButton (row 142 of Controls unit) there isn't mbNone, so I simply edited that row: TMouseButton = (mbN