Software Archive
Read-only legacy content
17061 Discussions

DLGSETSUB - Wanted example using fourth argument

isn-removed200637
Débutant
350 Visites
Having (frequently) read the on-line documentation about DLGSETSUB (which I regularly use with no problems), I note that there is an (optional) fourth argument to it which
supposedly lets one distinguish between multiple-callback functions assigned to a control using it. I am at a loss as to how this can work.
I understand that one can assign more than one call-back to a dialog control.
How can this work? I have not seen an example. Can anyone enlighten me?
TIA
0 Compliments
1 Répondre
Intel_C_Intel
Employé
350 Visites
Hi,

If you look at "Available Indexes for Each Dialog Control" in the "Using Dialogs" section, the last column identifies the "events" on which a control will do a callback. With the Edit box, for example, there are 4 different events on which the edit control can do a callback. It will only do the callback if you call DLGSETSUB with the appropriate index. Each control has a default index which is the most common event that programmers are interested in. For the Edit box, the default index is DLG_CHANGE. If you call DLGSETSUB on an edit control and leave off the 4th argument, your callback will be invoke after every change made to the Edit box by the user. Suppose that instead, or in addition, you wanted to know when the edit box loses the input focus. You would call:

DlgSetSub(dlg, IDC_EDIT1, MyLoseFocusCallback, DLG_LOSEFOCUS)

See an example in SAMPLESDIALOGTHERMTHERM.F90. For each control, you can have none, 1, all of its callbacks active at the same time. The callbacks can invoke the same routine (where you distinguish by the "callbacktype" argument), or they can call different routines.

I hope this helps,
Leo
0 Compliments
Répondre