MsgBox and MessageDIalog Problems

  1. last week

    Arthur G

    Dec 5 Pre-Release Testers
    Edited last week

    I am having a problem with msgbox and messageDialog.
    They both require unusual conditions to operate.

    If I run a MsgBox from within a module with buttons of any kind, it automatically sets it to the affirmative.
    So if you set code like this

    Dim i As Integer = MsgBox("Place this on the window", 36)

    You will automatically get 6

    The other problem I have is MessageDialog
    In that same location and have it set to only

          b = d.ShowModal                             // Code taken from the LR
          

    Then the dialog doesn't show literally. It should show but it doesn't.

    If I put in ShowModalWithin, that doesn't work,
    unless I pass the window WITHIN as part of the call.

    so I need
    d.ShowModaWithin(self)
    Here is an example of what should work.
    Example Project

    If I have a method in a module that is several windows deep, I need to still pass a window to it, or it doesn't work.

    To me, this is not what should be happening.
    Am I missing something?

    Ok, so your example should work (and it works), but the same code will not work on your app.

    If you can't make an example (that won't work and mimic your issues) for Xojo to take a look you may need to send your app (privately) for them to look at it.

  2. Alberto D

    Dec 5 Pre-Release Testers, Xojo Pro

    Are you using Windows, Mac or Linux?

    Your example project works ok on macOS 10.12.6. I even changed to b = d.ShowModal and it works.

    Maybe I don't understand the issue.

  3. Julian S

    Dec 5 Pre-Release Testers, Xojo Pro UK

    I couldn't replicate your issues but personally I wouldn't open modal message boxes/windows during an Open event of a window as it can cause all sorts of race/messaging issues.

    Try this in Window1.Open:

    Xojo.Core.Timer.CallLater(0, AddressOf Module1.Stuff)

    This will make sure that Stuff is called after Open has completed and all the messages associated with opening the window have been processed.

    Have a read up on Xojo.Core.Timer.CallLater, it's very handy, you can also pass arguments along with it if needed.

  4. Alberto D

    Dec 5 Pre-Release Testers, Xojo Pro

    Just for information:

    b = d.ShowModal

    will show the MessageDialog on the center of your screen, it could be outside your window

    b = d.ShowModaWithin(self)

    will show as a "drop down" on the top-middle of your window.

  5. Arthur G

    Dec 5 Pre-Release Testers

    I think I only have the issue on Mac and it has been several years.
    About using that in open - I forgot about racing. I forgot for the example.
    About the example. It will work. If I put the same code in my app then it won't.
    I should not have to put in
    Showmodalwithin(self) to make it work. It is also diffificult passing a window to a module.

  6. Alberto D

    Dec 5 Pre-Release Testers, Xojo Pro Answer

    Ok, so your example should work (and it works), but the same code will not work on your app.

    If you can't make an example (that won't work and mimic your issues) for Xojo to take a look you may need to send your app (privately) for them to look at it.

  7. Dave S

    Dec 5 San Diego, California USA

    If you open a modal dialog in the OPEN event of a window, it could cause that event (or at least the Activate to fire again, as you removed focus from the window to show the dialog).... and if done during the CLOSE event, the window may not truly close (it might hide, but stay instantiated)

  8. Arthur G

    Dec 5 Pre-Release Testers

    @Dave S it could cause that event (or at least the Activate to fire again, as you removed focus from the window to show the dialog)

    I know about that one too, :-(
    Thanks for confirming what I did. I haven't resolved it yet, but it's more clear.

    Thanks for letting me vent my grumbles. It helps me believe I can get a resolution.

or Sign Up to reply!