Jump to content

ControlSetText doesn't appear to be working


Recommended Posts

Hi All,

I'm developing a script where I use the ControlSetText function to pass values to a fields on a form. However, the problem I've discovered is that none of the controls save their values when I save the form. Why is this? I then went and tried the ControlSend function which seems to work but the problem with this is the text is all lowercase. This I suppose is because this is sending keystrokes rather than a literal value.

Can someone recommend a fix/workaround to this? If there isn't one then I will begin work on writing a wrapper for the ControlSend function where it will send each key stroke based on the ASCII value of the text.

Thanks

Link to comment
Share on other sites

I don't understand what you mean, ControlSetText() do support uppercased characters, see:

$hWnd = GUICreate("test", 200, 100)
$hInput = GUICtrlCreateInput("", 20, 20, 160, 22)
GUISetState()

ControlSetText($hWnd, "", $hInput, "AaBbCc")

Do
    Sleep(10)
Until GUIGetMsg() = -3
Link to comment
Share on other sites

I don't understand what you mean, ControlSetText() do support uppercased characters, see:

$hWnd = GUICreate("test", 200, 100)
$hInput = GUICtrlCreateInput("", 20, 20, 160, 22)
GUISetState()

ControlSetText($hWnd, "", $hInput, "AaBbCc")

Do
    Sleep(10)
Until GUIGetMsg() = -3

The syntax I'm using is correct and the values I pass do get sent to the textbox. Problem seems to be that the application I'm controlling isn't setting the value instead just displaying it. I think the application is written in Borland so I don't know if that makes any difference.
Link to comment
Share on other sites

The reason the application is not saving the values you enter on the form using ControlSetText() is probably because the application only reads the content of the field when the user presses enter or tabs to another field.

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

The reason the application is not saving the values you enter on the form using ControlSetText() is probably because the application only reads the content of the field when the user presses enter or tabs to another field.

That's what I first thought, but then when I tried the ControlSend command that seems to work. I will however try once more as per your suggestion and see if I've missed something.

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...