STAR TREK 2d20
Page 1 of 2 12 Last
  1. #1

    A question about windowclasses

    If I were to write my own windowclass, I'm confused as to how I would get at the data I'm passing to it. For example, I'm trying to modify an extension that has a call to an (apparently) pre-defined window class that is instantiated with the call Interface.openWindow(url, "urlString")
    I've read up some on window classes and it seems you can have one either bound to DB nodes or unbound. In the above case, it looks as though the windowclass is unbound as it's not being passed a node upon creation. I'm curious as to how, in the definition of the url windowclass, it can access the value urlString. I see there's a bunch of available calls within the famework of a windowinstance (bringToFront, close, createControl, onInit, etc), but I can't figure out how to get at the data that's been passed in with the instantiation of the window. Ultimately I just want to write a slightly different version of the url windowclass to open urls in a headless browser via lua executing command line bash but I don't see how to get at the value of urlString from within the windowinstance.

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,402
    Interface.openWindow is defined here: https://fantasygroundsunity.atlassia...ace#openWindow - i.e. openWindow(windowclass, datasource)

    As mentioned in that API document, datasource is the name of the database node that the window will be built on. You can use <windowinstance>.getDatabaseNode to return the FG database node object referring to that DB node: https://fantasygroundsunity.atlassia...etDatabaseNode It'll be nil if the window instance doesn't have a data source.
    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!

  3. #3
    Ah so the ONLY way to pass data along to a windowinstance is via a DB node? Unbound windowinstances can never have data passed to them?

  4. #4
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,402
    Quote Originally Posted by daddyogreman View Post
    Unbound windowinstances can never have data passed to them?
    You'll have to build the data in the unbound window during or after window initiation, using the windowinstance onInit function, or the onInit function of the controls in the window, or some external <windowinstance>.<LUA function> call.
    Last edited by Trenloe; January 20th, 2021 at 19:55.
    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
    To clarify, I was under the impression the code I was looking at was instantiating a window instance (of windowclass url) with a simple string of a URL (SURL) with an auth token tacked onto the end. It sounds as though my impression was incorrect here and it's actually passing a database node that I haven't spotted yet where it's being loaded into that variable? That my impression of a window instance being passed a simple string is impossible?

  6. #6
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,402
    Ah, sorry - I thought you were using "url" as a general terminology and not specifically the open external browser window functionality.

    All that does is use the preferred operating system browser to open a URL. That URL has to be a valid website, or valid local file, or other valid URL registration on the computer. The call is a one shot call with nothing FG code can do after the call is sent - the browser is external to FG and FG code can't interact with it. That's why you asking about accessing the browser window confused me.
    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!

  7. #7
    If I wanted to override that one shot call to open a browser headlessly via the command line, would that be possible?
    Right now it works just fine - it opens the URL in a browser. The problem is the browser is taking focus from Fantasy Grounds and opening a tab to play the sound. Which is annoying in both that I have to flip back to Fantasy grounds every time and when I'm done, I'll have a ton of open tabs to various urls I'll have to close. I was just hoping to override that functionality to call a headless browser which will deal with both the focus and crazy number of tabs issue.

  8. #8
    Or another approach - would it be possible to code up a new windowclass that can make a call to the operating system to accomplish what I want via lua? I'm extremely new to all of this - including lua.

  9. #9
    Also what does the code for the URL windowclass Look like?
    How is it accessing the value of the string being passed to it if it isn't loading up a db node?

  10. #10
    The coding is very limited when it comes to calling the operating system with ruleset code. This is for security reasons and protection for others and yourself.
    Dominic Morta
    Ruleset Developer
    Smiteworks

    How to zip up your campaign if the Developers ask for it-How to zip up your campaign if the Developers ask for it

    How to provide an Unity Connection issue?-Connection Issues and What to Provide

    Unity Updater issue?-Updater Issues

    Classic and Unity Port Forwarding?-Fantasy Grounds Connections Explained

    Comcast or Cox ISP User?-Comcast XFinity and Cox Users

    Have a suggestion?-Feature Request

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
  •  
5E Product Walkthrough Playlist

Log in

Log in