posted 11 years ago
I am working on an SWT application in which I would like to allow users to customize to show only selected application buttons. I have created a Composite object (the "button area") and set a RowLayout as follows:
The "button area" contains 4 buttons, each with a unique RowData object as follows:
Everything works fine until I attempt to show or hide a button. I attempt to do so by setting the rowData.exclude flag and invoking layout on the parent button area object. A button is always shown or hidden but the button shown or hidden is not necessarily the correct one. I have noticed that if I hide the buttons IN ORDER from left to right, e.g. button 1, button 2, button 3, button 4, the buttons are hidden correctly. Conversely, if I show the buttons in order from right to left, e.g. button 4, button 3, button 2, button 1, the buttons are shown correctly.
However, If I attempt to hide a button that is not the leftmost button shown, I observe unpredictable results. For example, if I attempt to hide button 4, button 2 may be hidden even though the application status message clearly states button 4 has been hidden. Similar results are observed when attempt to show a button that is not the rightmost one not shown.
I have tried working with GridLayout and GridData but have observed similar results. I have debugged thru the code and I am certain the correct button exclude flag is being set prior to layout being invoked. I am also certain unique RowData objects are being created for each button. The SWT button object references cannot change because they are declared final.
Am I attempting to do this incorrectly? Any suggestions would be appreciated!