How to keeps button in center of resizable dialog/panel?

Hi all,
Is there any ways to make a button still in center of dialog/panel when I resize dialog/panel without changes its frame size?
I'm using kBindAll but the button will be changed frame size. Can anybody please help me resolve that?
My attribute of button:
ButtonWidget
  kAMPBrowseBtWidgetID,
  kSysButtonPMRsrcId, // The Plugin ID
  kBindAll, // Frame binding
  Frame(64,220,200,246) // Frame(4,4,265,320) // Frame
  kTrue, // Is this visible
  kTrue, // Is this enabled
  "Browse Pages", // The String value

Hi,
I couldn't get it to work using the binding.
There may be a better way of doing it, but I got it working by setting to kBindNone and moving the button on panel resize events:
Firstly, make sure you have a custom class for your panel's control view.
Mark it up in the fr file for the panel's widget boss class with:
IID_ICONTROLVIEW, kMyPanelViewImpl,
Add to the ID definitions, factory list etc and set up a MyPanelView class (or whatever you want to call it...), derived from PanelView, for this implementation
Then in your MyPanelView class, setup the Resize function as below:
void MyPanelView::Resize(const PMPoint& dimensions, bool16 invalidate)
    PanelView::Resize(dimensions, invalidate);
    InterfacePtr<IPanelControlData> panelData(Utils<IPalettePanelUtils>()->QueryPanelByWidgetID(kMyPanelWidgetID));
    if(panelData == nil) return;
    IControlView *myWidget = panelData->FindWidget(kMyButtonWidgetID);
    if (myWidget == nil) return;
    PMRect theFrame = myWidget->GetFrame();
    PMReal left = (dimensions.X() - theFrame.Width()) / 2;
    PMReal right = left + theFrame.Width();
    theFrame.Left(left);
    theFrame.Right(right);
    myWidget->SetFrame(theFrame, kTrue);
You will need these includes:
#include "Utils.h"
#include "IPalettePanelUtils.h"
Hope that helps

Similar Messages

  • How to keep scale for height when resizing width?

    Hi i have a serious of images different sizes/ ratios, which need to display at a fixed width of 50. Great works... but how do I resize the height to keep it at its original ratio?
    this.attachMovie(small_image, "number1_mcs" + loop , this.getNextHighestDepth(), {_x:50 + (loop*50),_y:300,_width:50,_yscale:?????????????});}
    many thanks in advance
    Dee

    Thanks for your help, being new, "terms", practices etc which others may fully understand, can fly right over ones head... It doesn't mean its impossible to understand them just grasping the exact meaning and then the specifics of any technicality can cause one to pull out more hair, especially when tired...
    I fixed the problem using the following... i hope its not too ugly..!
    Dee
    this.attachMovie(small_image, "number1_mcs" + loop_n1 , this.getNextHighestDepth(), {_x:75 + (loop_n1*40),_y:350});
    var aspect_ratio_x = this["number1_mcs"+loop_n1]._width;
    var aspect_ratio_y = this["number1_mcs"+loop_n1]._height;
    var aspect_ratio = (aspect_ratio_x / aspect_ratio_y);
    this["number1_mcs"+loop_n1]._width = 40;
    this["number1_mcs"+loop_n1]._height = this["number1_mcs"+loop_n1]._width / aspect_ratio;

  • How to keep the watch to display without press the button on my iPod Nano 6th)?

    Dear Guys,
    I have purchased a watchband for my ipod nano 6th recently, overall is okay but i don't know how to keep the watch to display without pressing the sleep/resume button on edge? Also, the screen is not showing the watch immeditaly when I press the button, it shows the music/cd folder, then I need to scroll the screen back to the watch display.  Please help.

    There is no way to keep the display on permanently, as doing so would significantly reduce the overall life of the battery.  It would maybe last only hour, maybe not even.
    As for having your iPod wake up to the watch view, head to Settings -> General -> Time on Wake -> On.
    B-rock

  • Lyrics not show in Nano-keep pressing the center button but nothing, help!!

    Hi there,
    i keep pressing the center button until the lyrics appears but still nothing there, can you please help.
    thx

    I'm not sure if the right click will work. I instead will click on a song and select "get info", then choose the lyric tab.
    -Isn't that exactly what she said she did?
    Does the lyrics pane come up empty on the iPod, or does it go straight from artwork to ratings and completely skip the lyics?
    Tom

  • How to keep the WBS & Order in account assignment tab of SD contract item?

    Hi Experts,
    If I remove the plant from the shipping tab in the contract item (the contract type is WV), I will be able to enter the WBS or Order in accounting assignment tab. However, if I enter the plant (in order to determine the tax in pricing), the WBS and Order are disappered and there is one new settlement rule button showed up.
    Do you know any configuration could keep the WBS and order in the accounting assigment tab even the plant is there.
    Thanks in advance!
    Norman

    Hi Chandra,
    Thanks for your answer. However, I even added the plant in the WBS, the tax (we use tax jurisdiction) still could not be determined.
    The problem is that SAP changes the account assignment tab screen (it suppresses the WBS and Order fields, but addes settlement rule) with the plant in the shipping tab. Do you know how to keep the same account assignment tab screen with the plant in the shipping tab?
    Thanks,
    Norman

  • How do I fill the center of this in??

    Hi folks,
    Attached is a backing for a logo I am using. It is swirls that I then put text in the middle. Works and looks fine when I place text and have the middle transparent however I need the middle to be a solid colour also.
    I may be a little dim here but I cant work out how to fill in the center part of this so to make it solid.
    I still need to keep it as a .png so I can change the colours.
    Can anyone help me out please?
    Many thanks, Pete

    If I were doing it, I would create a second layer and use the paintbrush tool to manually fill in what you need. You will then be able to change the color as needed (in Fireworks).

  • How to keep f4 help for a particular field in module pool problem-urgent

    hi all,
    i am displaying output using alv list display. here i am showing my pf status here. in this status i have one button called position. when i click this button it is showing pop up inside this pop up  i am showing appln
    for this i need keep f4 help. anybody can tell me how to keep f4 help fo this field.
    thanks,
    maheedhar.t

    Hi Maheedhar,
    You need to use function module POPUP_GET_VALUES.
    If you want see sampl eprogram for this check the program RSSPO410.
    Execute this program and input Example2 = X in the selection screen.
    Code from the above Program:
    DATA: BEGIN OF FIELDS OCCURS 1.
            INCLUDE STRUCTURE SVAL.
    DATA: END OF FIELDS,
          RETURNCODE(1)       TYPE C,
          POPUP_TITLE(30)     TYPE C.
      POPUP_TITLE       = 'Nachrichten anzeigen'(200).
      CLEAR FIELDS.
      FIELDS-TABNAME    = 'T100'.
      FIELDS-FIELDNAME  = 'ARBGB'.
      FIELDS-FIELDTEXT  = 'Arbeitsgebiet'(202). "Text nicht aus DTEL
      APPEND FIELDS.
      CALL FUNCTION 'POPUP_GET_VALUES'
           EXPORTING POPUP_TITLE     = POPUP_TITLE
           IMPORTING RETURNCODE      = RETURNCODE
           TABLES    FIELDS          = FIELDS.
      IF RETURNCODE = 'A'.
        If Cancel is clicked
      ELSE.
        If OK is clicked.
        Table FIELDS congtains the input data.
      ENDIF.
    Thank you
    Ramakrishna

  • How to create Button which size is calculated from its text ?

    I think JButton works like this: either in constructor or by setText() method the text is set and according the lenght, font and fontRendererContext preffered size is calculated before the layout manager ask for the prefferedSize for first time.
    I want to override paint() method because i want to draw my own text(and the only way i discovered how to force button not to paint text is to set text to
    null or empty String). I want the button to be as long as length of text plus insets.
    But layout manager ask for preffered size before paint method is invoked but i find out what size should be in paint method because i need graphics
    parameter to get FontRendererContext from it. So layout manager shrink button to minimum because first time the preffered size calculated from null or
    empty String is returned.
    public class MyButton extends JButton {
            public MyButton() {
                this.setText(null);  //or setText("");
                this.setContentAreaFilled(false);
                this.setFocusPainted(false);
                this.setBorderPainted(false);
                                                          ////already here i need to know what the size should be
            @Override
            public void paint(Graphics g) {
                Graphics2D g2 = (Graphics2D) g;
                TextLayout textLayout = new TextLayout("MyButton", this.getFont(), g2.getFontRenderContext());
                Rectangle2D boundsOfText = textLayout.getBounds();                                                                    /////////here i find out what size should be
                this.prefferedSize = new Dimension((int)boundsOfText.getWidth()+10,(int) boundsOfText.getHeight()+10);
                g2.setColor(Color.WHITE);
                g2.fillRoundRect(1, 1,(int)getPreferredSize().getWidth(),(int) getPreferredSize().getHeight(), 10, 10);
                g2.setColor(Color.BLACK);
                g2.drawRoundRect(1, 1,(int)getPreferredSize().getWidth(),(int)getPreferredSize().getHeight(), 10, 10);
                g2.drawString("MyButton", 7, (int)boundsOfText.getHeight() + 6);
                g2.dispose();
        }So how can i do that? How can JButton know prefferedSize before its paint method is invoked?

    The previous example was simplified.
    public class MyButton0 extends JButton {
        private String myText;
        public MyButton0(String text) {
            this.myText = "Button";
            //this.myText = text.toUpperCase();
            this.setFont(new Font("SansSerif", Font.PLAIN, 13));
            setContentAreaFilled(false);
            setBorderPainted(false);
            setFocusPainted(false);
        @Override
        public void paint(Graphics g) {
            Graphics2D g2 = (Graphics2D) g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            //backround painting
            GradientPaint background = new GradientPaint(0, 0, new Color(255, 255, 255), 0, getPreferredSize().height / 2, new Color(0, 0, 0), true);
            if(getModel().isRollover()){
                background = new GradientPaint(0, 0, new Color(255, 255, 255), getPreferredSize().width , getPreferredSize().height , new Color(0, 0, 0), true);
            if(getModel().isPressed()){
                background = new GradientPaint(0, 0, new Color(255, 255, 255), 0, getPreferredSize().height / 2, new Color(210, 210, 210), true);
            g2.setPaint(background);
            g2.fillRoundRect(1, 1, getPreferredSize().width - 3 , getPreferredSize().height - 3, 10, 10);
            //Border painting
            g2.setColor(new Color(255, 255, 255));
            g2.setStroke(new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.CAP_BUTT, 10.0f));
            g2.draw(new RoundRectangle2D.Double(1, 1, getPreferredSize().width - 3, getPreferredSize().height - 3, 10, 10));
            //text paiting
            g2.setFont(getFont());
            TextLayout tl = new TextLayout(this.myText, getFont(), g2.getFontRenderContext());
            int startPositionOfText = getPreferredSize().width - (int) tl.getBounds().getWidth();
            startPositionOfText = startPositionOfText / 2;
            g2.setColor(new Color(255, 255, 255));
            g2.drawString(this.myText, startPositionOfText -2, getHeight() / 2 + 5);
            g2.dispose();
        @Override
        public Dimension getPreferredSize() {
            return new Dimension(133, 31);
    }Assume text is so long as doesn't fit inside button. I have hard-set preffered size but i would like to calculate preffered size from text lenght.
    Or i need calculate startPosition of text to center it. But i don't want have preffered size hard-set.

  • How to keep both file when paste

    hi to  every one
    I would like to know how to keep both files have the same name when I copy one of them to the other folder , since I have tow options only : replace or skip !!!!!!!!!! in windows 8   

    I suspect that that's how it is supposed to be, Cyber_Defend_Team. However, I can confirm that in Windows 8.1, when I attempt to Copy and Paste files, like from my camera's SD card which starts it's numbering system at 0 each time, to my photo folder,
    I only have the following options:
    Replace the file in the destination
    Skip this file
    Compare info for both files
    Now, when I choose the Compare info for both files option, I get a secondary dialogue which shows me a thumbnail of both pictures and has a checkbox for each one in two columns (there is also a checkbox at the top of each column for multiple photos to select
    all in a given column). I'm given only two buttons on this screen, Continue and Cancel. 
    As such, Lany Zhang, I don't think that this question can be considered answered as it isn't. 

  • How to keep Industry sector and Material Type in Display for Tcode MM01

    How to keep Industry sector and Material Type in Display for Tcode MM01( create material Initial screen)
    Thanks,

    Hi
    Yes, your requirement is possible using screen variant
    1. use tcode SHD0
    2. give transaction as MM01
    3. goto screen variant tab - assign some name - enter program name and screen name
       (from mm01 - F1 help)
    4. goto transaction variant tab - assign some name - assign already defined screen variant name
    5. goto standad variant tab - transaction variant name already fetched automatically - click on active button (it was placed after transaction variant name
    Raju

  • How to keep track of what I've previously draw

    They said:
    Everytime the paint method is called, everything that was drawn before must be redrawn. The paint method has no way to keep track of what you've previously drawn, it is your responsibility as the programmer to keep track of such things.
    Is this right?
    How can keep track of my random shades of random amounts?
    Is there a simple way to do that?
    In a example, I must use getGraphics to get JPanel's graphics, then I use it to random draw something in the JPanel.
    I just want to keep them in my JPanel when it resizes.I haven't get the answer yet.
    Can you help me?

    Ok I haven't got time to write the code for you, but here's the idea:
    //User drags mouse around to draw on screen
    //use mouseActionListener to catch MouseDragged event
    int x = mouseEvent.getX();
    int y = mouseEvent.getY();
    Point p = new Point(x,y);
    arrayListOfPoints.add(p);
    // end mouse action capture
    //override paint method of component
    public void paint(Graphics g){
        super(g);
        Iterator it = arrayListOfPoints.iterator();
        while(it.hasNext()){
            Point p = (Point)it.next();
            g.drawLine(p.getX(),p.getY(),p.getX(),p.getY())   

  • How to keep track of last song played?

    Hi!
    Does anyone know how to keep track of which song played last time before itunes was closed? I have a big list of songs in my playlist and I play it everyday while I'm working. If I shut down my computer and start it again the next day, I have to manually look for the song I played the previous evening. Is there a way where it will keep track of the last song and play it from that?
    Thanks
    JB

    Subwaygirl, welcome to the Mac family! I'm not sure whether you're asking about beginning to play from the last song played on your iPod or iTunes so I'll answer both.
    From the iPod, simply hit Play and it will begin at the next song. It cannot go back to the last song played.
    From iTunes, use my answer to Chris to add the Last Played column, sort by that and select the song at the top of the list. That is your most recently played song. If you hit the >> or Next button you will then go to the next song in the randomly-sorted list.
    Powerbook G3 Mac OS X (10.3.9)

  • How to create New Work Center

    Dear Experts
                      How to create New Work Center?, what are all the inforamtions  need while creating workcenter.
    Regards
    Rajakarthik

    Hi,
    In addition to the above post, you need to identify that:
    1. Whether you need separate activity types and cost center for the newly created work center. These details are entered in the Costing View of the Work Center.
    If these are required then use KL01 to create new activity, KP26 to define the activity price.
    If required create cost element using T Code KA01 and Cost Center using KS01.
    Take help from the CO guy on this.
    2. Also  you need to ask the concerned about the operating times for the wor center. That is Start time and End time of WC. It is used for capacity evaluation and scheduling of the orders. It is maintained in the capacity view (Bottom left Button in the view).
    this view will also contain the details regarding the calendar, to be assigned to the work center, if needed. Collect details for this requirement. Also you can assign a different calendar to WC apart from factory calendar.
    3. Find out whether this WC will be operating in shifts or not. Accordingly maintain the details.
    Hope it is useful for you.
    Revert for clarifications
    Regards,
    Rohit.

  • How to Keep all the Portal report menu's are "open" when the user logs on?

    Hi
    I have a question about the BI Portalu2019s configuration.  Does anyone know how to keep the Web Portal (i-vew) report menu's are "open" when the user logs on?
    Thanks.
    For example:
    Web Report Panel
    Report  Folder A 
                  i-view  a1
                  i-view  a2
                  i-view  a3
                  i-view  a4
                  i-view  a5
                  i-view  a6
    Report  Folder B 
                  i-view  b1
                  i-view  b2
                  i-view  b3
                  i-view  b4
                  i-view  b5
                  i-view  b6

    Hi,
    Thank you very much.  The problem is the Folder didn't 'open when the user logs on.  Yes, the iview can be openned.  Does anyone know how to set the default Open for the Folder.  My question is about the folder in BI portal.  Yes, the ivew we can set the defaul Open but we have Folder in the portal and our user wants to be able to see the report lists when they log on to the Portal.
    For example:
    Our Current situation
        Navigation Panel
       .>Act vs Plan report Folder_
       .>Year to Day report Folder_
    Hope To Be (When user logs on the BI Portal)
       Navigation Panel
        .>Act vs. Plan report Folder
            (i-view) Report A
            (i-view) Report B
            (i-view) Report C
            (i-view) Report D
            (i-view) Report E
    .>Year to Day report Folder
           (i-view)  Budget by Cost Element report
           (i-view)  Actual by Cost Center report
           (i-view)  Income statement report
           (i-view)  Balance Sheet report

  • How to keep the waveform chart updated when changing states in state machine/

    Hello Everyone,
                           Can anyone please sugest me how to keep the waveform chart updated even if I am changing the states in a state machine??
    I am having analog inputs on the waveform chart...
    Thanks in advance...
    Now on LabVIEW 10.0 on Win7

    hello guys,
                    thanks a lot for the suggestions, here is the attached code... please follow the following steps to run it..
    ONce you hit play,press either Start Main/Cyl UP button on the front panel,
    once you start observing the waveforms, you can press the Cyl_Dwn button on the front panel... You can observe that the state changes to Start Counter state,
    and the waveform chart also stops updating... I would like both the waveform charts to conitnuously show the data even if the state is changed....
    Now on LabVIEW 10.0 on Win7
    Attachments:
    Soda Vending MAchine.vi ‏212 KB

Maybe you are looking for

  • Attachments in sales orders

    Hi thr, I have few sales order where attachment have been uploaded in service of object's attachment list which is existing in the title bar. However, when I execute txn VA05 and select the line item and do Environment > Display originals, it doesn't

  • Best way to implement ADE in a Corporate library

    Hi, I would like to set a policy for ebooks with DRM at my firm's library. I would like the purchased e-books to be accessible from a library's PC plus from the personal devices of a selected list of employees. My problem is that i would like to achi

  • ME21 upload problem

    Hi I have created a BDC for ME21( Purchase orders) when i am testing it for a  particular Order type = Frame work order We have the Validity start date(mandatory ) I have even put the condition that if the Order type is 'FO'the program needs to go in

  • Can you add exercise-type apps to the newest ipod nano?

    I had an app on my old iphone 3G called Trainer Lite which was similar to the Couch to 5K program/app and I want to be able to put that on my nano if I get one. The Nike+ app that comes on the nano is basically just a way to log your workouts but doe

  • Problem Upgrading Router Firmware on MI424WR-GEN3I

    Having trouble updating my router firmware.  Current version says:  40.21.18.  Status says: OK.  However, it says this below: " Internet Version:  Old Wireless Broadband Router version 40.21.10.3 found? Does this mean anything?  I'm wondering if the