FG Spreadshirt Swag
  1. #1

    Help with horizontal auto-sizing of controls

    I want to have four stringcontrol's arranged on the same line, and have their width autosize to fill the available horizontal space when the containing windowinstance is resized. I tried messing around with the onSizeChanged event a little last night with no success. Can someone point me to some examples of something similar I can look at before I start asking dumb questions? Thanks.

  2. #2
    There are not a lot of examples of this, since the logic is more complex. I tend to not implement multiple auto-sizing fields on a line, or use static widths and base off a center anchor (many examples of this in the built-in rulesets code).

    The onSizeChanged event is the one that you would be using. Then, you would need to use window.getSize(); and set the individual field left/right anchors at the 0/25/50/75/100 marks as appropriate.

    Regards,
    JPG

  3. #3
    Ok, I was on the right track then, thanks.

  4. #4
    WindowControl.setStaticBounds is the appropriate function for this? I think I was trying to use one of the setAnchoredxxx functions, maybe that was my problem.

  5. #5
    Using setStaticBounds is probably the easiest solution.

    The other option (if you wanted to do more complex stuff, or had multiple lines doing the same thing) would be to create generic anchor controls whose position got set using setStaticBounds; then have the string fields use the horizontal anchor controls as anchor points.

    Regards,
    JPG

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
DICE PACKS BUNDLE

Log in

Log in