Forget about question 3.
On RB2006 I created a DialogResult Enum and it works fine. A good
solution but I'll have to wait for 2006r2 due to some bugs.
On RB2005 the solution was to created instead a module with protected
constants and it works also fine.
Carlos
> I need some advice about using modal dialog windows.
>
> What I'm trying to do is to not process any info on the dialog box
> regarding insert/edit/delete records on a DB, but on the
> main window -
> the dialog will check only if values entered are ok, set the
> appropriate ButtonPushed value and then let the main window process
> everything.
>
> So, here's an example of what I have:
>
> A "ButtonsPushed" module with the following constants:
> OK = 1
> Cancel = 2
> Yes = 3
> No = 4
> Save = 5
> DontSave = 6
>
> The modal window "winDialog" has the following:
>
> Public Property ButtonPushed As Integer
>
> Sub Display(t As String)
> Title = t
> // Show Window
> ShowModal
> End Sub
>
> On PushButtonOK Action Event:
> // do stuff to check values entered
> // If everything ok
> ButtonPushed = OK
> Hide
>
> On PushButtonCancel Action Event:
> ButtonPushed = Cancel
> Hide
>
> On Windows' CancelClose Event:
> // In case user clicks the close "X"
> If Not appQuitting Then
> ButtonPushed = Cancel
> Hide
> Return True
> End If
>
> Then on main window I use the following to call the modal window:
>
> Sub SomeMethod()
>
> Dim aDialog As New winDialog
> aDialog.Display("This is the title")
>
> Select Case SEDialog.ButtonPushed
> Case Cancel
> // user cancelled/closed
> Case OK
> // get dialog field values and do stuff
> End Select
>
> End Sub
>
> Questions:
> 1. Is the above a correct approach on using modal windows
> in order to
> the main window get the dialog's field values to do all the process
> (like inserting, editing, deleting records on a DB)?
>
> 2. Is it necessary the check I'm making on the dialog's CancelClose
> event for the appQuitting? Or that's not necessary because
> the dialog
> window gets destroyed once it exits the SomeMethod?
>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>