Jump to content

Button refuses to get state


Nogo
 Share

Recommended Posts

Hello

while trying to get "isChecked" of a Button, I do not find a function working

Software: Edax Genesis, Modul Maps/line

Button: "Collect Maps"

All different "get" functions do not give a result but "0" or ""

, regardless the button is not pressed or indicates pressed state by a yellow color.

I've tried this (and more):

#include <Date.au3>
#include <GuiButton.au3>
WinActivate("Genesis")
Sleep(1000)
$hwnd = ControlGetHandle ("[class:.C:\development\Genesis\Source\Apps\idx32\IDXCOLL.CPP]","Dwell[us]",267 )
MsgBox(0,"",$hwnd)
MsgBox(0,"",_GUICtrlButton_GetState($hwnd))
WinActivate("Genesis")
Sleep(1000)
MsgBox(0,"",WinGetPos($hwnd))
WinActivate("Genesis")
Sleep(1000)
;GUISwitch($hwnd)
_GUICtrlButton_SetSize($hWnd, 89, 63)
WinActivate("Genesis")
Sleep(1000)
MsgBox(0,"",_GUICtrlButton_GetState($hwnd))
WinActivate("Genesis")
Sleep(1000)
MsgBox(0,"",ControlGetPos($hwnd,"","[ID:267]" ))
WinActivate("Genesis")
Sleep(1000)
MsgBox(0,"",ControlCommand("[class:.C:\development\Genesis\Source\Apps\idx32\IDXCOLL.CPP]","Dwell[us]",267,"isChecked",""))

Not only the result is unexpected, every read of properties get a failure beep.

But The _GUICtrlButton_SetSize works! (without beep)

So the handle, class and ID should be right.

I think, that the button just is set to a yellow color to indicate running measurement, but is not pressed. Thats why i want to get Pos and then read color of a pixel.

V3 Windows Info gets the position, regardless using spy++ or not.

Why can't Autoit get the position?

Is there an option in autoit to change the control detection (like V3 Window Info)?

many thanks to your interest,

nogo

Link to comment
Share on other sites

ControlGetPos returns array variable so you cant display it in msgbox directly, look in help file for ControlGetPos command and its example

if i remamber correctly normal buttons dont have check box, so there isnt any point of trying to use isChecked on something that button dont have.

you can try to see if "IsEnabled" return needed results, but its still a long shot. If you dont finde solution my recomandation is comparing color on button pos with PixelGetColor.

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

#include <Date.au3>
#include <GuiButton.au3>
#include <Array.au3>
WinActivate("Genesis")
Sleep(1000)
$hwnd = ControlGetHandle ("[class:.C:developmentGenesisSourceAppsidx32IDXCOLL.CPP]","Dwell[us]",267 )
MsgBox(0,"",$hwnd)
MsgBox(0,"",_GUICtrlButton_GetState($hwnd))
$arrPOS = WinGetPos($hwnd)
_ArrayDisplay($arrPOS)

I've overlooked the result is an array.

This works now for me, thanks for your help.

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