Silverfrost Forums

Welcome to our forums

Single quotes in text to be printed

9 Mar 2013 10:28 #11681

G'day, folks 😃

Is it possible to include single quotes (') in text to be printed?

For example:

ia=winio@('Enter will remain greyed until a title is supplied.&')

I'd like to display Enter surrounded by single quotes, thus: 'Enter'

Eric

9 Mar 2013 10:49 #11682

Try using double quotes for the whole string then a single quote inside.

ia=winio@('Enter will remain 'greyed' until a title is supplied.&')
9 Mar 2013 11:42 #11683

Thankyou Paul 😃

Using the double quote as the delimiter solved the problem nicely.

Now I ask myself if such a feat is possible. That is, that 'Enter' remain greyed until text is entered into the edit box. The code so far is as follows. I've created a callback function 'title_cannot_be_blank' but so far the function does nothing.

      iget_title=1
      ia=winio@('%ca[Job Title]%`cn&')
      ia=winio@('%nlToday''s date and time are %`rs&', date_time)
      ia=winio@('%nlEnter a title for the job.&')
      ia=winio@
     1 (' 'Enter' will remain greyed until a title is entered.&')
      ia=winio@('%nl%70rs&', job) 
      ia=winio@('%~^bt[Enter]%^bt[No change]',
     1 flags(16), title_cannot_be_blank, quitter)
C
      if(job .ne. ' ' .and. nsel .gt. 0) flags(17) = 1 ! 'Run'
C
      return
      end

Eric

9 Mar 2013 1:24 (Edited: 10 Mar 2013 11:56) #11685

Graying usually needs just one small callback function. Demonstrated here on longer example where graying does not allow run the code until title is supplied - if it is what you were asking for. I used free format because this forum adds one more space to the beginning of the line making fixed format text non-compilable as is. And then bored to declare integer/external functions and common blocks i used modules, sorry if this is not your style. You can put all that into external functions.

Compile> FTN95 TEST.for /free /link /debug or call it TEST.F95 and then /free is not needed

  module AllFunct
  use clrwin
  character*64 date_time, job
  integer flags(17)

  contains

  integer function title_cannot_be_blank()
  if(job.ne.' ') flags(16)=1
  call window_update@(flags(16))
  title_cannot_be_blank=1
  end function

  integer function Run()
  parameter (N=10)
  real*8 X(N),Y(N)
  iwid =400; iheig=250
      do i=1,N
        x(i)=i-1
        y(i)=x(i)**2
      enddo
      i=winio@('%ww%pv%pl[x_array]&', iwid, iheig, N, x, y)
      i=winio@('%ac[esc]','exit') 
  Run=1
  end function

  integer function quitter()
  quitter=1
  end function

  end module
!.....................................................
  program TEST
  use AllFunct

  flags(16) = 0 
  job=' '

  ia=winio@('%ca[Job Title]%`cn&')
  ia=winio@('%ac[esc]&','exit') 
  ia=winio@('%nlToday''s date and time are %`rs&', date_time) 
  ia=winio@('%nlEnter a title for the job.&') 
  ia=winio@(' 'Enter' will remain greyed until a title is entered.&') 
  ia=winio@('%nl%40^rs&', job,title_cannot_be_blank) 
  ia=winio@('%~^bt[Enter]%^bt[No change]',flags(16), Run, quitter) 
! 
       if(job .ne. ' ' .and. nsel .gt. 0) flags(17) = 1 ! 'Run' 
! 
       end
9 Mar 2013 3:56 #11688

Thankyou, Dan 😃

The first interesting feature I noticed was the callback function in association with rs in the code line

ia=winio@('%nl%40^rs&', job,title_cannot_be_blank)

So that 'title_cannot_be_blank' is used to monitor changes in the edit box. Most clever! 😃

Thanks again, Dan 😃

Eric

Please login to reply.