- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've searched the help files, but cannot find anything that tells me how to handle when the "cancel" button has been pushed. I see that it has the ID of IDCANCEL, but apparently nowhere in the documentation does it tell how to access the value of IDCANCEL in order to determine if it has been pushed. Anyone now how?
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
'use dflogm' will allow you to access IDCANCEL.
(Its value is 2)
(Its value is 2)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Alfred, thanks. Now, can anyone tell me if there is a way to automatically cause OK to be clicked on so as to return without requiring the user to click on it? The reason why is that I have quickly become enamored with dialog boxes and want to use one to automatically output the status of my program as it is running. Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The button you want to be pushed on should have the "default button" property checked. It it under properties - styles.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using DFLOGM, but cannot acccess IDCANCEL (in the debugger at least), which is why I posted the question. So, in my case, I cannot query what the value of IDCANCEL is in order to write logic on how to handle execution when the cancel button is pushed. Any further thoughts?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
IDCANCEL (=2) and IDOK (=1) are PARAMETERs so you can't view them in the debugger.
IDCANCEL message is generated whenever user presses Esc key. Similarly, when user presses Enter key, the dialog is searched for the button with "Default" property, and if there's one, appropriate ID message is generated. IDOK button has "Default" property in the resource editor by default.
Now, I'm not sure what happens if there's no button with ID=2=IDCANCEL; I think the cancel message is not generated, i.e. your callback will not be called. In any case, you may safely hide buttons with IDOK and IDCANCEL buttons.
See also DLGSETRETURN and DLGEXIT routines.
Jugoslav
IDCANCEL message is generated whenever user presses Esc key. Similarly, when user presses Enter key, the dialog is searched for the button with "Default" property, and if there's one, appropriate ID message is generated. IDOK button has "Default" property in the resource editor by default.
Now, I'm not sure what happens if there's no button with ID=2=IDCANCEL; I think the cancel message is not generated, i.e. your callback will not be called. In any case, you may safely hide buttons with IDOK and IDCANCEL buttons.
See also DLGSETRETURN and DLGEXIT routines.
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to handle the cansel button? This is what I do:
(Cut and paste makes "wide screen"!)
Sabalan.
retint = DlgModal (MyDialogName) If (retint == 1) Then ! This is OK button Do something, e.g. CONTINUE Else If (retint == 2) Then ! This is cansel button i = MESSAGEBOXQQ ('Do you want to exit the program?'C, & 'Exit...'C, MB$YESNO.OR. & MB$ICONQUESTION) If (i == 6) Then ! This is Yes Do something, e.g. RETURN Else Do something else, e.g. go to previous lines to reinitialize the dialog End If End if
(Cut and paste makes "wide screen"!)
Sabalan.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page