Forum Index
Welcome to the Silverfrost forums
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Unstable %eb behaviour with user_colours in FTN 8

Post new topic   Reply to topic Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message

Joined: 04 Nov 2005
Posts: 148
Location: Darkest Devon

PostPosted: Mon May 08, 2017 3:49 pm    Post subject: Unstable %eb behaviour with user_colours in FTN 8 Reply with quote

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

! 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, &
  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)


! 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 SetDpiAwarenes
Back to top
View user's profile Send private message Visit poster's website
Site Admin

Joined: 21 Feb 2005
Posts: 4920
Location: Salford, UK

PostPosted: Tue May 09, 2017 6:57 am    Post subject: Reply with quote

I have made a note that this needs investigating.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2005 phpBB Group