Jump to content

Can't set focus depending on screen location of field


Recommended Posts

Hi Guys,

This is a really strange one. I have created a slightly complicated gui that gets a bit of user input and then reads some details from an MS SQL database. It all mostly works except after I run the process once I can't set focus back to the one and only user input box.

I'm using a GUIGetMSG() loop.

The strange part is if I move the input box 75 pixels to the right it works normally.

I took the simple hello world “You pressed OK” example and of course that works ok.

I get the feeling this is some kind of timing issue.

I'm using Windows 7 64 bit with a ship load of RAM and processor speed.

Has anyone seen this kind of problem before?

I will create a cut down version of the code if you really want to look at it but I'm hoping this is a known issue.

Screen Shot Attached.

Thanks

David

post-73235-0-11562600-1338875334_thumb.j

Link to comment
Share on other sites

Have you tried ControlFocus?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Hi Brew,

Thanks for your reply.

I did tried another one _WinAPI_SetFocus($hStrataNumber)

I was wondering where I should locate the command in my program.

The only logical place is within the GUIGetMgs() loop and set the focus when a click on the field is detected.

It didn't make any difference and seemed a bit redundant and that is when I started mucking around with test fields.

I slowly went back and forth between working and not working scenarios and narrowed it down to the position of the field on the screen.

Next I'll test on an old slow machine to see if it is indeed speed related.

David

Link to comment
Share on other sites

Hello again.

It gets worse. I have found that is is not the positioning of the text box that matters.

It is where I click in the box. If I click in the extreem right hand side of the box the focus is set correctly.

If I click on the left 2/3's of the input box nothing happens.

I can't see how this can be anything else except a bug now.

I haven't tried it on another machine yet. Still working on it.

David

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...