how to stop focus change on button click

  • Thread starter Thread starter colin
  • Start date Start date
C

colin

Whats the easiest way to stop a Button from
taking focus away from another control on the same windows
form ?

Ive looked and not found much so far,I think theres
a controlstyle.selectable that might do what I want
but the button wont let me access SetStyle :s

I still want the button to otherwise work, and for other things to
change focus if necessary.


Colin =^.^=
 
Hey Colin,

From what I remember, this is actually possible, however, one point:

Users expect for your application to work like all the other
applications that run on the windows platform. This includes the basic
things like when they click minimize, it minimizes, when they click
close, it closes (maybe doing something in the background, sure). And of
course, specific to this one, when they click something, for the focus
to change.

Is it from a data entry point of view that you are asking this question?
If so, I've done related things recently whereby if the user clicks the
New button, it clears the field and then set the focus to the first
field, but due to the nature of the problem (ie. Creating a new
record/document), the users already expected it to be initialized with
Focus on the first field.

Regards,
Wingot
 
hi thanks,
well im having a problem with focus in general,
the button selects the keyboard input mode for the controlpanel,
so it makes sense to keep the keyboard focus in the panel,
ive simply directed the focus to the specific control in onclick
but this will only work if i have one panel,
I may wish to have another panel,
then il have to keep trackof wich panel was
active before the button click,
wich is tiresome.

The panel is a control wich uses the XNA 3d framweork.

another problem is that in creating the panel
another form gets created with the xna framework,
wich then has its window changed to the the control panel window,
this means the application loses focus completly :s

Im looking for an alternate way of doing things but the XNA doesnt
lend itself to being used as part of a form.

however the Focus() function seems to return false indicating it failed,
I assume this is becuase CanFocus returns false but I dont seem to be able
to override this behavour.

Its driving me mad trying to debug it becuase I have to grab the focus back
every time I start it up.

the panel displays a wire mesh in 3d, the button selects wether the
keyboard/mouse pans the world, model or camera.
it doesnt make much sense a button taking the keyboard focus in this case.

Colin =^.^=



Wingot said:
Hey Colin,

From what I remember, this is actually possible, however, one point:

Users expect for your application to work like all the other
applications that run on the windows platform. This includes the basic
things like when they click minimize, it minimizes, when they click
close, it closes (maybe doing something in the background, sure). And of
course, specific to this one, when they click something, for the focus
to change.

Is it from a data entry point of view that you are asking this question?
If so, I've done related things recently whereby if the user clicks the
New button, it clears the field and then set the focus to the first
field, but due to the nature of the problem (ie. Creating a new
record/document), the users already expected it to be initialized with
Focus on the first field.

Regards,
Wingot
-----Original Message-----
From: colin [mailto:[email protected]]
Posted At: Tuesday, 4 December 2007 5:51 AM
Posted To: microsoft.public.dotnet.languages.csharp
Conversation: how to stop focus change on button click
Subject: how to stop focus change on button click

Whats the easiest way to stop a Button from
taking focus away from another control on the same windows
form ?

Ive looked and not found much so far,I think theres
a controlstyle.selectable that might do what I want
but the button wont let me access SetStyle :s

I still want the button to otherwise work, and for other things to
change focus if necessary.


Colin =^.^=
 

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

Back
Top