Delphi applications do not utilise the "Snap To" feature built into Windows,
where the mouse cursor jumps to the default button.
This is located in: Start / Control Panel / Mouse / Pointer Options / Snap
To.
I really like this feature, but it's annoying when some applications do not
implement this.
Can you please consider this for a future versions.
Many thanks.
Matthew
> Delphi applications do not utilise the "Snap To" feature built into
> Windows, where the mouse cursor jumps to the default button.
Did you try to define one button in you dialog as default? If i understand
it correctly that button is the one this function is searching for.
> Delphi applications do not utilise the "Snap To" feature built into
> Windows, where the mouse cursor jumps to the default button.
You could use SetCursorPos in the forms OnShow event. Personally, I
find the behaviour very, very annoying.
--
Dave Nottage [TeamB]
This problem applies to Delphi itself, plus any written applications.
Matthew
"Ralf Kaiser" <r...@lingosmart.de> wrote in message
news:45e5...@newsgroups.borland.com...
> This problem applies to Delphi itself, plus any written applications.
It's because of the class name of buttons in Delphi are not "Button".
Expanding on my other post, you could call this function in the OnShow
event of the form:
procedure MouseSnapTo(AForm: TForm);
var
i: integer;
Button: TButton;
Pt: TPoint;
Snap: integer;
begin
SystemParametersInfo(SPI_GETSNAPTODEFBUTTON, 0, @Snap, 0);
if Snap > 0 then
for i := 0 to AForm.ComponentCount - 1 do
if AForm.Components[i] is TButton then
begin
Button := AForm.Components[i] as TButton;
if Button.Default then
begin
Pt.X := Button.Left + (Button.Width div 2);
Pt.Y := Button.Top + (Button.Height div 2);
Pt := AForm.ClientToScreen(Pt);
SetCursorPos(Pt.X, Pt.Y);
end;
end;
end;
eg:
procedure TForm1.FormShow(Sender: TObject);
begin
MouseSnapTo(Self);
end;
--
Dave Nottage [TeamB]
This is not Delphi related, but did you try this?
www.powerballs.com
I had similar problem and doing excercises with power ball helped me a lot
;)
Cheers, Pete
"Dave Nottage [TeamB]" <rot13....@enqfbsg.pbz.nh> wrote
in message news:xn0f30ak4...@forums.borland.com...
> MJMatthew wrote:
>
>> This problem applies to Delphi itself, plus any written
>> applications.
>
> It's because of the class name of buttons in Delphi are
> not "Button".
>
> Expanding on my other post, you could call this function
> in the OnShow
> event of the form:
<snipped code>
Be sure to add Dave's code as an example, and maybe the VCL team will come
up with something that works for you. I'm guessing since there's a
work-around, it won't be a high priority item, but enter it anyway.
--
Lee
This is good, but it needs to respect the SnapToSetting.
--
Thanks,
Brad.
> > procedure MouseSnapTo(AForm: TForm);
>
> This is good, but it needs to respect the SnapToSetting.
You mean this part?:
SystemParametersInfo(SPI_GETSNAPTODEFBUTTON, 0, @Snap, 0);
if Snap > 0 then
--
Dave Nottage [TeamB]
Does it work when the form type is set to Dialog?
I haven't tried it but it may only work with dialogs, as opposed
to normal Delphi forms with minimise and maximise buttons.
Cheers,
Chris
<snip>
> This is not Delphi related, but did you try this?
> www.powerballs.com
> I had similar problem and doing excercises with power ball helped me
> a lot ;)
This is what i don't get, RSI stands for Repetitive Strain Injury.
So by repeating movement too much, you injure yourself.
So if you do repeated exercizes with that powerball, again, repeating
movement much, you don't injure yourself, and on top of it, you have
less problems with the injuries that you already have..
I don't get that at all. My take on it is that RSI is all between the
ears.
--
> Expanding on my other post, you could call this function in the
OnShow
> event of the form:
That code does not check for buttons that have a different Parent than
the Form itself. You would need a recursive search for that, ie:
function FindDefaultButton(AParent: TWinControl): TButton;
var
I: Integer;
Ctrl: TControl;
begin
Result := nil;
for I := 0 to AParent.ControlCount-1 do
begin
Ctrl := AParent.Controls[I];
if (Ctrl is TButton) and TButton(Ctrl).Default then
begin
Result := TButton(Ctrl);
Exit;
end;
if Ctrl is TWinControl then
begin
Result := FindDefaultButton(TWinControl(Ctrl));
if Result <> nil then Exit;
end;
end;
end;
procedure MouseSnapTo(AForm: TForm);
var
Snap: Integer;
Button: TButton;
Pt: TPoint;
begin
SystemParametersInfo(SPI_GETSNAPTODEFBUTTON, 0, @Snap, 0);
if Snap > 0 then
begin
Button := FindDefaultButton(AForm);
if Button <> nil then
begin
Pt := Button.ClientOrigin;
Inc(Pt.X, Button.ClientWidth div 2);
Inc(Pt.Y, Button.ClientHeight div 2);
Windows.SetCursorPos(Pt.X, Pt.Y);
end;
end;
end;
Gambit
> This is what i don't get, RSI stands for Repetitive Strain Injury.
> So by repeating movement too much, you injure yourself.
By repeating _specific_ movements that when repeated too often or too
frequently have the potential to cause damage.
> So if you do repeated exercizes with that powerball, again, repeating
> movement much, you don't injure yourself, and on top of it, you have
> less problems with the injuries that you already have.
Different types of movement, different affect on the moving parts.
Sometimes when I drink too much I fall down.
Sometimes when I drink too much I just need the bathroom more.
Sometimes when I drink too much I need the bathroom more and fall down on the
way.
:D
It all depends on _what_ I drink, not the fact that I have been drinking.
;)
But how do you set the form type to Dialog. I only see BorderStyle with
bsDialog option.
Thanks
Matthew
"Chris Morgan" <chris.nospam at lynxinfo dot co dot uk> wrote in message
What's the difference ?. I would have thought that any form or dialog with
an OK or Cancel button should implement the Snap-To feature automatically.
It doesn't matter if you like this feature it or not. By default it is
switched off anyway. But for those people that do switch it on, then I
believe it should apply globally.
Just my opinion.
Matthew
"MJMatthew" <REMOVE_THIS_T...@btinternet.com> wrote in message
news:45e56423$1...@newsgroups.borland.com...
Matthew
http://qc.codegear.com/wc/qcmain.aspx?d=41560
> I don't get that at all. My take on it is that RSI is all between the
> ears.
Rephrased: "I don't have it and can't personally understand it,
therefore it must not exist?"
Ask a doctor, OK?
--
Craig Stuntz [TeamB] · Vertex Systems Corp. · Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
Everything You Need to Know About InterBase Character Sets:
http://blogs.teamb.com/craigstuntz/articles/403.aspx
"Craig Stuntz [TeamB]" <craig_...@nospam.please [a.k.a.
acm.org]> wrote in message
news:45e6f2ba$1...@newsgroups.borland.com...
I have IKEA desk where you can modify height ;)
But you are right, the height is important...
The pain in my hand after 20+ years of programming was so bad, that I have
converted from right handed to left handed and stopped programming for fun
at home...
But now it's not so bad since I use powerball. It realy works, but if I stop
for some months, the pain comes back.
That's what I meant.
cheers,
Chris
Matthew
"Chris Morgan" <chris.nospam at lynxinfo dot co dot uk> wrote in message
news:45e7...@newsgroups.borland.com...
These worked very well for me and they stopped the pain completely.
Matthew
"Ivan Rakyta" <rakyta_at_stonline.sk> wrote in message
> That code does not check for buttons that have a different Parent than
> the Form itself. You would need a recursive search for that, ie:
Code doesn't check if the button is visible and to a lesser extent
enabled as well.
--
TJSDialog - TaskDialog for other operating systems:
http://www.jed-software.com/jsd.htm
Visual Forms IDE Add In: http://www.jed-software.com/vf.htm
> Code doesn't check if the button is visible and to a lesser extent
> enabled as well.
Whaddya expect in 5 mins? :-P
Hehe.. thanks for the feedback, Jeremy
--
Dave Nottage [TeamB]