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' ;
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 -
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
...:
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
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
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
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
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
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:
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
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
11 matches
Mail list logo