BBC BASIC for Windows
Programming >> User Interface >> slider parameters & minimal value
http://bb4w.conforums.com/index.cgi?board=ui&action=display&num=1331221433

slider parameters & minimal value
Post by dynamic35 on Mar 8th, 2012, 2:43pm

1)There is possibility to put max value (*right end) of slider. How to initialize ruler's left end (0 is always there) I need -40

2)By the style 800 I get nice little numbers above ruler. Where to read those numbers for application?

(*) PROC_showtrackbar(tb%, max%)

Dynamic35..
Re: slider parameters & minimal value
Post by admin on Mar 8th, 2012, 3:06pm

on Mar 8th, 2012, 2:43pm, dynamic35 wrote:
How to initialize ruler's left end (0 is always there) I need -40

Send a TBM_SETRANGEMIN message:

http://msdn.microsoft.com/en-us/library/windows/desktop/bb760226.aspx

Code:
SYS "SendMessage", !tb%, TBM_SETRANGEMIN, 1, -40 

Quote:
By the style 800 I get nice little numbers above ruler. Where to read those numbers for application?

Sorry, I don't understand the question. Style &800 is TBS_NOTIFYBEFOREMOVE (Vista or later only).

Richard.

Re: slider parameters & minimal value
Post by dynamic35 on Mar 9th, 2012, 09:17am

on Mar 8th, 2012, 3:06pm, Richard Russell wrote:
Send a TBM_SETRANGEMIN message:

http://msdn.microsoft.com/en-us/library/windows/desktop/bb760226.aspx

Code:
SYS "SendMessage", !tb%, TBM_SETRANGEMIN, 1, -40 


Sorry, I don't understand the question. Style &800 is TBS_NOTIFYBEFOREMOVE (Vista or later only).

Richard.


INSTALL @lib$+"WINLIB3"
REM RULER with negative and positive datas Test by XP , date: 9.3.2012/dyn35
xpos%=120 :ypos%=25 : width%=400 : height%=30
P%=-40 : S%=50
T%=800 : REM Style 800 puts x numbers automatically above moving rulerhand
TBM_SETRANGEMIN=1031
tb%= FN_createtrackbar(@hwnd%,xpos%,ypos%,width%,height%,T%)
REPEAT
SYS "SendMessage", !tb%, TBM_SETRANGEMIN, 1, P%
PROC_showtrackbar(tb%, S%)
trackpos%= FN_trackbarpos(tb%)
CLS : PRINT TAB(1,2)"x=";trackpos%
WAIT 20
UNTIL FALSE
PROC_removetrackbar(tb%)
END
This seems to work now
Thankyous from Dynamic35.
Ps.
Style 800 was an 'accidental' finding and I like it since it seems to work in my XP
Re: slider parameters & minimal value
Post by admin on Mar 9th, 2012, 10:53am

on Mar 9th, 2012, 09:17am, dynamic35 wrote:
Style 800 was an 'accidental' finding and I like it since it seems to work in my XP

Right, so that's 800 decimal, therefore &320 hexadecimal, which is:

Code:
TBS_REVERSED + TBS_TOOLTIPS + TBS_ENABLESELRANGE 

I suspect the 'little numbers' you referred to are simply the tooltips created by the TBS_TOOLTIPS style.

Richard.