I'm having problems with a multi-line edit box when compiling with FTN 8.1 that did not occur with previous versions. When using a %eb edit box with user_colours and a callback, if I attempt to scroll the box using the vertical scrollbar thumb text within the box is selected, and the text display flickers, sometimes corrupts and also the application can cash. A similar thing happens if I attempt to select a block of text using mouse click and drag. This was all working fine up to FTN 8 (compiling as x86 code in Windows 10)
Here's some demo code:
! Demonstrates problem with combination of user_colour edit box and use of
! CLEARWIN_STRING@('CALLBACK_REASON'). Scrolling the box causes strange behaviour
! and attempting to select text and scroll with mouse causes similar behaviour
! and intermittent crashing. Removal of user_colour or CLEARWIN_STRING@ from
! callback fixes the behaviour
winapp
! Info block for edit box
module TestMod
integer*4 info(24), &
eb_h_position, eb_v_position, eb_last_line, &
eb_buffer, eb_buffer_size, eb_max_buffer_size, &
eb_current_position, eb_selection, eb_selected, &
eb_vk_key, eb_vk_shift, eb_active, &
eb_modified, eb_closing, eb_n_chars_to_colour, &
eb_text_to_colour, eb_text_colours, eb_background_colours, &
eb_reserved(6)
equivalence &
(eb_h_position, info(1)), (eb_v_position, info(2)), &
(eb_last_line, info(3)), (eb_buffer, info(4)), &
(eb_buffer_size, info(5)), (eb_max_buffer_size, info(6)), &
(eb_current_position,info(7)), (eb_selection, info(8)), &
(eb_selected, info(9)), (eb_vk_key, info(10)), &
(eb_vk_shift, info(11)), (eb_active, info(12)), &
(eb_modified, info(13)), (eb_closing, info(14)), &
(eb_n_chars_to_colour, info(15)), (eb_text_to_colour, info(16)), &
(eb_text_colours, info(17)), (eb_background_colours, info(18)), &
(eb_reserved, info(19))
end module TestMod
use mswin
use TestMod
external StartCB
external EbCtrlCB
i = winio@('%ww[no_border,independent,not_fixed_size]&')
i = winio@('%ca[FTN Test]%nd&')
i = winio@('%sc&',StartCB)
i = winio@('%pv%100.60^`eb[read_only,hscrollbar,vscrollbar,user_colours]','*',0,info,EbCtrlCB)
end
! Setup some text in the EB on window startup
integer function StartCB()
use mswin
use TestMod
integer:: i
do i = 1, 200
call AppendLine('(eb_h_position, info(1)), (eb_v_position, info(2)), (eb_last_line, info(3)),'// &
'(eb_buffer, info(4)), (eb_buffer_size, info(5)), (eb_max_buffer_size, info(6))')
end do
StartCB = 2
end function StartCB
! eb CB handler
integer function EbCtrlCB()
use mswin
character*32 rstr
rstr = CLEARWIN_STRING@('CALLBACK_REASON') ! presence of this call along with user_colours causes redraw problems during thumb scroll and click-drag text selection scrolling
EbCtrlCB = 0
end function EbCtrlCB
! Append new line to eb
subroutine AppendLine(instring)
use mswin
use TestMod
character(len=*), intent(in):: instring
call EDIT_MOVE_BOF@(info)
call INSERT_EDIT_STRING@(info, instring(1:LEN_TRIM(instring))//char(13)//char(10))
end subroutine AppendLine
I should also mention this is on a high dpi display, although adding SetDpiAwareness@(0) make no difference.
Alan