MDI QueryUnloads
-
Okay, I have an mdi application that I want to close (by pressing the go away button) it has one child form open, which contains dirty data. Due to the nature of "WetWare" (users) issues I display a dialog that says "You have dirty data did you really mean to save it, or would you like to abandon your changes?" This is done in the queryUnload of the mdi child. If the user choose to saves we get stuck in an infinate queryunload event loop. Private Sub Form_QueryUnload(cancel As Integer, _ UnloadMode As Integer) writelog "Query Unload" Debug.Print "hwnd:= " & Me.hwnd cancel = Not (CheckSave()) end sub Private Function CheckSave() As Boolean ''False I was unable to save something, ''or the user canceled ''true life is good. I am successful and or compleate if not dirty then ... New form ... show form ... unload form ... set form = nothing end if end function Am I missing something or should this work? What kind of restrictions is there in the queryUnload event. None of the ms documentation mentioned that form creation is a bad idea :-) Any sugesstions would be appricated .
-
Okay, I have an mdi application that I want to close (by pressing the go away button) it has one child form open, which contains dirty data. Due to the nature of "WetWare" (users) issues I display a dialog that says "You have dirty data did you really mean to save it, or would you like to abandon your changes?" This is done in the queryUnload of the mdi child. If the user choose to saves we get stuck in an infinate queryunload event loop. Private Sub Form_QueryUnload(cancel As Integer, _ UnloadMode As Integer) writelog "Query Unload" Debug.Print "hwnd:= " & Me.hwnd cancel = Not (CheckSave()) end sub Private Function CheckSave() As Boolean ''False I was unable to save something, ''or the user canceled ''true life is good. I am successful and or compleate if not dirty then ... New form ... show form ... unload form ... set form = nothing end if end function Am I missing something or should this work? What kind of restrictions is there in the queryUnload event. None of the ms documentation mentioned that form creation is a bad idea :-) Any sugesstions would be appricated .
-
Okay, I have an mdi application that I want to close (by pressing the go away button) it has one child form open, which contains dirty data. Due to the nature of "WetWare" (users) issues I display a dialog that says "You have dirty data did you really mean to save it, or would you like to abandon your changes?" This is done in the queryUnload of the mdi child. If the user choose to saves we get stuck in an infinate queryunload event loop. Private Sub Form_QueryUnload(cancel As Integer, _ UnloadMode As Integer) writelog "Query Unload" Debug.Print "hwnd:= " & Me.hwnd cancel = Not (CheckSave()) end sub Private Function CheckSave() As Boolean ''False I was unable to save something, ''or the user canceled ''true life is good. I am successful and or compleate if not dirty then ... New form ... show form ... unload form ... set form = nothing end if end function Am I missing something or should this work? What kind of restrictions is there in the queryUnload event. None of the ms documentation mentioned that form creation is a bad idea :-) Any sugesstions would be appricated .
Check at at wich kind of UnloadMode you wan't to prompt the user and only then set cancel to one '1'.
Private Sub Form_QueryUnload(cancel As Integer, _ UnloadMode As Integer) writelog "Query Unload" Debug.Print "hwnd:= " & Me.hwnd If CheckSave()) Then cancel = 1 '<<< end sub
Should do -
Okay, I have an mdi application that I want to close (by pressing the go away button) it has one child form open, which contains dirty data. Due to the nature of "WetWare" (users) issues I display a dialog that says "You have dirty data did you really mean to save it, or would you like to abandon your changes?" This is done in the queryUnload of the mdi child. If the user choose to saves we get stuck in an infinate queryunload event loop. Private Sub Form_QueryUnload(cancel As Integer, _ UnloadMode As Integer) writelog "Query Unload" Debug.Print "hwnd:= " & Me.hwnd cancel = Not (CheckSave()) end sub Private Function CheckSave() As Boolean ''False I was unable to save something, ''or the user canceled ''true life is good. I am successful and or compleate if not dirty then ... New form ... show form ... unload form ... set form = nothing end if end function Am I missing something or should this work? What kind of restrictions is there in the queryUnload event. None of the ms documentation mentioned that form creation is a bad idea :-) Any sugesstions would be appricated .
The regulars must be asleep, else at least your hair would be badly singed by now!:laugh: "Knock, knock." "Who's there?" "Recursion." "Recursion who?" "Knock, knock..."
-
Okay, I have an mdi application that I want to close (by pressing the go away button) it has one child form open, which contains dirty data. Due to the nature of "WetWare" (users) issues I display a dialog that says "You have dirty data did you really mean to save it, or would you like to abandon your changes?" This is done in the queryUnload of the mdi child. If the user choose to saves we get stuck in an infinate queryunload event loop. Private Sub Form_QueryUnload(cancel As Integer, _ UnloadMode As Integer) writelog "Query Unload" Debug.Print "hwnd:= " & Me.hwnd cancel = Not (CheckSave()) end sub Private Function CheckSave() As Boolean ''False I was unable to save something, ''or the user canceled ''true life is good. I am successful and or compleate if not dirty then ... New form ... show form ... unload form ... set form = nothing end if end function Am I missing something or should this work? What kind of restrictions is there in the queryUnload event. None of the ms documentation mentioned that form creation is a bad idea :-) Any sugesstions would be appricated .
Hey Roger, I'm awake, but he has already been warned to move his question. :) Did you find you answer Jason? Nick Parker
-
Hey Roger, I'm awake, but he has already been warned to move his question. :) Did you find you answer Jason? Nick Parker
Sorry, I didn't post sooner .... I could not find my message :) I was not aware there was a vb section. I tried the different code: ...If CheckSave() Then Cancel = 1 But no, that has the exact same effect as the original code :(( it seems like the community thinks this should be an okay use of a form and a dialog, so I must be creating a referance or something that is messing me up... I am still looking into it Thanks for your time, All.