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 

Multiple occurrences of %rs

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



Joined: 05 Jul 2006
Posts: 196

PostPosted: Fri May 21, 2021 2:30 am    Post subject: Multiple occurrences of %rs Reply with quote

I notice that if you use more than %rs in a window then one apparently has to have a separate declaration for each occurrence. For example, the following code prints two Bs rather than A and B.

Code:
Winapp
Program p
 Use clrwin, Only: winio$
 Character :: c
 Integer :: iw

  c = 'A'
  iw = winio$('%`rs&', c)
  c = 'B'
  iw = winio$('%`rs&', c)
  iw = winio$(' ')

End Program p


Am I correct in assuming that I must store A and B separately?


Last edited by simon on Fri May 21, 2021 9:38 pm; edited 1 time in total
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri May 21, 2021 8:19 am    Post subject: Reply with quote

simon

%`rs reads from the given character variable so you do need two.

An alternative is to use %ws or simply put the string in the first argument of winio@...

iw = winio@("Hello World")
Back to top
View user's profile Send private message AIM Address
simon



Joined: 05 Jul 2006
Posts: 196

PostPosted: Thu May 27, 2021 7:50 pm    Post subject: Reply with quote

Thanks Paul, So would it be right to suggest using
1) %`rs if there is some possibility I may want to update the string output if the corresponding variable changes value (with the understanding I would have to call window_update@), but
2) %ws if I want to output the current value and do not care about happens to the variable afterwards?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu May 27, 2021 8:54 pm    Post subject: Reply with quote

Yes that would be right.
Back to top
View user's profile Send private message AIM Address
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