Thread: Modal popups?

  1. #1

    Modal popups?

    I saw some of my code duplicated, what I thought was sloppy until after I moved it I saw odd behavior.

    I realized it was because I had the same cleanup code duplicated at the end the "handler" method for attemptToMultiClass and attemptToDualClass methods instead of where I would logically put it after it checks if first class, multi or dual then falls through to the cleanup.

    This does not work because I call "Interface.openwindow()" to present the user with a "are you sure" option (but it may be more than that in future, so don't assume a yes/no is sufficient for the popup) and the code falls through to the cleanup before the new window is closed and therefore the settings made in the window haven't yet been made.

    I got around this by making sure I did nothing after the openWindow calls and handled all "post window" code in the window handlers. No problems. Just wondered if I missed a way to call a window "modally" where it interrupts all until you clicked a choice and returns to caller?

  2. #2
    The only thing im aware of that is remotely like that is this.

    http://www.fantasygrounds.com/refdoc...#dialogMessage

    I've tried it but decided against it because it's pretty crude.
    ---
    Coding the Official AD&D Ruleset
    My Twitch Channel for AD&D and FG related streams (See schedule for live days)
    My YouTube for FG related Tutorials and AD&D Actual Plays

  3. #3

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,000
    And it jars you right out of the suspension of disbelief with a very harsh and sparse windowy dialog box. It blows super big chunks. Not that I have any feelings about the subject....

  4. #4
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Denver, Colorado, USA (for a bit)
    Posts
    23,629
    And then if the user doesn't click it for a while their instance of FG lags way behind in processing messages/code etc. and you're a bit screwed.

    FG Con 15 – Fantasy Grounds Online RPG Convention - Nov. 8-10, 2019
    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

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,000
    Just happy bitching, Trenloe.

    Without multi-threading, a modal window is, as you point out, a real problem.

  6. #6
    Quote Originally Posted by celestian View Post
    The only thing im aware of that is remotely like that is this.

    http://www.fantasygrounds.com/refdoc...#dialogMessage

    I've tried it but decided against it because it's pretty crude.

    Yeah, that yes/no/cancel option was only one I saw.

    Like said, I made due by copying the 4 calls I needed at end to each of the 3 possible paths since 2 of them required input from the user. Works fine enough, just wanted to make sure I didn’t miss another paradigm.

  7. #7
    Quote Originally Posted by Trenloe View Post
    And then if the user doesn't click it for a while their instance of FG lags way behind in processing messages/code etc. and you're a bit screwed.
    Yeah, in my worlds, the method that calls this pop up would be suspended until the pop up returned but due to the magic of threading and synchronization background processing and message handling could go on.

    But I get what you mean, it’s one reason I moved the code into the window handler instead.

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
  •  

Log in

Log in