Thank you Paul, that works perfectly ........
program demo
implicit none
integer iw, m_unit, t_unit
integer, external :: new_data_cb
integer(7) handle_top, handle_main
common m_unit, t_unit, handle_top, handle_main
m_unit = 30
t_unit = 40
iw = winio@('%fn[Consolas]&')
iw = winio@('%`bg%`30.2cw[local_font]&',rgb@(240,240,240),t_unit,handle_top)
iw = winio@('%ff%ac[Ctrl+C]&', 'COPY')
iw = winio@('%cm[Copy]&', 'COPY')
iw = winio@('%`bg[white]%`30.20cw[vscroll,local_font]&',m_unit,handle_main)
iw = winio@('%ta%^bt[New_data_1]&',new_data_cb)
iw = winio@('%sc&', new_data_cb)
iw = winio@(' ')
end program demo
integer function new_data_cb()
use clrwin
implicit none
C_EXTERNAL CANCEL_SELECTION@ '__cancel_selection'(VAL7)
integer i
integer m_unit, t_unit
integer(7) handle_top, handle_main
logical :: first=.true.
character(len=28), parameter :: fmt1 = '(' Id XXXXXX YYYYYY')'
character(len=35), parameter :: fmt2 = '('-----------------------------')'
character(len=24), parameter :: fmt3 = '(3X,I3,3X,F6.2,3X,F6.2)'
common m_unit, t_unit, handle_top, handle_main
if (first) then
call SET_MAX_LINES@(handle_main,101)
write(t_unit,fmt1)
first = .false.
end if
call CANCEL_SELECTION@(handle_top) !### Clears any user selected text in both %cw areas
call CANCEL_SELECTION@(handle_main) !###
write(m_unit,fmt2)
do i = 1, 100
write(m_unit,fmt3) i, 100.d0*random@(), random@()
end do
new_data_cb = 2
end function new_data_cb