Hi Sean
The story so far...
Luciano Cane asked:
> is there a workaround to check a item menu if is checked/unchecked?
Sean wrote:
> Use Win.SendMessage() with an appropriate button's handle hButton:
> local ret=Win.SendMessage(hButton,240,0,0)
> ret is 0, 1, 2 for unchecked, checked, gray-checked respectively.
Karen asked:
> This looks interesting, but how would you get a button's handle?
Sean wrote:
> There are various ways:
> Win.Handle("cl","Button_Menu_Text")
> Win.Childhandlelist("cl","c=button") with word() ftn
> Win.HandleFromId()
> Win.HandleFromIndex()
--------------------------------------------------
Do individual menu items really have individual handles?
Maybe Win.SendMessage(zButtonHandle,240,0,0)
only works for checkboxes in dialogs, not for checkable menu items?
I tested all your suggestions,
in various apps which have checked menu items.
For all child handles, and for all child indexes,
Win.SendMessage(zButtonHandle,240,0,0) always returns 0
and the Child text never equals any menu item's label.
here are my test scripts:
;;--------- Test All Child Handles ---------------
local i zButtonHandle zChildText
local zParentHandle = win.handle("winzip")
local zButtonList = Win.Childhandlelist(zParentHandle)
;; I also tried:
;; local zButtonList = Win.Childhandlelist(zParentHandle,"c=button")
local zListSize = word(zButtonList,0)
win.debug(zListSize," :: ",zButtonList)
for (i=1;i<=zListSize;i=i+1)
zButtonHandle = word(zButtonList,i)
zChecked = Win.SendMessage(zButtonHandle,240,0,0)
zChildText = win.childtextbyindex(zParentHandle,i)
win.debug(i," ",zChecked," ",zButtonHandle," ",zChildText)
endfor
quit
;;----------- Test All Indexes --------
local zParentHandle = win.handle("calculator")
local i zChecked zChildText zButtonHandle
for (i=1;i<300;i=i+1)
local zChildText = win.childtextbyindex(zParentHandle,i)
if(_EOF_ == 1)do
;; after all indexes are processed, _EOF_ == 1
break
endif
zButtonHandle = win.handlefromindex(zParentHandle, i)
zChecked = Win.SendMessage(zButtonHandle,240,0,0)
win.debug(i," ",zChecked," ",zButtonHandle," ",zChildText)
endfor
quit
;;------------------------------------------------
I also tried win.childtextbyid() instead of win.childtextbyindex()
in a similar script
;;-----------------------------------------------
I also tried things like this, with various apps,
using the labels of menu items which use checkmarks,
but they always returned blank lines (no handle):
win.debug(Win.Handle("winzip","Reuse WinZip Windows"))
win.debug(Win.Handle("winzip","&Reuse WinZip Windows"))
Maybe there is no way to test whether a menu item is checked.
Alan M
------------------------ Yahoo! Groups Sponsor --------------------~-->
Get to your groups with one click. Know instantly when new email arrives
http://us.click.yahoo.com/.7bhrC/MGxNAA/yQLSAA/JV_rlB/TM
--------------------------------------------------------------------~->
Attention: PowerPro's Web site has moved: http://www.ppro.org
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/power-pro/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/