Silverfrost Forums

Welcome to our forums

Issue with %co[check_on_focus_loss]

20 Jun 2008 1:32 #3389

The simple program below prompts for a number, and then prints this out when one selects the Test menu button. With %co[check_on_focus_loss] it is impossible to change the number. However, I have applications similar to this in which I need to use check_on_focus_loss to prevent invalid entries, and want the user to be able to then go to a menu item (or use an accelerator key). Surely activating a menu item represents a loss of focus.

MODULE m
  INTEGER, PUBLIC :: n=1
END MODULE m
!
WINAPP
PROGRAM p1
  USE m
  IMPLICIT NONE
  INTEGER :: iw
  INTEGER, EXTERNAL :: f
!
  iw=winio@('%mn[Test]&',f)
  iw=winio@('%co[check_on_focus_loss]Input: %dd%5rd',1,n)
END PROGRAM p1
!
FUNCTION f()
  USE m
  IMPLICIT NONE
  INTEGER :: f
  WRITE (UNIT=*,FMT=*) n
  f=1
END FUNCTION f
20 Jun 2008 7:15 #3391

It seems that a menu is not a control in the sense of triggering focus loss checks. Your code works as expected with a %^bt. It also works if you remove the %co.

Since you don't have %il, then any value is OK in the %rd box, so why only check at the end?

Eddie

20 Jun 2008 7:57 #3392

Thanks for the reply. In my original program I do have a %il for a lower bound, so that the code for forming the window is something like:

iw=winio@('%mn[Test]&')
iw=winio@('%il&',4,HUGE(n))
iw=winio@('%co[check_on_focus_loss]Input: %dd%5rd',1,n)

(n must, of course, be initialised in the module to a valid value).

I don't want to use %co[full_check], which is the default, since this makes it painful for the user to type in values between 10 and 39.

20 Jun 2008 8:08 #3393

Hi Simon,

I have big issues with %il and %fl, partly because they are not 'dynamic', i.e. they respond to the initial values given, and also they don't work for lower_limit=upper_limit, i.e. the value can't change, and they need to be explicitly turned off. As a result, I have gone through my code eliminating most of them, and find it far more satisfactory to do the range check myself in a call-back function.

I often find that Clearwin has superb facilities that I never dreamt that I would use, and am likely to only use once anyway - but every now and again it comes up with limitation like yours.

I suspect that exiting a window by means of a menu item is 'unconventional Windows', and that no-one ever thought to allow it, because they assumed one would exit with an 'OK' button or the like.

Eddie

Please login to reply.