Thanks Michael for the additional info.  Evidently I was getting off-track
with "owner drawn" controls.
 
Just so you understand what I was saying: I have made a listbox speak,
through scripting, in the MS Word VBA IDE.  it has a .type property of
listbox, however, the .text property of the control never returns anything.
 
so, if it were a windowless control, at this level, would it have a .type
property of listbox?  is that something window eyes is setting for us
scripters, or is what I'm dealing with a regular listbox?  And if it's a
regular listbox, shouldn't the .text property then work?
 
thanks.
 
Chip
 

  _____  

From: Michael D. Lawler [mailto:[email protected]] 
Sent: Wednesday, December 16, 2009 11:22 AM
To: [email protected]
Subject: RE: to GW; was Text from a Menu


Chip just so you know Word doesn't use owner drawn listboxes it uses
windowless controls and you can only use MSAA to communicate with them.  You
can see this by looking at the class and type of the windows in question.
WE tells users these controls are buttons, listboxes, checkboxes, because
they look and work like them, but when you get to the scripting level they
are completely different animals.



At 11:16 AM 12/16/2009, you wrote:


thanks again Doug.
 
this gives me an idea for a script though: I'll take the techniques I've
developed in the ms office script, where I'm able to read an owner-drawn
listbox and find the highlighted item, and turn them into a script which
monitors for any such listbox, and speaks them when they're the active
control.
 
I know it won't help the ones which are graphic in nature, but it may help
in some situations.  
 
Chip
 


  _____  

From: Doug Geoffray [  <mailto:[email protected]>
mailto:[email protected]] 
Sent: Wednesday, December 16, 2009 9:08 AM
To: [email protected]
Subject: Re: to GW; was Text from a Menu

Chip,

No problem.  But just to be clear, owner drawn means the owner of the
control is responsible for displaying the contents of the listbox.  Normally
when you use a listbox you simply give the listbox all the data and the
listbox itself is responsible for putting up the items that we see.  Given
this it is easy to query the listbox directly to get the text of any item.
But if the listbox is owner drawn then it tell the owner that it needs to
display the contents.  So the control itself doesn't have a clue of what is
displayed.  Typically owner drawn is used if you want to display something
like a graphic or something more visually appealing then just standard
looking text.

Regards,
Doug

Chip Orange wrote: 


Hi Doug,
 
I guess I don't understand what "owner drawn" means; I thought it meant
non-window eyes listboxes.  I see now it's something else, so sorry for the
confusion.
 
Chip
 


  _____  

From: Doug Geoffray [mailto:[email protected]] 
Sent: Tuesday, December 15, 2009 8:25 AM
To: [email protected]
Subject: Re: to GW; was Text from a Menu

Chip,

As you mentioned, it worked for other listboxes.  So as long as the listbox
is not owner drawn then the text field works.  It doesn't make sense to
remove the text property just because owner drawn listboxes don't work when
all non-owner drawn work great.

Regards,
Doug

Chip Orange wrote: 


ok, thanks Michael, I'll go test msaa again, as it too wasn't giving me the
selected text back when I wrote this project.
 
if this feature doesn't work, why then is the "text" property for the
listbox control  in the object model?
 
thanks.
 
Chip
 


  _____  

From: Michael D. Lawler [mailto:[email protected]] 
Sent: Monday, December 14, 2009 12:03 PM
To: [email protected]
Subject: RE: to GW; was Text from a Menu

This is as good as it gets short of using MSAA as you can't get text via
Win32 for owner drawn list boxes and in the case of Word they are not using
Win32 controls so you have to use MSAA.



At 06:22 PM 12/12/2009, you wrote:


ok, I decided to write my own test script rather than send GW into the
archives.
 
I thought I remembered they had fixed it, but my test script shows it's
mostly fixed, but there are places I found, such as listboxes put up by
MSWord, where the text of the selected item was always empty.  you could get
the number of the selected item, and I guess that's something, but you could
not get text of any item.
 
in other places, such as the listbox displayed by WE for the systray apps,
it was able to tell me the text of the selected item.
 
sorry for the sidetrack.
 
Chip
 


  _____  

From: Chip Orange [ mailto:[email protected]] 
Sent: Saturday, December 12, 2009 12:45 PM
To: [email protected]
Subject: RE: to GW; was Text from a Menu

thanks Jeff.
 
I appreciate the example of how to create a listbox.
 
my problems in the past though, and my question, was related to listboxes
which were created by other applications.  I would get pointers to them via
the window structures, or via msaa info and the accessible structures, and
neither one would properly indicate which item was the selected item, even
when an msaa event came through for a selection having been made.
 
My conversations with Aaron at the time indicated GW knew about the problem,
so I was wondering if they knew if it had been fixed.
 
thanks.
 
Chip
 


  _____  

From: Jeff Weiss [ mailto:[email protected]] 
Sent: Friday, December 11, 2009 9:35 AM
To: [email protected]
Subject: RE: to GW; was Text from a Menu

I know that identifying a simple listBox item was fixed with an earlier
version of the toolkit.

This example from the manual does work:

 

' This example creates a simple dialog with a sorted list box of three
items,

' along with custom default ' and cancel buttons, and returns a string of
the

' data associated with the selected item.

 

Dim myHotkey : Set myHotkey =
Keyboard.RegisterHotkey("Alt-Control-Shift-I","DisplayListBox")

 

Function DisplayListBox()

Set myListBox = SharedObjects("com.GWMicro.GwToolkit.SimpleDialogs",
90000).ListBoxDialog

myListBox.AddItem "Red", "Red"

myListBox.AddItem "Green", "Green"

myListBox.AddItem "Blue", "Blue"

 

myListBox.Sort = True

myListBox.DefaultButton = "&amp;Ok"

myListBox.CancelButton = "Close"

Dim returnValue : returnValue =  myListBox.ChooseItem("Select a color")

Sleep 3000

Speak ReturnValue

Sleep 2000

 

' If the green item was selected with the OK button,

' speak would announce, "Green."

 

End Function 

 

This may not be the problem you are considering, but I know this one was
fixed.

Jeff Weiss

 

 

From: Chip Orange [ mailto:[email protected]] 
Sent: Thursday, December 10, 2009 7:23 PM
To: [email protected]
Subject: to GW; was Text from a Menu

 

Hello GW,

 

this reminds me: some versions back I was trying to do this kind of thing to
see which choice of a listbox was the selected one, and this wasn't working,
and was confirmed as a bug in WE.  I think it wasn't working in either the
listbox control structure or the accessible info.

 

Can you tell me if seeing which choice is the selected one in a listbox is
now possible?

 

thanks.

 

Chip

 

 

 

  _____  

From: Stephen Clower [ mailto:[email protected]] 
Sent: Wednesday, December 09, 2009 10:31 PM
To: [email protected]
Subject: Re: Text from a Menu

J.J.,

If you're looking at the menu through MSAA, you might test for something
like:

Set accObj = FocusedWindow.Accessible ' Assuming the focused window is a
menu, set the accObj variable to hold the Accessible representation of the
focused item.
If accObj.State = state_SYSTEM_CHECKED Then
' item is checked.
Else
' It isn't.
End If

Hope this helps.
Steve



On 12/9/2009 10:22 PM, J.J. Meddaugh wrote: 

Hello. I was wondering if someone could point me in the right direction of
how to obtain the state of a checkbox that's inside of a standard
application menu? I was looking all over the script manual, but apparently
not hard enough. 

Thanks. 

 

J.J. Meddaugh - ATGuys.com
A premier Licensed Code Factory and KNFB Reader distributor 

 


-- 
Michael D. Lawler
Voice 260-489-3671
Fax 260-489-2608
Internet mailto:[email protected]
web http://www.gwmicro.com <http://www.gwmicro.com/> 
ftp ftp://ftp.gwmicro.com <ftp://ftp.gwmicro.com/> 
GW Micro, Inc.,
Development Liaison and Technical Support Supervisor

-- 
Michael D. Lawler
Voice 260-489-3671
Fax 260-489-2608
Internet mailto:[email protected]
web http://www.gwmicro.com <http://www.gwmicro.com/> 
ftp ftp://ftp.gwmicro.com <ftp://ftp.gwmicro.com/> 
GW Micro, Inc.,
Development Liaison and Technical Support Supervisor


Reply via email to