Skip to content

Synchronous Method for Showing MessageDialog #4792

Open

Description

@ndianabasi

Is your feature request related to a problem? Please describe.

Currently, a message dialog usage looks like the code below where the callback per button are asynchronous.

        app.Dialog.Question().
            SetTitle("Migration Warning").
            SetMessage(fmt.Sprintf("%d migrations are available. Do you want to run them now?", len(pending))).
            SetDefaultButton(&application.Button{
                Label: "Run",
                IsCancel: false,
                IsDefault: true,
                Callback: func() {
                    doMigrations()
                },
            }).
            SetCancelButton(&application.Button{
                Label: "Cancel",
                IsCancel: true,
                IsDefault: false,
                Callback: func() {
                    log.Println("Migration cancelled by user.")
                },
            }).
            Show()    

The challenge with this pattern is that, there is no way of returning error or result from each callback function synchronously so that the application can take critical decisions such as exiting the application if a critical request was rejected by the user.

Describe the solution you'd like

I am suggesting a new synchronous method like ShowSync which returns the error and result from either callback function assigned to the buttons.

If feasible, we could also introduce generics so that the result returned from the cancel or default buttons are type safe.

Describe alternatives you've considered

The current implementation in v3 is asynchronous. The v2 implementation was synchronous and similar to the above request. However, the callbacks will be called to return result or error instead simply returning the button labels as the result.

Additional context

No response

Activity

  1. added
    Enhancement
    on Dec 14, 2025
  2. leaanthony commented on Dec 14, 2025

    @leaanthony
    Member

    Do you think returning a result and error might be too far for the callback? The idea is just a shortcut for when the button is clicked. If we add error and results then it gets a bit nested. Would returning the label be sufficient and you don't bother using the Callback, just switch on the value?

  3. ndianabasi commented on Dec 14, 2025

    @ndianabasi
    ContributorAuthor

    If we add error and results then it gets a bit nested. Would returning the label be sufficient and you don't bother using the Callback, just switch on the value?

    Simply returning the label is totally sufficient. That's basically how it worked in v2. Thank you.

  4. added 2 commits that reference this issue on Dec 17, 2025
    5e39aed
    3d1c650
  5. leaanthony commented on Dec 17, 2025

    @leaanthony
    Member

    @ndianabasi - Please try the linked PR 👍

  6. ndianabasi commented on Dec 18, 2025

    @ndianabasi
    ContributorAuthor

    @ndianabasi - Please try the linked PR 👍

    I've submitted some comments on the PR @leaanthony. Thank you for your efforts.

  7. moved this to Backlog in v3 Backlogon Feb 1, 2026
  8. github-actions commented on Aug 3, 2026

    @github-actions
    Contributor

    This issue has been automatically marked as stale because it has not had recent activity.
    It will be closed if no further activity occurs within the next 10 days.

    If this issue is still relevant, please add a comment to keep it open.
    Thank you for your contributions.

  9. added
    stale
    on Aug 3, 2026
  10. added this to the v3.1.0 milestone on Oct 13, 2026
  11. taliesin-ai commented on Oct 15, 2026

    @taliesin-ai
    Collaborator

    Hi there! Could you share your full Wails version, operating system, and a small example that reproduces the problem? It would also help to know what you expected to happen and what happened instead. Thanks!

  12. modified the milestones: v3.1.0, Future on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementLinuxMacOSP2Windowsstalev3

    Type

    No type

    Projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions