Scrolling Functionality through Buttons

G

Guest

Hi,
I want to implement vertical scrolling functionality for all the controls in
a form through two buttons (Up and Down).

I am able to implement scrolling for a control on the click of the button.
But i am not able to find to which control i need to implement the scrolling
since the button is getting focued on click of the button and control.Focused
is returning false for all the other controls.

Can some one tell me how i can get the last focued item before the Up or
Down button got focus or how i can stop these two buttons from getting focus.

Thanks,
Murthy
 
M

Matt Lacey

Hi,
I want to implement vertical scrolling functionality for all the controls in
a form through two buttons (Up and Down).

I am able to implement scrolling for a control on the click of the button.
But i am not able to find to which control i need to implement the scrolling
since the button is getting focued on click of the button and control.Focused
is returning false for all the other controls.

Can some one tell me how i can get the last focued item before the Up or
Down button got focus or how i can stop these two buttons from getting focus.

Thanks,
Murthy

Try this:
http://www.thescripts.com/forum/thread213948.html
 
G

Guest

Hi Matt,
Thanks for your reply....
But i am just using the normal button in C#....so i cannot override wndProc
method for it...

Is there any other way i can do it...
Is there any other way to make sure that the buttons does not get focus even
on button click.

Thanks,
Murthy
 
M

Matt Lacey

Hi Matt,
Thanks for your reply....
But i am just using the normal button in C#....so i cannot override wndProc
method for it...

Is there any other way i can do it...
Is there any other way to make sure that the buttons does not get focus even
on button click.

Thanks,
Murthy


I am not aware of anothre way to do this, but there might be something
in this thread (http://groups.google.co.uk/group/
microsoft.public.dotnet.framework.windowsforms/browse_thread/thread/
f13b5b346b3dc6/440a90b1900f56d4?lnk=st&q=c%23+don%27t+get+focus+when
+clicking+on+button&rnum=3&hl=en#440a90b1900f56d4) that helps

Why can't you derive a custom button that does allow you to intercept
the message?

Be sure you have a good reason for the behaviour you are trying to
implement. It is normal behaviour that when a user clicks on
something it gets the focus. It is generally bad practice to break
common conventions as it makes the application behave in a way that
the user is not used to. This creates a training need for the
application and causes it to behave differently from other programs
the user uses. This can make it difficult for the user. (Remember:
computer programs should exist to make things easier/ as easy as
possible for the user.)
 
N

Norman Rericha

What you might want to do is add the LostFocus or Leave event. Then
when the control leaves focus, it sets reference to a local variable
(ie LastSelectedControl). Then when your buttons are pressed, they
can determine the type of control that was used last and scroll it
accordingly.

Hope this helps
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top