473,657 Members | 2,270 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Focus to a disabled control?

3 New Member
I have a combobox. In the validating event of the combobox I check what value is chosen. If the value is "Skip" then I set the next control in the tabindex to enabled=false.

But when I tab out of the combobox and the value is "Skip", the activecontrol is the control just disabled in the validating event. Why does it set focus to a disabled control?
Dec 6 '07 #1
3 1293
Plater
7,872 Recognized Expert Expert
Is this a web application or a windows application.
Disabled controls should not be able to receive focus.
Dec 6 '07 #2
kea62227
3 New Member
Is this a web application or a windows application.
Disabled controls should not be able to receive focus.
It is a windows application.
Well I was not precise enough: When pressing tab in the combobox when "Skip" is chosen the following happens:

The ActiveControl of the form is the disabled control, but the focus stays in the combobox.
I had hoped the focus would go to the first enabled control after the combobox. That would seem logical to me.
Dec 6 '07 #3
Plater
7,872 Recognized Expert Expert
Are you making the control disabled when the combobox loses focus? I could see that behavior happening in that situation.
Need to set the control to disabled before the lostfoucs event fires
Dec 6 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

31
2836
by: Benno Bös | last post by:
If I use the following construct in the frame "main" for a link to an extern site: <A HREF="http://www.any.xy" TARGET="extern"> the Browser is creating the window "extern", loading the page www.any.xy an setting the focus to "extern". But when I go return to "main" without closing "extern", a click to an other link (e.g. www.2nd_any.xy) on "main" does not setting the focus to "extern".
4
2855
by: Colleyville Alan | last post by:
I have 2 command buttons on a form. I want the first one to be enabled and the second one to be disabled when the form is opened. That works fine. Then, after the user has pressed the first button, I want them reversed - button #2 is enabled and #1 is disabled. But I keep getting this error message: "You can't disable a control while it has the focus". The code is basically this: Upon open
0
1486
by: Carlos Lozano | last post by:
Hello everybody, I Have a piece of code for a Pocket PC that has a disabled and hidden textbox control at startup. It is enabled and set visible programatically. The cursor is captured calling the focus method. The problem is: the focus is lost almost inmediately. I can't type in anything. See the code below.
2
5185
by: Marco Liedekerken | last post by:
Hi, Is it possible to retrieve the control that had the focus when the page was posted back? Because the focus is lost when a postback occurs I want to manually set the focus to the control that previously had the focus (smartnavigation doesn't do the trick). Thanks, Marco
4
3133
by: PK9 | last post by:
I have a button at the top of my page that I have an onClick event handler for which makes some new controls (at the bottom of my page) visible. When the user clicks the button I make the new controls visible in the onclick event handler, but I do not know how to bring the focus to the bottom section of the page. So basically, when the user clicks the button, everything works correctly in the onclick (all controls are made visible),...
9
18001
by: Zytan | last post by:
http://msdn2.microsoft.com/en-us/system.windows.forms.control.focus(VS.80).aspx this page says: "Focus is a low-level method intended primarily for custom control authors. Instead, application programmers should use the Select method or the ActiveControl property for child controls, or the Activate method for forms." I am trying to give a Numeric UpDown control focus. Only Focus() works. But this says to not use it.
5
5262
by: LabGeek | last post by:
I have an Access application that I have created that collects data from a scanner and from a weighting scale. The data from the scanner are unique identifiers (barcodes) and the scanner is connected as a keyboard wedge. The data from the scale are weights and are collected by com port using MScomm32.ocx. A user will scan a barcode into a text box (linked to a table field) and then weight a sample. The weight will be collected from...
5
11644
by: Matt B | last post by:
I know this is a bit of nonstandard behavior, but I would like the Enter key to move focus through a group of radiobuttons without selecting them. The user would then have to use Space or actually click to select one of the radiobuttons to select. The default behavior of Focus() seems to also select the radiobutton, but I can't seem to find what is causing this to happen. I would like very much to seperate the Focus and the selection....
0
8323
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8838
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8513
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8613
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7351
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5638
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2740
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1732
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.