DMsGuild Classic
  1. #1

    Can you increase all field widths when a window is made wider

    Evening,

    Been trying to work this one out.

    I have a window list, it's got:

    Name Protection KG Notes
    ____________ _________ ___ ________

    Now what I want when the window is made wider is to increase the width of each based on the new width
    Name Protection KG Notes
    __________________ __________ ____ __________

    And so on. So each field increases in proportion to each other.

    I can only find a way to increase one field, the name as the others are inline with it

    Cheers,
    MBM

  2. #2
    I guess you have to write a onSizeChanged function for the according windoinstances.

  3. #3
    Quote Originally Posted by Weltenbrand View Post
    I guess you have to write a onSizeChanged function for the according windoinstances.
    Awesome, I shall explore this today!

    Cheers,
    MBM

  4. #4
    I've got onSizeChanged being called. Is there a way to modify the size of a label at all?

  5. #5
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Newcastle, UK (for a bit)
    Posts
    27,799
    Quote Originally Posted by MadBeardMan View Post
    I've got onSizeChanged being called. Is there a way to modify the size of a label at all?
    Use the various setAnchor API commands. For example, setAnchoredWidth: https://fantasygroundsunity.atlassia...tAnchoredWidth

    Or do some calculations and use setStaticBounds. Here's an example I use in The Dark Eye extension to calculate the width based off a third of the width of the window:
    Code:
    <script>
    	function onInit()
    		self.onSizeChanged = resizeFrames;
    	end
    	
    	function resizeFrames(sourceWindow)
    		local nWidth,_ = getSize();
    		cas2.setStaticBounds((nWidth/3), 215, (nWidth/3)-15, 250)				
    	end
    </script>
    You can also look at using calculations with the original relative anchoring in the base XML - for example, <left> parent="" anchor="center" offset="-10"</left> will anchor an the left side of a control to 10 pixels from the center of the window. As you appear to have 4 controls, you may be able the anchor the right side of the second, and the left side of the third control to the center of the window, and adjust the right side of the first/left side of the second and right of the the third/left side of the fourth control using code.
    FG Con 16 Fantasy Grounds Online RPG Convention - Postponed New date To Be Confirmed.
    Register at www.fg-con.com for all the latest info.

    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  6. #6
    Hi Chap,

    It would be better to be able to say 'this label is 50% of the width, this label is 15%, this label is 20% and this label is 15%'

    I tried the setStaticBounds and the label just vanishes.

    Is there any example anywhere where a windowlist column is resized and the labels are fixed above?

    Cheers,
    MBM

  7. #7
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Newcastle, UK (for a bit)
    Posts
    27,799
    Quote Originally Posted by MadBeardMan View Post
    Is there any example anywhere where a windowlist column is resized and the labels are fixed above?
    As column labels are essentially independent of the actual windowlist, the sizing/positioning of the labels has to be handled separately. You can use similar code to what I referred to above for each of the windowlist column labels and the fields within the windowlist, but you can't just say a label outside of a windowlist is positioned above a field within the windowlist.
    FG Con 16 Fantasy Grounds Online RPG Convention - Postponed New date To Be Confirmed.
    Register at www.fg-con.com for all the latest info.

    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

Thread Information

Users Browsing this Thread

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
FG Spreadshirt Swag

Log in

Log in