Default dialog callback feature for IFLOGM

Default dialog callback feature for IFLOGM

I often write a single callback routine that handles all the callback events for windows dialog box. The net result is that in the dialog initialisation code I need to have multiple calls to DLGSETSUB for each control (or define an integer array or all the control ID's and loop over it doing dlgsetsub). It would be a nice feature that would save coding that as well as DLGSETSUB we had DLGSETDEFAULTSUB (or another suitable name) that defined a defualt callback for ALL control ID's for the dialog that were not otherwise defined.

I think this would be quite easy to do as the private dlg structure  of IFLOGM has a list of all the valid ID's for the dialog after DLGINIT.

If it is possible to do this already by some means  it would be useful helpful if someone could advise.




3 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.

You could write your own subroutine to do this and pass any array of control IDs defining those that are to be assigned call back. There are several "user defined" extensions that you might want to add to the standard iflogm module features. I have created a wrapper module which contains dozens of additional routines relating to dialog boxes. e.g.

module MyIflogm

use iflogm


subroutine dlg_MultiSetSub(dlg,n,idc,callback)

! Arguments
type(DIALOG)    :: dlg
integer,intent(in) :: n
integer,intent(in) :: idcs(n)
 external           :: callback

! Add code here

end subroutine

end module

Instead of passing the control ids via an argument the ids could be retrieved from the Dlg%list(..)%id if you wanted all controls assigned to the callback.

Simply add "use MyIflogm" in place of "use iflogm" in your programs.


Thanks for the reply Stephen. Looking at it further you should be able to do something like the quick test I made below:

subroutine test_set_all_dlg_controls(dlg)
   use iflogm, only : dialog, dlgsetsub
   implicit none
   TYPE (DIALOG) :: dlg 
   logical(4) :: retl4
   integer :: l1
   external :: FRIC_CB 
   do l1=1,dlg%NumControls
       retl4=dlgsetsub (dlg,dlg%list(l1)%id,FRIC_CB)
end subroutine test_set_all_dlg_controls

However, it 'works' but it shoudn't work as the dialog%list should be private I thought? I think I will leave well alone until I fully understand all the ramifications and 'unforseen consequences'.

 I also noticed when browsing IFLOGM a few minutes back that when dlginit is called the control callbacks are all initialised to a couple of default do nothing routines one for button conrols and one for other controls.....

Kommentar hinterlassen

Bitte anmelden, um einen Kommentar hinzuzufügen. Sie sind noch nicht Mitglied? Jetzt teilnehmen