Silverfrost Forums

Welcome to our forums

Property sheet syntax limitations

11 Nov 2010 3:31 #7129

Just posted this in the Support forum and then realised it was in the wrong place. Sorry Paul.

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:

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:

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:

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

12 Nov 2010 9:59 #7131

See my reply under 'Support'.

Please login to reply.