Page 1 of 1

New Class: TSelex

Posted: Sat Dec 04, 2010 1:59 am
by Daniel Garcia-Gil
New Class in development to fivewin

Image

Download Sample HERE

Re: New Class: TSelex

Posted: Sat Dec 04, 2010 12:30 pm
by Daniel Garcia-Gil
made xcommand and added use from resources

Image

DownloadSample HERE

PRG Sample

Code: Select all

#include "fivewin.ch"
#include "tselex.ch"

function Main()

   local oWnd
   local oSelex
   local nOption1 := 1
   local nOption2 := 3
   local nOption3 := 2
   
   define window oWnd 
   
   @ 10, 10 SELEX oSelex VAR nOption1 SIZE 350, 50 PIXEL;
                  ON CHANGE MsgInfo( "Current: " + StrTran( oSelex:aOptions[ nOption ], "&", "" ) + CRLF + ;
                                     "Last   : " + StrTran( oSelex:aOptions[ nOldOption ], "&", "" ))
   
   @ 70, 10 SELEX nOption2 SIZE 250, 50 PIXEL;
            ITEMS "Launch &Dialog", "Option &2", "Option &3";
            GRADIENT OUTTRACK { { 1/2, nRGB( 219, 230, 244 ), nRGB( 207-50, 221-25, 255 ) }, ;
                                { 1/2, nRGB( 201-50, 217-25, 255 ), nRGB( 231, 242, 255 ) } };
            GRADIENT INTRACK  { { 1/3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) }, ;
                                { 2/3, nRGB( 255, 215,  84 ), nRGB( 255, 233, 162 ) } };
            LINECOLORS nRGB( 237, 242, 248 ), nRGB( 141, 178, 227 );
            COLORTEXT  CLR_BLACK, CLR_RED ;
            THUMBSIZE 40 ROUNDSIZE 20;
            ACTION( If( nOption == 1, LaunchDialog(), ) )
            
   @ 130, 10 SELEX nOption3 SIZE 450, 50 PIXEL;
             ITEMS "&FiveWin", "&Power", "&Amazing", "&IPhone";
             THUMBSIZE 40, 30 ROUNDSIZE 0
       
   activate window oWnd
   
return nil

function LaunchDialog()

   local oDlg, nOption3 := 1
   
   define dialog oDlg resource "selex"
   
   REDEFINE SELEX nOption3 OF oDlg ID 100;
             ITEMS "&FiveWin", "&Power", "&Amazing", "&Exit";
             THUMBSIZE 40, 30 ROUNDSIZE 5 ;
             ACTION( If( nOption == 4, oDlg:End(), ) );
             COLOR THUMB CLR_WHITE
             
   
   activate dialog oDlg
   
return nil   
      
 

Re: New Class: TSelex

Posted: Sat Dec 04, 2010 1:02 pm
by ukoenig
Daniel,

that looks very nice !!!

Just a Idea ( I don't know, if it is possible )

Image

Image

Best Regards
Uwe :?:

Re: New Class: TSelex

Posted: Sat Dec 04, 2010 3:29 pm
by Daniel Garcia-Gil
Uwe..

sure it's possible

second selector is dynamic

Image

Download Sample HERE

Code: Select all

#include "fivewin.ch"
#include "tselex.ch"

function Main()

   local oWnd
   local oSelex, oFont
   local nOption1 := 1
   local nOption2 := 1
   local nOption3 := 6
   
   define window oWnd 

   define font oFont Name "Arial Black" size 8, 14      
         
   @ 20, 10 SELEX nOption1 OF oWnd PIXEL SIZE 500, 50;
            GRADIENT INTRACK  { { 1, nRGB( 0, 255, 0 ), nRGB( 255, 0, 0 ) } };
             ITEMS "0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100";
             THUMBSIZE 30, 30 ROUNDSIZE 5 ;
             COLOR THUMB CLR_WHITE FONT oFont

   @ 100, 10 SELEX oSelex VAR nOption2 OF oWnd PIXEL SIZE 500, 50;
            GRADIENT INTRACK  { { 1, nRGB( 0, 255, 0 ), nRGB( 0, 255, 0 ) } };
             ITEMS "0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100";
             THUMBSIZE 30, 30 ROUNDSIZE 5 ;
             FONT oFont;
             ACTION ChangeColor( oSelex )        

   @ 180, 10 SELEX nOption3 OF oWnd PIXEL SIZE 500, 50;
            GRADIENT INTRACK  { { 1/2, nRGB( 0, 0, 255 ), nRGB( 0, 255, 0 ) }, ;
                                  { 1/2, nRGB( 0, 255, 0 ), nRGB( 255, 0, 0 ) } };
             ITEMS "-50", "-40", "-30", "-20", "-10", "0", "10", "20", "30", "40", "50";
             THUMBSIZE 30, 30 ROUNDSIZE 5 ;
             FONT oFont
       
   activate window oWnd

   oFont:End()   
   
return nil

FUNCTION ChangeColor( oSelex )

   local nStep  := 255 / Len( oSelex:aOptions )
   local nColor := nStep * oSelex:nOption
   
   oSelex:aGradIn = { { 1, nRGB( 0, 255, 0 ), nRGB( nColor, 255 - nColor, 0 ) } }
   

return nil

Re: New Class: TSelex

Posted: Sat Dec 04, 2010 3:32 pm
by Daniel Garcia-Gil
We can do

local aItems := { "0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100" }

Code: Select all

   local aItems := { "0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100" }

   ...

   @ 100, 10 SELEX oSelex VAR nOption2 OF oWnd PIXEL SIZE 500, 50;
            GRADIENT INTRACK  { { 1, nRGB( 0, 255, 0 ), nRGB( 0, 255, 0 ) } };
             ITEMS aItems;
             THUMBSIZE 30, 30 ROUNDSIZE 5 ;
             FONT oFont;
             ACTION ChangeColor( oSelex )  

 

Re: New Class: TSelex

Posted: Sat Dec 04, 2010 4:43 pm
by ukoenig
Daniel,
It will be a nice Solution, replacing Radios.
I still have 2 Questions.

1. Maybe also Vertical-direction like used with Sliders ?
2. Adding a Say ( Title ) to the Body ?

Image

Best regards
Uwe :?:

Re: New Class: TSelex

Posted: Sat Dec 04, 2010 4:53 pm
by Daniel Garcia-Gil
Uwe

Vertical mode need more time to developer, maybe to next fivewin version (10.12)

For title i hope have time to this release

Re: New Class: TSelex

Posted: Sat Dec 04, 2010 5:12 pm
by ukoenig
Daniel,

the vertical-display is just a Idea ( more time needed ).
I think for the Title-display, a top-position looks maybe better ?.

Image

Best regards
Uwe :lol:

Re: New Class: TSelex

Posted: Sat Dec 04, 2010 5:45 pm
by Daniel Garcia-Gil
ukoenig wrote:the vertical-display is just a Idea ( more time needed ).
I think for the Title-display, a top-position looks maybe better ?.
customizable :)

Re: New Class: TSelex

Posted: Sat Dec 04, 2010 9:02 pm
by Daniel Garcia-Gil
Uwe

now we can set title with custom position and color

Image

Download Sample HERE

added to command TITLE cTitle [ TOP ] COLORTITLE nColor

Code: Select all

#include "fivewin.ch"
#include "tselex.ch"

function Main()

   local oWnd
   local oSelex, oFont
   local nOption1 := 1
   local nOption2 := 1
   local nOption3 := 6
   local aItems := { "-50", "-40", "-30", "-20", "-10", "0", "10", "20", "30", "40", "50"}
   
   define window oWnd 

   define font oFont Name "Arial Black" size 8, 16      
         

   @ 10, 10 SELEX oSelex VAR nOption2 OF oWnd PIXEL SIZE 500, 65;
            GRADIENT INTRACK  { { 1, nRGB( 0, 255, 0 ), nRGB( 0, 255, 0 ) } };
             ITEMS aItems;
             THUMBSIZE 30, 30 ROUNDSIZE 5 ;
             FONT oFont;
             ACTION ChangeColor( oSelex );
             TITLE "- Values <> + Values" 

   @ 120, 10 SELEX nOption3 OF oWnd PIXEL SIZE 500, 65;
            GRADIENT INTRACK  { { 1/2, nRGB( 0, 0, 255 ), nRGB( 0, 255, 0 ) }, ;
                                  { 1/2, nRGB( 0, 255, 0 ), nRGB( 255, 0, 0 ) } };
             ITEMS aItems;
             THUMBSIZE 30, 30 ROUNDSIZE 5 ;             
             FONT oFont;
             TITLE "- Values <> + Values" TOP;
             COLORTITLE CLR_HCYAN
             
       
   activate window oWnd

   oFont:End()   
   
return nil

FUNCTION ChangeColor( oSelex )

   local nStep  := 255 / Len( oSelex:aOptions )
   local nColor := nStep * oSelex:nOption
   
   oSelex:aGradIn = { { 1, nRGB( 0, 255, 0 ), nRGB( nColor, 255 - nColor, 0 ) } }
   

return nil
 

Re: New Class: TSelex

Posted: Wed Nov 27, 2013 3:51 pm
by mlaffont
Daniel donde puedo descargar el archivo tselec.ch?
Gracias de antemano

Re: New Class: TSelex

Posted: Wed Nov 27, 2013 4:47 pm
by Daniel Garcia-Gil
Hola

viene con la version de fivewin, es una clase que tiene ya tres años en FWH