comdlg32 flags and return value

karel schoonjan

New Member
I'm using the common dialog OCX to manage fonts, and store them in a database, but I got 2 problems with it.
- How can I know the user pushed the "cancel" button or closed the object?
- I presume progress uses the same ocx to edit fonts, however the color selection doesn't appear in the effects part. Does anabody know how this is done?
 
karel,
the common dialog control has a property that reflects this situation.
I have not tested this, but you can do this:

go to http://msdn.microsoft.com
search for CommDlgExtendedError
Select the article that shows the function reference (the first in my search)

This common dialog function returns 0 when the user presses Esc or closes the dialog, otherwise it returns a non zero value.

Hope this help.
Oscar
 
thanks Oscar,

for replying on my issue, I solved it with the following code:

/* Set error flag, to trap cancel button or escape */
chCtrlFrame:CommonDialog:CancelError = TRUE.

chCtrlFrame:CommonDialog:Showfont() NO-ERROR.

IF NOT ERROR-STATUS:ERROR AND
ERROR-STATUS:NUM-MESSAGES = 0
THEN DO:

The CommDlgExtendedError function did not made any difference between ok or cancel button, it returns an error code when error (no fonts defined ...)
 
Back
Top