Silverfrost Forums

Welcome to our forums

check_on_focus_loss

7 May 2013 3:36 #12180

Here is something funny. I use check_on_focus_loss to make it possible to key in a percentage of say 50. Then, the lower values (width, height) are not updated when I set the percentage using the spin wheel. But if I delete check_on_focus_loss, the update works well.

      program test

      IMPLICIT NONE
      INCLUDE <WINDOWS.INS>

      external       prop_fix,s2z,z2s

      integer*4      j,zei,spa,proz,s_spa,s_zei

      common  /i_size/   zei,spa,proz,s_spa,s_zei

      spa   = 4000
      zei   = 3000
      proz  = 100
      s_spa = spa
      s_zei = zei

      j = winio@('%ca[Test]%sy[3d_thin]%fn[MS SANS SERIF]%tsImage size'
     *    //'%co[check_on_focus_loss]%dd%il%^4rd%% or%ffWidth%il%^6rd'
     *    //'pxl, Height%il%^6rdpxl%ff%nl%cn%`7bt[OK]',.96D0,10,10,
     *    1000,proz,prop_fix,1,99999,s_spa,s2z,1,99999,s_zei,z2s)

      end
 
C ====================================================================== CCCC
 
      INTEGER FUNCTION prop_fix()

      IMPLICIT NONE

c     via percentage
 
      integer*4     proz,s_spa,s_zei,zei,spa
      real*8        r

      common  /i_size/   zei,spa,proz,s_spa,s_zei
 
      r = dble(proz)/100.D0
      s_spa = nint(r*spa)
      s_zei = nint(r*zei)
      prop_fix = 1
      end

      INTEGER FUNCTION z2s()
 
      IMPLICIT NONE

c     via rows
 
      integer*4     proz,s_spa,s_zei,zei,spa
      real*8        r

      common  /i_size/   zei,spa,proz,s_spa,s_zei
 
      r = dble(s_zei)/dble(zei)
      proz  = nint(100.D0*r)
      s_spa = nint(r*spa)
      z2s = 1
      end

      INTEGER FUNCTION s2z()
 
      IMPLICIT NONE

c     via columns
 
      integer*4     proz,s_spa,s_zei,zei,spa
      real*8        r

      common  /i_size/   zei,spa,proz,s_spa,s_zei
 
      r = dble(s_spa)/dble(spa)
      proz  = nint(100.D0*r)
      s_zei = nint(r*zei)
      s2z = 1
      end

Regards - Wilfried

7 May 2013 7:58 #12183

It looks OK to me. You only lose the focus when you select another control. If you click on the width or height read boxes, their values update. If you give the OK button a callback you will see that pressing it updates the width and height windows.

Eddie

8 May 2013 5:14 #12188

Yes, but ... if I use the spinwheel for percentage, the lower values should update immediately. But no problem. My simple solution in this case: I work without check_on_focus_loss, use 1 and 1000 as limits for %il and set the percentage value to max(proz,10) outside the window.

Wilfried

8 May 2013 9:49 #12190

Wilfried,

If you use the spinwheel the focus isn't lost just because you clicked on an up or down arrow - it is only lost when you select a completely different control (the spin up/down and the %rd form a sort of composite control).

On another matter, I find the spin up/down controls a little small, and if selecting a particular number is very significant in a dialog box I increase the font size, as in:

      IA = WINIO@ ('%fn[Arial]%ts&', 2.0D0)
      IA = WINIO@('%`bg[white]%il%dd%^rd&', ....

This makes the whole control much bigger and the spin up/down buttons are then easier to select.

If you want different spin controls you can program everything in a small %gr box but this is a lot of effort for only a cosmetic gain.

Eddie

Please login to reply.