| Summary: | Finish indexInparent and groupPosition code in Accessible | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Carolyn MacLeod <carolynmacleod4> |
| Component: | SWT | Assignee: | Carolyn MacLeod <carolynmacleod4> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 3.6 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows Vista | ||
| Whiteboard: | stalebug | ||
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
Pasting partly finished method here so that it is not lost. Code is working up to the point where we need to compare 2 IAccessibles. Apparently, the only way to do that is to compare the fields (role, etc). /* IAccessible2::get_indexInParent([out] pIndexInParent) */ int get_indexInParent(int /*long*/ pIndexInParent) { AccessibleControlEvent event = new AccessibleControlEvent(this); event.childID = ACC.CHILDID_CHILD_INDEX; event.detail = -1; for (int i = 0; i < accessibleControlListeners.size(); i++) { AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i); listener.getChild(event); } int indexInParent = event.detail; if (indexInParent == -1) { /* The application did not implement CHILDID_CHILD_INDEX, * so determine the index by looping through the parent's * children looking for this Accessible. This may be slow, * so applications are strongly encouraged to implement * getChild for CHILDID_CHILD_INDEX. */ // TODO: finish this. See also get_groupPosition int /*long*/ ppdispParent = OS.GlobalAlloc (OS.GMEM_FIXED | OS.GMEM_ZEROINIT, OS.PTR_SIZEOF); int code = get_accParent(ppdispParent); if (code == COM.S_OK) { int /*long*/ [] pdispParent = new int /*long*/ [1]; COM.MoveMemory(pdispParent, ppdispParent, OS.PTR_SIZEOF); IAccessible accParent = new IAccessible(pdispParent[0]); // TODO: do I need to release this when done? int /*long*/ pcountChildren = OS.GlobalAlloc (OS.GMEM_FIXED | OS.GMEM_ZEROINIT, 4); code = accParent.get_accChildCount(pcountChildren); if (code == COM.S_OK) { int [] childCount = new int[1]; OS.MoveMemory(childCount, pcountChildren, 4); int[] pcObtained = new int[1]; int /*long*/ rgVarChildren = OS.GlobalAlloc (OS.GMEM_FIXED | OS.GMEM_ZEROINIT, VARIANT.sizeof * childCount[0]);// TODO: don't use struct because lVal is an int (need int /*long*/) code = COM.AccessibleChildren(accParent.getAddress(), 0, childCount[0], rgVarChildren, pcObtained); if (code == COM.S_OK) { System.out.println("my address=" + getAddress()); for (int i = 0; i < pcObtained[0]; i++) { VARIANT v = getVARIANT(rgVarChildren + i * VARIANT.sizeof); if (v.vt == COM.VT_I4) { System.out.println("i=" + i + " childID=" + v.lVal); //TODO: handle childID? } else if (v.vt == COM.VT_DISPATCH) { int /*long*/[] pdispVal = new int /*long*/[1]; COM.MoveMemory(pdispVal, rgVarChildren + i * VARIANT.sizeof + 4, OS.PTR_SIZEOF); System.out.println("i=" + i + " idispatch=" + pdispVal[0]); IDispatch idispatch = new IDispatch(pdispVal[0]); // IDispatch* pDisp = vtChild.pdispVal; int /*long*/ [] ppv = new int /*long*/ [1]; code = idispatch.QueryInterface(COM.IIDIAccessible, ppv); // hr = pDisp->QueryInterface(IID_IAccessible, (void**) &pChild); if (code == COM.S_OK) { IAccessible pChild = new IAccessible(ppv[0]); if (pChild.getAddress() == getAddress()) { // TODO: According to the MSAA doc you have to look at properties to see if 2 objects are the same, not pointers. System.out.println("*found child in parent at index " + i); indexInParent = pChild.getAddress(); // ppv[0]?? break; } } // TODO: release the IDispatch and the IAccessible when done? } } } OS.GlobalFree(rgVarChildren); } OS.GlobalFree (pcountChildren); } OS.GlobalFree(ppdispParent); } if (DEBUG) print(this + ".IAccessible2::get_indexInParent returning " + indexInParent + hresult(indexInParent == -1 ? COM.S_FALSE : COM.S_OK)); COM.MoveMemory(pIndexInParent, new int [] { indexInParent }, 4); return indexInParent == -1 ? COM.S_FALSE : COM.S_OK; }