Silverfrost Forums

Welcome to our forums

Dynamically updated %il and %sl

29 Aug 2014 6:13 (Edited: 29 Aug 2014 8:55) #14544

Clearwin+ allow to update many its controls dynamically. The %il, %fl, %dd and %sl are still among few exceptions.

Here are few examples how things look right now.
If you change the limits, both the %il or slider %sl still use older hardwired parameters taken at load time.

Attempts to make a workaround opening one more window, change the limits there and push them with window_update@(limits) to change does nothing.

So changing the limits forces the user to close the window and open it again which looks like a pity design defect

SLIDER CODE

real*8 aMin, aMax, aVal
aMin=0
aMax=1	
i=winio@('Slide between these two numbers %6rf%6rf&', aMin, aMax)
i=winio@('  %30sl&',aVal, aMin, aMax)
i=winio@('  %rf&',aVal)
i=winio@('%ac[esc]','exit')
end

INTEGER LIMIT CODE

integer iMin, iMax, iVal
iMin=0
iMax=10	
i=winio@('Run the wheel up between these two numbers %6rd%6rd&', iMin, iMax)
i=winio@('Run the wheel up %dd%il%6rd%`il&', 1, iMin, iMax, ival)
i=winio@('%ac[esc]','exit')
end

Workaround for INTEGER LIMIT CODE

common iMin, iMax, iVal
integer  cb
external cb

iMin=0
iMax=10	
i=winio@('Run the wheel up between these two numbers %6rd%6rd&', iMin, iMax)
i=winio@(' %dd%il%6rd%`il%ff&', 1, iMin, iMax, ival)
i=winio@('%^bt[Change limits]&', cb)
i=winio@('%ac[esc]','exit')
end

integer function cb ()
common iMin, iMax, iVal
i=winio@('%cn Change the wheel limits %6rd%6rd&', iMin, iMax)
i=winio@('%ac[esc]','exit')
call window_update@(iMin)
call window_update@(iMax)
cb=2
end function

Besides, if happen that the limits in %il have equal values it crashes the code, which at least it shouldn't do, the control must just do nothing

29 Aug 2014 6:33 #14546

Thanks Dan. I have added this to the wish list.

29 Aug 2014 6:02 #14552

I think I observed some years ago that having the limits the same appears to be inadmissable, and if you are revisiting this, then perhaps you could look at the case of the two limits the same and then turning the box into 'not editable'.

Eddie

30 Aug 2014 5:30 #14555

Thanks Eddie.

31 Aug 2014 12:33 #14570

Eddie, If graying the edit box control is dynamically updatable and will not essentially need directing the code into new place with if-then and closing/reopening the window than this is the solution. But do you think allowing the same limits in %il violates some design guidances and rules?

10 Feb 2015 12:31 #15626

It turns out that there are existing undocumented functions for this but they currently do not work with %dd. Here is a sample program.

winapp
program main
include <windows.ins>
integer n,ctrl,hwnd
n = 0
i = winio@('%il&', 0, 100)
!!!!i = winio@('%dd&', 10)
i = winio@('%rd&', n) 
i = winio@('%lc&', hwnd) 
i = winio@('%lw', ctrl)
call set_integer_limits@(hwnd, 0, 30)
end

The next release includes a fix to make this work for %dd. For double precision values call set_float_limits@.

10 Feb 2015 4:05 #15628

Brilliant!

And can we have the case of both limits being identical making the control read only please?

Eddie

10 Feb 2015 4:41 #15629

OK. This has now been added to set_integer_limits@.

10 Feb 2015 7:18 #15631

Great! That means Clearwin is approaching 100% consistency allowing to dynamically update everything.

Please also take a look on dynamically updatable background color of controls %`bg, Paul, after finishing 64bit compiler ! This is extremely useful as a warning sign or a reminder to the user. Right now this requires page reload

11 Feb 2015 8:10 #15634

There is an existing rountine set_control_back_colour@ that may do the trick.

11 Feb 2015 11:28 #15637

Yes, you are right, it exists, works, and i even tried it but not finished by some reason, thanks

Please login to reply.