5E Product Walkthrough Playlist
Page 2 of 3 First 123 Last
  1. #11

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    Thanks, KenL for posting solution.

  2. #12

    Custom Link Ext

    Okay, so I finally have time to type this up. Making your own button is a good solution overall, but it doesn’t address the issue of not being able to control the links (windowreferencecontrols) in the formattedtextcontrols. I unfortunately use a lot of these so I tried to come up with a way to do some, preferably lua script, when a link was clicked. Ultimately it is impossible with the way things are normally done, since the link only opens a new window of a certain class and fills it with data from a certain database node. But then I took a step back and looked at what I had available and what I was trying to do. I found that I could accomplish what I was wanting if I just stopping assuming one simple thing.

    Why does the link have to contain the window we want to open? It doesn’t. We can put any window in the link, as long as we end up with the window we want opened...

    Looking at the windowreferencecontrols, they contain two pieces of data: a class for a windowclass, and a string. The string is usually used to point to a place in the database to grab data, but it doesn’t need to be. The string can be used for anything or passed along to another window.

    So I made a set of classes called custom links. I have included two of them in this extension. The classes are invisible windows that fire an onInit() lua script block, which allows us to do anything we want. These move themselves to the bottom right corner of the screen and open the desired window, resizing and positioning to where I personally place them in the layout I use when DMing. But you can do anything that can be done in a lua script block. You can even pass data to the script through the recordname with self.getDatabaseNode().

    There is a caveat though. The window can’t be closed from the onInit() or it will crash FG. Currently I have it covering the Library button, since I rarely use that during the game. But to get rid of the window, I set up a garbage collection system using a script manager GarbageCan. At the end of the script block in the custom link window, I send it to the garbage can. I then overwrite the template for all close buttons to empty the garbage can so that as soon as you close something, the custom windows will disappear.

    I rarely ever have an issue with the windows being in the way as I close things frequently and rarely access the Library, but in the one instance it happened, I just right clicked the ‘Library button’ (actually the invisible custom link window) and closed it.

    Hope this different way of thinking about windowreferencecontrols helps some of you. It was going to be included in an extension I was working on, but that is getting increasingly delayed.
    Attached Files Attached Files
    I never claimed to be sane. Besides, it's more fun this way.

  3. #13
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,684
    Blog Entries
    1
    Hi Nickademus is it possible to position so that only 1px or 1 column of pixels is on the visible desktop?
    Or even off the visible desktop?

  4. #14
    The position I set is literally off my screen. FG caps the movement to around 100 pixels from the edge I think. I figure if I were to design a ruleset, I'd just put a logo or something down there that doesn't need to be clicked on.
    I never claimed to be sane. Besides, it's more fun this way.

  5. #15
    I forgot to mention, in order for the links in a formattedtextcontrol to work like this, you have to manually set their class to the windowclass of a custom link window. This can be done through lua code, by setting the value in a dragdata object. I simply drag normal links into the text, close FG, open the xml of the db file or modules file and manually change the class to the type of custom link I want.
    I never claimed to be sane. Besides, it's more fun this way.

  6. #16

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    Now, if we could just sweet talk MW into changing onInit so that if you return a string value of "Close" or something like that that the engine aborts the window opening, then this would be the cliche-d cat's meow. (can't use false because it wouldn't be compatible with any other onInit out there). That way, you could fire the onInit of the window you really want and have the fake window abort itself once everything returned.

    Oh, and just like to complement you on the ingenuity of this....

    Gotta think on my own uses cases too....

  7. #17
    Thanks. I use it for quite a few things. One of the most prominent is for opening a reference manual and 'turning' to the appropriate page.

    Come to think of it, you don't have to have the fake window open any new window. So you can uses links embedded in formatted text as raw buttons. Click and something happens.
    I never claimed to be sane. Besides, it's more fun this way.

  8. #18

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    Right. I am just trying to figure out use cases where you don't want to just use a button other than the one you describe. One thing you might consider on the reference manual page is remembering the scroll position within the page so a link would not only take you to the proper page but where you want to be on that page.

    With this, a DM or player(?) could build a note with 'Stuff I forget all the time' that links to rules he wants to be able to get to quickly.

    [OR] you could have a bookmarks extension that would let you record bookmarks in any reference (where was I when I was reading that module dang it?)

  9. #19
    @Nick, correct me if I'm wrong, but can't you just modify my example to handle onDragStart type events? The only thing would be that your target would be expecting a windowreferencecontrol as opposed to the alien object acting like one, but you can work some black magic with onDragEnd as that gets fired before the onDrop handler of the destination.

  10. #20
    I don't entirely understand what you are talking about. You gave code for a new button that opens a window. The formatted text automatically creates a windowreferencecontrol inside the text when something it recognizes as a link is drug onto it. I don't see a way to get your control inside the formatted text.
    I never claimed to be sane. Besides, it's more fun this way.

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