I took your contribution and now it plots on each screen but still does not work right.
Why handle for each of 3 graphics windows are all the same is a good question. Due to that every time we click on any window the plotting goes to the last screen instead the current one
Here is what i changes in your code:
each callback calls select_graphics_object@ function before doing any drawings. And
the callback does have value 2 not zero at the end, this is default for Clearwin+ . Zero might be used if you want to close window on any click on it
i removed 'implicit none' as it made me nuts and swear louder very quickly asking to declare each and every damn junk variable i introduce like i44 in each and every subroutine. Or requiring to declare each variable in common blocks in all these Functions. To avoid that requires using modules but modules have another bad property: when your code will grow one big module will eventually swallow all others making one huge monopoly which has nothing more but die
We may continue to swear...err...try some more permutations before asking Paul to comment, i have couple other demos which actually worked pretty well switching graphics windows.
winapp
program test_mdi1
include <windows.ins>
integer :: i1,i2,i3,i4, ixF, iyF, rslt, ihgw_main_window, ihgw_control_panel, ihgw_display_bar, ihgw_simulation
integer iT, iTextUnit
integer, external :: draw_control_panel, draw_display_bar, draw_simulation
common /GR_areas_ids/ihgw_main_window, ihgw_control_panel, ihgw_display_bar, ihgw_simulation
ixF=1100
iyF=1000
iTextUnit=2 ! was 0 before version 8.30
i1=winio@('%ww[no_border]%es&')
i1=winio@('%ca[Main Window containing an MDI frame]&')
i1=winio@('%pv%fr%lw',ixF,iyF, ihgw_main_window)
iT=winio@('%aw%ww[no_border]%ca[Text Window]%pv%40.8cw', &
ihgw_main_window, iTextUnit )
i2=winio@('%aw%ww[no_border]%ca[Control Panel]%pv%`^gr[black,user_resize]', &
ihgw_main_window, 300,200,ihgw_control_panel, draw_control_panel )
i3=winio@('%aw%ww[no_border]%ca[Display Bar]%pv%`^gr[white,rgb_colours,user_resize]', &
ihgw_main_window, 500,400, ihgw_display_bar, draw_display_bar )
i4=winio@('%aw%ww[no_border]%ca[ihgw_simulation]%pv%`^gr[black,user_resize]', &
ihgw_main_window, 800,800, ihgw_simulation, draw_simulation )
!... Text window
Print*, 'This is Text window'
end program test_mdi1
!..............................................................
integer function draw_control_panel ()
include <windows.ins>
common /GR_areas_ids/ihgw_main_window, ihgw_control_panel, ihgw_display_bar, ihgw_simulation
i44=select_graphics_object@(ihgw_control_panel)
call draw_filled_ellipse@(100,100,80,80,rgb@(127,59,30))
draw_control_panel=2
end function
!..............................................................
integer function draw_display_bar ()
include <windows.ins>
common /GR_areas_ids/ihgw_main_window, ihgw_control_panel, ihgw_display_bar, ihgw_simulation
i44=select_graphics_object@(ihgw_display_bar)
call draw_filled_rectangle@(2,2,398,398,rgb@(255,255,30))
draw_display_bar=2
end function
!..............................................................
integer function draw_simulation ()
include <windows.ins>
common /GR_areas_ids/ihgw_main_window, ihgw_control_panel, ihgw_display_bar, ihgw_simulation
i44=select_graphics_object@(ihgw_simulation )
call draw_filled_rectangle@(10,10,200,200,rgb@(30,255,30))
call draw_filled_rectangle@(100,50,120,60,rgb@(255,0,30))
call draw_filled_rectangle@(400,400,600,5000,rgb@(30,0,255))
draw_simulation=2
end function