Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9302891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T23:21:30+00:00 2026-06-18T23:21:30+00:00

I have an Image in a grid that scales when the PartView is resized.

  • 0

I have an Image in a grid that scales when the PartView is resized. If the BarsView starts smaller than 64 high (the size of the canvas), the bottom portion of the image gets cut off below the initial size. If it starts larger than what it is resized to, the minivitals does not shrink as it should. How can I the layout, when resized, to look like it does when I open the program at that size?

Screenshot of when the program is opened at normal size:

Normal size to start

Shrunk after opening at normal size (notice the concentration bar is pushed off the bottom of the screen):

enter image description here

Opened at smaller size:

enter image description here

Opened at smaller size then expanded:

enter image description here

Restarting between resizing has the desired effect, except for the needing to restart part.

public class BarsView extends ViewPart {
    private PageBook book;
    public void createPartControl(Composite parent) {   
        book = new PageBook(parent, SWT.NONE);
        book.setLayout(new FillLayout());
        Composite page = new BarsPageView(book, view);
        book.showPage(page);
    }
    private class BarsPageView extends Composite {
        public BarsPageView(Composite parent, GameView view) {
        super(parent, SWT.NONE);
        this.setLayout(new GridLayout(3, false));

        // This is a wrapper around a StyledText
        entry = new StormFrontEntry(this, view);
        GridData entryData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
        entryData.heightHint = 22;
        entry.getWidget().setLayoutData(entryData); // getWidget() returns the StyledText

        // This is a Composite containing a Canvas
        status = new StormFrontStatus(this, view);
        status.setLayoutData(new GridData(SWT.CENTER, SWT.BEGINNING, false, false));

        // This is defined below                
        GridData compassData = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 2);
        compassData.heightHint = 64;
        compass = new WarlockCompass(this, SWT.NONE, theme, compassData);
        compass.setLayoutData(compassData);

        minivitals = new StormFrontDialogControl(this, SWT.NONE);
        GridData mvData = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
        minivitals.setLayoutData(mvData);
    }
}

public class WarlockCompass extends Canvas {
    public WarlockCompass (final Composite parent, int style, CompassTheme theme, GridData layoutData) {
        super(parent, style);
        addPaintListener(new PaintListener() {
            public void paintControl(PaintEvent e) {
                drawCompass(e.gc);
            }
        });
        parent.addListener(SWT.Resize, new Listener() {
            @Override
            public void handleEvent(Event event) {
                // I cut out the calculations for this
                layoutData.heightHint = height;
                WarlockCompass.this.setSize(width, height);
            }
        });
    }
    private void drawCompass (GC gc) {
        // Cut out the calculations to scale the image to fix the canvas
        gc.drawImage(scaledImage, 0, 0);
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T23:21:31+00:00Added an answer on June 18, 2026 at 11:21 pm
        // This is defined below                
        GridData compassData = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 2);
        compassData.heightHint = 64;
        compass = new WarlockCompass(this, SWT.NONE, theme, compassData);
        compass.setLayoutData(compassData);
    

    Should have been:

        // This is defined below                
        GridData compassData = new GridData(SWT.CENTER, SWT.CENTER, false, true, 1, 2);
        compassData.heightHint = 64;
        compass = new WarlockCompass(this, SWT.NONE, theme, compassData);
        compass.setLayoutData(compassData);
    

    Changing that flag makes it resize properly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a grid/canvas that has an element (say an icon with an image
I currently have a grid of images that scales appropriately depending on the size
I have simple Grid with Image named TestImage and I need pass that Grid
I have an image that has grid lines on it and would like to
I have a grid that contains several smaller images that are overlayed by a
I have about 12-15 images that I want to align together in a grid,
I have grid with some textboxes and an image which goes out of grid
I have a Grid which contains an Image in one of its columns. The
I have grid of images, when the mouse is over any given image a
I have something like this in my xaml: <Grid> <Image Name=image Source=../../Images/DefaultImage.png HorizontalAlignment=Stretch VerticalAlignment=Stretch></Image>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.