Slider

Slider

Postby Gary Woodley » Fri Jul 03, 2009 4:00 pm

Hi,

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

Regards

Gary
Gary Woodley
 
Posts: 28
Joined: Mon Apr 27, 2009 3:37 pm
Location: Oxford UK

Re: Slider

Postby ukoenig » Fri Jul 03, 2009 4:34 pm

Hello Gary,

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

Image

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 :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Slider

Postby Gary Woodley » 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
Gary Woodley
 
Posts: 28
Joined: Mon Apr 27, 2009 3:37 pm
Location: Oxford UK

Re: Slider

Postby ukoenig » Mon Jul 06, 2009 1:29 pm

Hello Gary,

On any Color- or Slider-Changes, You have to do a oBMP:Refresh()
Code: Select all  Expand view

// 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 :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Slider

Postby Gary Woodley » Tue Jul 07, 2009 9:35 am

Works perfectly :)

Thanks for your help

Regards

Gary
Gary Woodley
 
Posts: 28
Joined: Mon Apr 27, 2009 3:37 pm
Location: Oxford UK


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 97 guests