473,425 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,425 software developers and data experts.

Up/Down keys aren't recognized when button in focus

Hi again,
With much help, I've finally gotten the Tab key to be recognized when a
textbox is in focus, but now I'm having trouble with the up/down keys when
they're focused on a custom button (on KeyDown, when I ask to show keyCode,
nothing happens (except for Enter) so the focus goes to some textboxes that
should never receive focus).
I can think of 3 options, but don't know how to do any of them:

1) Say that these textboxes should never receive focus.

2) I changed my button to a system button and tried the same thing as I did
for the Tab key, but I hate how the system highlights the button - So, change
the button so that it does get that background highlight (but does have the
dotted rectangle when in focus).

3) Program into my code for the custom button that it should recognize the
up/down keys.

Thanks again!
Mel

This is the code for my button (from an example in the MS Visual C# .NET
Step by Step book):

using System;
using System.Windows.Forms;
using System.Drawing;

namespace ToleranceUnits
{
/// <summary>
/// Summary description for Class1.
/// </summary>
public class Toggle3x : CheckBox
{
public Toggle3x()
{
//
// TODO: Add constructor logic here
//

this.Appearance = Appearance.Button;
this.gmcm = "gm-cm";
this.gmin = "gm-in";
this.ozin = "oz-in";
this.gmcmColor = Color.Gold;
this.gminColor = Color.Blue;
this.ozinColor = Color.Fuchsia;

}

private string gmcm;
private string gmin;
private string ozin;
private Color gmcmColor;
private Color gminColor;
private Color ozinColor;

public string Gmcm
{
get
{
return this.gmcm;
}
set
{
this.gmcm = value;
}
}
public string Gmin
{
get
{
return this.gmin;
}
set
{
this.gmin = value;
}
}
public string Ozin
{
get
{
return this.ozin;
}
set
{
this.ozin = value;
}
}
public Color GmcmColor
{
get
{
return this.gmcmColor;
}
set
{
this.gmcmColor = value;
}
}
public Color GminColor
{
get
{
return this.gminColor;
}
set
{
this.gminColor = value;
}
}
public Color OzinColor
{
get
{
return this.ozinColor;
}
set
{
this.ozinColor = value;
}
}
}
}
Nov 17 '05 #1
1 1839
Nevermind - 2 seconds after I posted this I realized I could do an
Focus-Enter Event for the textboxes that I didn't want entered.
Mel

"melanieab" wrote:
Hi again,
With much help, I've finally gotten the Tab key to be recognized when a
textbox is in focus, but now I'm having trouble with the up/down keys when
they're focused on a custom button (on KeyDown, when I ask to show keyCode,
nothing happens (except for Enter) so the focus goes to some textboxes that
should never receive focus).
I can think of 3 options, but don't know how to do any of them:

1) Say that these textboxes should never receive focus.

2) I changed my button to a system button and tried the same thing as I did
for the Tab key, but I hate how the system highlights the button - So, change
the button so that it does get that background highlight (but does have the
dotted rectangle when in focus).

3) Program into my code for the custom button that it should recognize the
up/down keys.

Thanks again!
Mel

This is the code for my button (from an example in the MS Visual C# .NET
Step by Step book):

using System;
using System.Windows.Forms;
using System.Drawing;

namespace ToleranceUnits
{
/// <summary>
/// Summary description for Class1.
/// </summary>
public class Toggle3x : CheckBox
{
public Toggle3x()
{
//
// TODO: Add constructor logic here
//

this.Appearance = Appearance.Button;
this.gmcm = "gm-cm";
this.gmin = "gm-in";
this.ozin = "oz-in";
this.gmcmColor = Color.Gold;
this.gminColor = Color.Blue;
this.ozinColor = Color.Fuchsia;

}

private string gmcm;
private string gmin;
private string ozin;
private Color gmcmColor;
private Color gminColor;
private Color ozinColor;

public string Gmcm
{
get
{
return this.gmcm;
}
set
{
this.gmcm = value;
}
}
public string Gmin
{
get
{
return this.gmin;
}
set
{
this.gmin = value;
}
}
public string Ozin
{
get
{
return this.ozin;
}
set
{
this.ozin = value;
}
}
public Color GmcmColor
{
get
{
return this.gmcmColor;
}
set
{
this.gmcmColor = value;
}
}
public Color GminColor
{
get
{
return this.gminColor;
}
set
{
this.gminColor = value;
}
}
public Color OzinColor
{
get
{
return this.ozinColor;
}
set
{
this.ozinColor = value;
}
}
}
}

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: ehm | last post by:
I apologize in advance for the cross-post (from microsoft.public.inetexplorer.scripting), but that board seems dead. I have what I think is a fairly simple problem, but I cannot figure this out....
5
by: gsb | last post by:
I track the mouse location like this code: function mousePos(e) { var p = new Object(); if(e) { p.x = e.pageX; p.y = e.pageY; } else { p.x = event.x; p.y = event.y; } ... (show) }...
1
by: Richard Coutts | last post by:
I have a Continous Form with 5 or so fields for each record, in a line from left to right. Because the Contuous Form lists several records at once, the form looks pretty much like a Datasheet. ...
2
by: Darren Oakey | last post by:
ok - the problem - I made a simple breakout game out of a form, just painting the background - and using keydown for left and right arrow keys to control the bat - worked fine. I then moved all...
1
by: BuddyWork | last post by:
Hello, If you copy the source code from this post into seperate files as stated, and compile the code. Now to reproduce run the code in debug. 1. Press the Client button. 2. Put the cursor...
18
by: jrhoads23 | last post by:
Hello, I am trying to find a way to tell if an .NET windows forms Button (System.Windows.Forms.Button) is "depressed" (pushed down). For my application, I can not use a check box control set to...
10
by: Bob | last post by:
Hello: I'm tring to make the down arrow act as a tab key and the up arrow act as like (-TAB.). I have this for the down arrow but nothing happens. Protected Overrides Function...
16
by: Ben | last post by:
I'm doing a bunch of data mining against a postgres database and have run into an interesting problem with deadlocks. The problem is, postgres is detecting them and then wacking the offending...
3
by: hurricane_number_one | last post by:
I want to be able to play/pause/next/back the tracks in whatever media player app is running. So if iTunes is running, it will receive those commands, if Windows Media Player is, it will receive...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.