FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Slider
Posts: 28
Joined: Mon Apr 27, 2009 03:37 PM
Slider
Posted: Fri Jul 03, 2009 04:00 PM

Hi,

How do I set a slider to a startup value when creating from a resource.

Regards

Gary

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Slider
Posted: Fri Jul 03, 2009 04:34 PM
Hello Gary,

oSlider:Set ( ??? ) // Position
( the Example uses a Slider to set the Gradient-Color-Position between 0.01 - 1.00 )



D_MOVE := 0.50 // Centered Position

REDEFINE SLIDER oSLIDER VAR nVar OF oDlg ID 700;
HORIZONTAL ;
RIGHT DIRECTION ;
RANGE 0, 10 ;
ON CHANGE ( D_MOVE := (nVar / 10), ; // a Slider-Move refreshes the GET-value
IIF( nVar = 0, D_MOVE := 0.01, NIL ), oMove:Refresh() ) ;
COLORS 128, 15977281, 128 ;
MARKS 11 ; // 10 Spaces
UPDATE

// Value-Input of the GET refreshes the Slider-Position
// --------------------------------------------------------------
REDEFINE GET oMOVE VAR D_MOVE ID 330 PICTURE "9.99" OF oDlg UPDATE ;
VALID ( ( oMOVE:Refresh(), oSlider:Set(D_MOVE * 10) , oSlider:Refresh() ), .T. )

oMOVE:cTooltip := "Test"

Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 28
Joined: Mon Apr 27, 2009 03:37 PM
Re: Slider
Posted: Mon Jul 06, 2009 12:25 PM

Thanks that works perfectly :)

I am giving an option of using gradients in my dialogue boxes and in the configuration screen want to display an example of what the customer will see as you do in your Backgrounds program. Have tried to display using btnbmp but does not seem to show any gradient. How did you achieve this?

Regards

Gary

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Slider
Posted: Mon Jul 06, 2009 01:29 PM
Hello Gary,

On any Color- or Slider-Changes, You have to do a oBMP:Refresh()
Code (fw): Select all Collapse
// Result Control-Image oBMP
// Blanc = any Dummy-Bmp from Resource
// D_DIRECT ( 1 or 2 ) = Horiz. or Vertical ( I need numeric )
// D_COLOR1 = 1. Color
// D_COLOR2 = 2. Color
// D_MOVE = Grad-position from Slider
// -------------------------------------------------------
REDEFINE BITMAP oBMP  ID 12  ADJUST  RESOURCE "Blanc"  OF oFld:aDialogs[1] 
oBMP:bPainted := {|hDC| DS_GRAD( oBMP, D_DIRECT, D_COLOR1, ;
  D_COLOR2, D_MOVE ) }

//------------- GRADIENT HOR / VERT -----------

FUNCTION DS_GRAD( oBitmap, nDirection,nVColor, nBColor, nMove ) 
LOCAL aGrad := { { nMove, nVColor, nBColor }, { nMove, nBColor, nVColor } }
LOCAL aRect := GETCLIENTRECT( oBitmap:hWnd )
LOCAL oNewBrush, hDC := oBitmap:GETDC()

IF nDirection = 1
   DEFINE BRUSH oNewBrush COLOR GradientFill( hDC,  0, 0, aRect[3], aRect[4], aGrad, .T. )
ELSE
   DEFINE BRUSH oNewBrush COLOR GradientFill( hDC,  0, 0, aRect[3], aRect[4], aGrad, .F. )
ENDIF

FillRect( hDC, aRect, oNewBrush:hBrush )

oBitmap:ReleaseDC()
RELEASE BRUSH oNewbrush

RETURN NIL


Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 28
Joined: Mon Apr 27, 2009 03:37 PM
Re: Slider
Posted: Tue Jul 07, 2009 09:35 AM

Works perfectly :)

Thanks for your help

Regards

Gary

Continue the discussion