Silverfrost Forums

Welcome to our forums

%`rf within a %sh

1 Dec 2020 11:14 #26652

I may be misunderstanding the dynamics of this but does this example display the expected behavior?

If the user changes the value of the input variable on the first sheet should the corresponding read only variable of the second sheet update without a call to window_update@()?

module example_mod
use clrwin
implicit none
integer, parameter :: dp = kind(1.d0)
real(kind=dp) :: volts_kv = 11.0
integer h1, h2

contains

  integer function gui()
  integer :: iw
  
    iw = winio@('%sh&',h1)
    iw = winio@('%ca[Input data]&')
    iw = winio@('%nl Rated voltage [kV]%ta%`bg[white]%8rf&',         volts_kv)
    iw = winio@(' ')

    iw = winio@('%sh&',h2)
    iw = winio@('%ca[Output data]&')
    iw = winio@('%nl Rated voltage [kV]%ta%`bg[white]%8`rf&',         volts_kv)
    iw = winio@(' ')

    iw = winio@('%mn[Exit]&','Exit')
    
    iw = winio@('%2.1ob&')
    
    iw = winio@('%nl%2ps[hot_track]&',h1,h2)

    iw = winio@('%cb&')
    
    iw = winio@('Question&')
    iw = winio@('%2nlIf the user changes the value of the input variable on the first sheet&')
    iw = winio@('%nlshould the corresponding read only variable of the second sheet update&')
    iw = winio@('%nlwithout a call to window_update@() ? &')
    iw = winio@('%cb')

    gui = 1
  end function gui
  
end module example_mod

program main
use example_mod
implicit none
integer i
i = gui()
end program main
1 Dec 2020 2:31 #26653

Ken

For me the read-only value in h2 does change with the input data in h1.

This may be due to recent fixes in the ClearWin+ library.

Am I understanding your question correctly?

1 Dec 2020 4:11 #26654

Paul,

This has not come about due to a change in behavior that I have noticed as I have not used this combination before.

I am slightly surprised that the read only %`rf on the second sheet changes when the input on the first changes – I was not expecting that. Hence my question is really: Is this what’s intended?

I thought I would have to use a %ps call back to detect the sheet currently displayed and call window_update@() at that point to make the change apparent, but this is not the case.

It's not due to the %ps. A simpler example below, shows the same behavior, which differs from the documentation “If %`rf is specified, then the value presented can only be changed by the program using WINDOW_UPDATE@(value). “

module example_mod
use clrwin
implicit none
integer, parameter :: dp = kind(1.d0)
real(kind=dp) :: volts_kv = 11.0

contains

  integer function gui()
  integer :: iw
  
    iw = winio@('%mn[Exit]&','exit')
    
    iw = winio@('%nl Rated voltage [kV]%ta%`bg[white]%8rf&',         volts_kv)
    iw = winio@('%ta User changes this value&')
    iw = winio@('%nl Rated voltage [kV]%ta%`bg[white]%8rf&',         volts_kv)
    iw = winio@('%ta This value changes as it is not read only&')
    iw = winio@('%nl Rated voltage [kV]%ta%`bg[white]%`8rf&',        volts_kv)
    iw = winio@('%ta This read only value changes, but it should not change as there is no call to WINDOW_UPDATE@(value)&')
    iw = winio@(' ')

    gui = 1
  end function gui
  
end module example_mod

program main
use example_mod
implicit none
integer i
i = gui()
end program main

It's not a problem for me, it was more of a surprise and perhaps needs to be looked at?

1 Dec 2020 6:44 #26656

Ken

As a general rule you do need to call window_update@ but this is an exception.

In this situation the sheet is redrawn when the tab changes and the read-only edit box uses the current value via its address.

2 Dec 2020 3:23 #26678

Thanks Paul, I now understand how the sheets operate. However, I still think my second example is not aligned with the documentation, but it's a somewhat contrived example, so no worries. Ken

Please login to reply.