![forums.silverfrost.com Forum Index](templates/subSilver/images/logo_phpBB.gif) |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Mon Nov 27, 2017 2:03 pm Post subject: SLider control %sl |
|
|
I remember seeing a slider control as an example in Clearwin using a moving icon in a graphics area, although I can’t find it now. It put me off using one. Now and for a long time, there appears to be a real slider control, %sl. For reference I have looked at the descriptions in FTN95.CFM and CWPLUS.ENH.
Such a slider control is sized in character cells, and returns a position (if moved by the mouse) relative to 1 pixel, which is likely to be an irrational number and different on different computers (using different windows versions, fonts and dpi settings, because they affect the character cell size in pixels). Moving the slider by means of the arrow keys has a step equal to 10% of the range defined with %sl. It also has the behaviour that if the slider is moved to a different start position with the mouse, the arrow step remains the same, but the start position is moved, so in a range 0 to 10, moving the slider by arrow from 1.67 set by mouse will give 2.67, 3.67 etc until the end is reached, whereupon the counting is reset. All very logical, but different to controlling the slider by mouse.
The position is returned as a REAL*8 number.
I see that the MSDN slider control is rather more sophisticated than the Clearwin+ one, i.e. has more options than just horizontal or vertical, and as (to quote) ‘Clearwin+ is just a wrapper for MS controls’, it does seem to me that the step should be the same with arrow keys as with the mouse, or be user-definable akin to the spin wheel, have the ability to select a range, to display tick marks, and jump to tick intervals etc.
%sl is quite friendly, but not very capable, as it stands.
Eddie |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Mon Nov 27, 2017 3:51 pm Post subject: |
|
|
Eddie
I don't have the details to hand but %sl has an undocumented option (probably [ms_style]) that takes integer arguments and accesses the Microsoft slider control, otherwise you get a native Clearwin+ slider. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Mon Nov 27, 2017 5:43 pm Post subject: |
|
|
That's interesting. With ms_style, the slider has a different appearance, the position and limits have to be INTEGER. The arrow step is 1, and the mouse step also 1, if you can control the pointer that accurately.
Suppose you have a WRITE for the position in a callback, then holding an arrow key down gives a stream of incrementing/decrementing numbers. With single presses of the arrow key, the position is displayed twice, suggesting the callback happens twice, and even more but not consistently when moving with the mouse.
Code: | OPTIONS (INTL, DREAL)
WINAPP
PROGRAM SLIDER
INCLUDE <WINDOWS.INS>
COMMON POSITION, iPOSITION
INTEGER, EXTERNAL :: SLIDER_FN
! POSITION = 0.0D0
iPOSITION = 0
IA = WINIO@('%ca[Slider demo]&')
! IA = WINIO@('%30^sl[ms_style]', POSITION, 0.0D0, 1.5D0, SLIDER_FN)
IA = WINIO@('%30^sl[ms_style]', iPOSITION, 0, 200, SLIDER_FN)
END
INTEGER FUNCTION SLIDER_FN()
INCLUDE <WINDOWS.INS>
COMMON POSITION, iPOSITION
! WRITE(*,*) POSITION
WRITE(*,*) iPOSITION
SLIDER_FN = 1
RETURN
END |
|
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Tue Nov 28, 2017 12:00 am Post subject: |
|
|
Eddie
Maybe your caalback should return the value 2, otherwise you could get feedback. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Tue Nov 28, 2017 11:23 am Post subject: |
|
|
With a return value of 2, the behaviour is consistent, giving me a triple last position display, oddly with the last two on the same line in the character display window.
On the grounds that a slider is a parameter setting control, not a command control, this repetition probably doesn't matter. The callback is only there to display the position, and in some applications isn't needed anyway.
Eddie |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Wed Nov 29, 2017 11:46 pm Post subject: |
|
|
By the way, are there any more handy undocumented features?
E |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Thu Nov 30, 2017 7:44 am Post subject: |
|
|
Some things are coming to light as a result of the development of Visual ClearWin+ and I plan to include these in the documentation in due course. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|