What does "Dialog Management" mean?

New to Gambas? Post your questions here. No question is too silly or too simple.
Post Reply
User avatar
gambafeliz
Posts: 139
Joined: Friday 2nd September 2022 7:50pm
Location: I live in the same city as Picasso

What does "Dialog Management" mean?

Post by gambafeliz »

Hello, Merry Christmas everyone.

I am creating a new form and at the time of its creation, I get this dialog that I will add your image.
Capture
Capture
Captura de pantalla de 2022-12-25 11-33-46.png (15.51 KiB) Viewed 1607 times

What does "Dialog Management" mean?
And if it is interesting to me how I mark this option in a form that I created in the past but that does not mark this option?

Thank you and happy day.
For your misfortunes I am Spanish and I only know Spanish, please, be patient with me, Thank you. :)
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: What does "Dialog Management" mean?

Post by cogier »

I tried this and got a couple of buttons on the form (OK and Cancel) and the following code was already created.

Public Sub Run() As Boolean

  Return Not Me.ShowModal()

End

Public Sub btnOK_Click()

  Me.Close(True)

End

Public Sub btnCancel_Click()

  Me.Close

End
User avatar
gambafeliz
Posts: 139
Joined: Friday 2nd September 2022 7:50pm
Location: I live in the same city as Picasso

Re: What does "Dialog Management" mean?

Post by gambafeliz »

Aaah thank you :)
For your misfortunes I am Spanish and I only know Spanish, please, be patient with me, Thank you. :)
User avatar
BruceSteers
Posts: 1523
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: What does "Dialog Management" mean?

Post by BruceSteers »

cogier wrote: Sunday 25th December 2022 12:50pm I tried this and got a couple of buttons on the form (OK and Cancel) and the following code was already created.

Public Sub Run() As Boolean

  Return Not Me.ShowModal()

End

Public Sub btnOK_Click()

  Me.Close(True)

End

Public Sub btnCancel_Click()

  Me.Close

End
Yes it creates a Form with a Dialog template ready to go.

The default methods Cogier has shown there work like Dialog.OpenFile() in the way that the return is considered an error state so it returns false for an "okay" button press and true if the user presses Cancel. (always seems back to front to me but you can change it by switching the btnOk and btnCancel click event code)

But by default you can use the dialog form in your code like this...
(creating a Static variable in MyDialogWindow.class called StaticAnswerVar that get's filled when user presses okay in the dialog)


If MyDialogWindow.Run() Then
  Print "User cancelled Dialog"
Else
  Print "Result was " & MyDialogWindow.StaticAnswerVar
Endif



The form, of course, will also be a Modal window so unlike a normal form it will lock your application while it's open.
If at first you don't succeed , try doing something differently.
BruceS
User avatar
gambafeliz
Posts: 139
Joined: Friday 2nd September 2022 7:50pm
Location: I live in the same city as Picasso

Re: What does "Dialog Management" mean?

Post by gambafeliz »

Thank you BruceS

:shock:

It's interesting information.
For your misfortunes I am Spanish and I only know Spanish, please, be patient with me, Thank you. :)
Post Reply