SkyHook
asked on
Button stay down
Hi experts. I have a speedbutton on a form and when I click it I want as popupmenu to appear. Ive got that worked out but the button stays down even though I specifically sets its down property to be false. I've tried stepping through the code with a wtach on and according to that it never gets set to down. The button is not part of a group (groupindex is 0) and the allowallup property is set to true. The code Im using is this
procedure TForm1.btnCalcStatsMouseDo wn(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
popctatscalc.popup(mouse.c ursorpos.x -x,
mouse.cursorpos.y-y+ btncalcctats.height);
end;
Hopefully someone will be able to solve this as its been driving me mad for days
Del
procedure TForm1.btnCalcStatsMouseDo
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
popctatscalc.popup(mouse.c
mouse.cursorpos.y-y+ btncalcctats.height);
end;
Hopefully someone will be able to solve this as its been driving me mad for days
Del
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Ha, The Neil was faster than me... (-:
ASKER
TheNeil,
Well I dont know why but that seems to work. Thank you
Del
Well I dont know why but that seems to work. Thank you
Del
Thanks Del - Glad to be of help.
Sorry Madshi (he he he) but this is one of those annoying little bug-ettes that Windows throws up every now and then (I was guessing on the missing message but it seems to answer the problem)
The Neil =:)
Sorry Madshi (he he he) but this is one of those annoying little bug-ettes that Windows throws up every now and then (I was guessing on the missing message but it seems to answer the problem)
The Neil =:)
Add a message handler to your form like this:
type
TYourForm = class...
...
private
procedure DoPopup(var Message: TMessage); message WM_USER + 777;
end;
procedure TYourForm.DoPopup(var Message: TMessage);
begin
popctatscalc.popup(mouse.c
mouse.cursorpos.y-Message.
end;
Then in your MouseDown method do this:
procedure TForm1.btnCalcStatsMouseDo
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
PostMessage(handle, WM_USER + 777, x, y);
end;
Hopefully this will fix the problem. It's not nice, but I think it should work.
Regards, Madshi.