| Summary: | CCombo does not return it's actual children | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Elias Volanakis <elias> | ||||
| Component: | SWT | Assignee: | Platform-SWT-Inbox <platform-swt-inbox> | ||||
| Status: | CLOSED WONTFIX | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | eclipse.felipe, remy.suen | ||||
| Version: | 3.7 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows Vista | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
This patch is wrong. The code in ccombo overrides getChildren() so it does not return any children (as you saw). This behaviour is intentional, if the code wasn't there (as in your patch) getChildren() would return the internal children that make up the CCombo (the Text/Button/List). These children are private and should never be accessed outside of CCombo's implementation. Here the java doc in CCombo: * Note that although this class is a subclass of <code>Composite</code>, * it does not make sense to add children to it, or set a layout on it. What are you trying to do ? We have styling code iterates over parts of the widget tree (i.e. starting at an element and moving down to all branches and children) and applies certain settings uniformily to all contents. The CCombo looks odd because it hides it's contents. I've added a special case + reflection to work around (brittle but works for us). |
Created attachment 173882 [details] Patch CCombo extends Composite but ccombo.getChildren() always returns a 0-length array. It should return the actual children of the composite. (Background: Not returning the actual children controls causes the contents of CCombo to be ignored by Riena's styling code. We have to use reflective access to private fields to get the CCombo's children :(.) The attached patch removes getChildren() so that the default implementation is used.