OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

XButton properties

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Hugo Santos
Newbie
Newbie


Joined: 10 May 2012
Posts: 2

PostPosted: Thu May 10, 2012 6:05 am    Post subject: XButton properties Reply with quote

Hi!

I'm making a extension for openoffice, i'm needing to do an interface like install interfaces with "next" and "back" buttons. I would like some help to change or delete the button "back" on the first step window. Another one a need to delete a textFrame e change the text of the "next" button to "finish".

So, i need some help to delete my interface dialogs without close and reopen my window.

this is how i set button properties as shown below:
Code:

public Object insertButton(int posX, int posY, int width, String label, int pushButtonType, boolean enabled, String uniqueName) throws Exception {

        // Create a button control model
        Object oButtonModel = xMultiComponentFactoryDialogModel.createInstance("com.sun.star.awt.UnoControlButtonModel");

        // Set the properties at the model
        XPropertySet xButtonPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oButtonModel);
        xButtonPropertySet.setPropertyValue("PositionX",new Integer(posX));
        xButtonPropertySet.setPropertyValue("PositionY",new Integer(posY));
        xButtonPropertySet.setPropertyValue("Height",new Integer(14));
        xButtonPropertySet.setPropertyValue("Width",new Integer(width));
        xButtonPropertySet.setPropertyValue("Label",(label != null)? label: "");
        xButtonPropertySet.setPropertyValue("PushButtonType",new Short((short) pushButtonType));
        xButtonPropertySet.setPropertyValue("Name",uniqueName);
        xButtonPropertySet.setPropertyValue("Enabled",enabled);

        // Add the model to the dialog model name container
        xDialogModelNameContainer.insertByName(uniqueName, oButtonModel);

        // Add to a list of buttons
        oButtonModelList.add(oButtonModel);
        System.out.println("UN:"+uniqueName);

        return oButtonModel;

    }


this is how i insert the button into the interface as shown below:
Code:

//Keep button properties object to change when needed
            buttonPropertiesBack = dialog1.insertButton(50, 80, 30, "Voltar", PushButtonType.STANDARD_value, true, "backButton");

            XControl xButtonControlBack = dialog1.getxDialogContainer().getControl("backButton");
            //Create Button
            xbBack = (XButton) UnoRuntime.queryInterface(XButton.class, xButtonControlBack);
            //xbvoltar = dialog1.insertButton(50, 80, 30, "Voltar", PushButtonType.STANDARD_value, false);
            xbBack.addActionListener(new XActionListener() {

                public void actionPerformed(ActionEvent arg0) {
                    try {
                        if (train == 0) {
                            System.out.println("Primeiro treino");
                            buttonPropertiesBack = dialog1.insertButton(50, 80, 30, "Voltar", PushButtonType.STANDARD_value, false, "backButton");
                            XControl xButtonControlBack = dialog1.getxDialogContainer().getControl("backButton");
                            //Create Button
                            xbBack = (XButton) UnoRuntime.queryInterface(XButton.class, xButtonControlBack);
                        } else {
                            dialog1.insertTextField(10, 10, 230, 60, texts[--train]);
                        }
                    } catch (Exception ex) {
                        Logger.getLogger(TrainingDialog.class.getName()).log(Level.SEVERE, null, ex);
                    }
                    throw new UnsupportedOperationException("Not supported yet.");
                }

                public void disposing(EventObject arg0) {
                    throw new UnsupportedOperationException("Not supported yet.");
                }
            });


this code is working to add, but i dont know how to remove the interface component.

thanks for help!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group