Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-ui-dev] How to right align the buttons created in createButtonsForButtonB ar()?

You want to tweak the layout data of the button itself, not the containing 
composite.
Take a look at Dialog.setButtonLayoutData.

Nick





"Jin, Steve" <sjin@xxxxxxxxxxxx>
Sent by: platform-ui-dev-admin@xxxxxxxxxxx
01/14/03 08:00 PM
Please respond to platform-ui-dev

 
        To:     "'platform-ui-dev@xxxxxxxxxxx'" <platform-ui-dev@xxxxxxxxxxx>
        cc: 
        Subject:        [platform-ui-dev] How to right align the buttons created in 
createButtonsForButtonB ar()?



I have a subclass of org.eclipse.jface.dialogs.Dialog, in which I 
overwrite the createButtonsForButtonBar() method to create my own buttons. For some 
reason, the buttons are left aligned, but I want them to be right aligned. 
Here is a code snippet. 
        protected void createButtonsForButtonBar(Composite parent) 
        { 
                Button button1 = createButton(parent, 1, "Button1", true); 
                Button button2 = createButton(parent, 2, "Button2", false); 
        } 
Since it doesn't work as I expected, I add a little more to change the 
parent's grid data like this before buttons are created.

                GridData pGridData = (GridData) parent.getLayoutData(); 
                pGridData.horizontalAlignment = GridData.HORIZONTAL_ALIGN_END; 
                parent.setLayoutData(pGridData); 
Still the same. Could anyone help? Thanks! 




Back to the top