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 

Property sheet syntax limitations

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
sparge



Joined: 11 Apr 2005
Posts: 371

PostPosted: Thu Nov 11, 2010 4:28 pm    Post subject: Property sheet syntax limitations Reply with quote

Been a while since I had call to use %sh and %ps but it happened today. Thought I had a really elegant solution till I came to code it and then found I had shot myself in the foot ...

Once the property sheet children have been set up using a series of %sh controls, they have to be activated using a %ps control, the syntax for which is:

Code:
i = winio@ ('%Nps', h1, h2, ... , hN)


where h1 ... hN are the handles of the individual children. Now there's nothing to stop a program using a loop to set up a family of children, the size of which is not known until run-time, but the %ps syntax prevents them from being activated elegantly because the handles have to be enumerated explicitly.

One of the joys of using ClearWin+ is discovering that the syntax is powerful enough to accommodate occasional "I wonder if ...?" imagination, on the basis of which I tried the following:

Code:
do j = 1, n
i = winio@ ('%sh', h (j))
end do
i = winio@ ('%*ps', n, (h (j), j = 1, n))

but alas, on this occasion my imagination appears to have defeated the compiler, which issues me with error 571 - ',' found where ')' was expected.

Can I suggest that the %ps control could usefully be developed to accommodate the more flexible syntax above? Fortunately, I can work around the limitation in the code I am currently working on, where the number of children, though variable, is always going to be small enough to allow me to select a specific line of Clearwin+ code from a menu of hard-coded alternatives:

Code:
if (n .eq. 2) then
  i = winio@ ('%*ps', 2, h (1), h (2))
else if (n .eq. 3) then
  i = winio@ ('%*ps', 3, h (1), h (2), h (3))
else ...
...
else if (n .eq. nmax) then
  i = winio@ ('%*ps', nmax, h (1), h (2), h (3), ... , h (nmax))
end if


But really, bleurgh ...
Back to top
View user's profile Send private message Send e-mail
PaulLaidler
Site Admin


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

PostPosted: Fri Nov 12, 2010 10:58 am    Post subject: Reply with quote

There is a way to do this, see the help file under "Advanced use of format windows".

There is a set of routines that allow you to build a winio@ list before calling winio@. In other words the list is built and then the winio@ call only provides the format via one argument.

subroutine add_winio_integer@(integer_val)

subroutine add_winio_float@(real8_val)

subroutine add_winio_function@(func_name)

These can be used within a do loop to give the flexibility that you require.
Back to top
View user's profile Send private message AIM Address
sparge



Joined: 11 Apr 2005
Posts: 371

PostPosted: Fri Nov 12, 2010 12:35 pm    Post subject: Reply with quote

Marvellous! Many thanks, Paul.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support 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