forums.silverfrost.com Forum Index forums.silverfrost.com
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 

%`rf within a %sh

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
Kenneth_Smith



Joined: 18 May 2012
Posts: 697
Location: Hamilton, Lanarkshire, Scotland.

PostPosted: Tue Dec 01, 2020 12:14 pm    Post subject: %`rf within a %sh Reply with quote

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@()?

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


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

PostPosted: Tue Dec 01, 2020 3:31 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message AIM Address
Kenneth_Smith



Joined: 18 May 2012
Posts: 697
Location: Hamilton, Lanarkshire, Scotland.

PostPosted: Tue Dec 01, 2020 5:11 pm    Post subject: Reply with quote

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). “

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


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

PostPosted: Tue Dec 01, 2020 7:44 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
Kenneth_Smith



Joined: 18 May 2012
Posts: 697
Location: Hamilton, Lanarkshire, Scotland.

PostPosted: Wed Dec 02, 2020 4:23 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com 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