1. #1
    Tommycore's Avatar
    Join Date
    Feb 2020
    Location
    Apocalyptic Utopia
    Posts
    48

    How do I get the applications window size (in pixel)?

    Hey all!

    I'd like to make a window that stretches over the complete screen, horizontally. I got it to where I can open my window, fix it to the top left by code, and resize it manually and/or via code. So far so good, but what I can't find, neither in the forums, nor the refdoc (which, btw., could use a search function, for us lazy people ^^), nor the dev guide, is how to find out the current resolution of the Fantasy Grounds window. I'm not talking about my own window, I mean the complete application window.

    I need something like Screen.width in the Unity Engine.

    I've been looking for the sidebar in CoreRPG, which scales horizontal, but I didn't find out how it does that.

  2. #2
    LordEntrails's Avatar
    Join Date
    May 2015
    Location
    -7 UTC
    Posts
    10,640
    Blog Entries
    9
    Don't know. But the map resize to background/full does what you want right? So perhaps you can find it in there?

    As for RefDoc search, use a Google Search with the site specified?

  3. #3
    Tommycore's Avatar
    Join Date
    Feb 2020
    Location
    Apocalyptic Utopia
    Posts
    48
    Quote Originally Posted by LordEntrails View Post
    Don't know. But the map resize to background/full does what you want right? So perhaps you can find it in there?
    I'll look into it. Thank you =)

    Quote Originally Posted by LordEntrails View Post
    As for RefDoc search, use a Google Search with the site specified?
    That's why I said "us lazy people"

  4. #4
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Newcastle, UK (for a bit)
    Posts
    26,072
    Or, to search the Wiki. From the new Wiki page (accessing from the Help menu at the top of the page) click the magnifying glass in the top left.

    Then search for getsize maybe? And select the result for windowinstance
    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!

  5. #5
    Tommycore's Avatar
    Join Date
    Feb 2020
    Location
    Apocalyptic Utopia
    Posts
    48
    Got it. You basically put a panel stretching over your whole screen on the desktop, and put an empty class in there, which doesn't do any size or position control on itself. Make sure your panel has the <disabled /> tag, so it doesn't interfere with the rest of the interface.
    Code:
    <root>
        <windowclass name="dev_console">
            <frame>default_framed</frame>
            <nomove />
    		<placement>
    			<size width="150" height="100" />
    			<nosave />
    		</placement>
    		<sizelimits>
    			<minimum width="100" height="25" />
    			<maximum width="10000" height="500" />
    			<dynamic />
    		</sizelimits>
            <sizelimits>
                <dynamic>
                    <resize>both</resize>
                </dynamic>
            </sizelimits>
        </windowclass>
    
        <windowclass name="empty">
        </windowclass>
    
    	<panel name="desktopfullpanel" modes="host,client">
    		<anchored>
    			<left /> 
    			<top />
    			<right />
    			<bottom />
    		</anchored>
    		<class>empty</class>
    		<disabled />
    	</panel>
    </root>
    Second, you need a Lua script that hangs onto the onDesktopInit function and sets the size:
    Code:
    function onInit()
        local dc =Interface.openWindow("dev_console", "");
        Interface.onDesktopInit = onDesktopInit;
    end
    
    function onDesktopInit ()
        local devCon = Interface.findWindow("dev_console", "");
        local empty = Interface.findWindow("empty", "");
        devCon.setPosition(0,0);
        devCon.setSize(empty.getSize (),25);
    end
    Very basic, and somewhat ugly as far as solutions go, but it works. If you want to I can clean it up, and pack it into an extension. Though, if you devs are reading - I don't know your codebase, I'm a developer myself, I hate such assumptions as well, but... shouldn't that be quite quick and easy to implement? Just another function for the Interface class.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
MOOT PRE

Log in

Log in