Switches (switchtst.prg)

Switches (switchtst.prg)

Postby jose_murugosa » Tue Jun 06, 2017 11:28 am

Este prg, al compilarlo me da error tanto en xharbour como en harbour.

Application
===========
Path and name: C:\fwh\samples\switchtst.exe (32 bits)
Size: 3,456,000 bytes
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20161218)
FiveWin version: FWHX 17.04
C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
Windows version: 6.1, Build 7601 Service Pack 1

Time from start: 0 hours 0 mins 0 secs
Error occurred at: 06/06/17, 08:04:01
Error description: Error BASE/1066 Argument error: conditional
Args:
[ 1] = U

Stack Calls
===========
Called from: .\source\classes\TSWITCH.PRG => TSWITCH:NEW( 105 )
Called from: switchtst.prg => MAIN( 44 )
Saludos/Regards,
José Murugosa
FWH + Harbour + Bcc7. Una seda!
User avatar
jose_murugosa
 
Posts: 1143
Joined: Mon Feb 06, 2006 4:28 pm
Location: Uruguay

Re: Switches (switchtst.prg)

Postby Antonio Linares » Wed Jun 07, 2017 2:49 pm

José,

Falta hacer un DEFAULT lOval := .F. en el código

gracias
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41287
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Switches (switchtst.prg)

Postby jose_murugosa » Wed Jun 07, 2017 4:00 pm

No funcionó, yo lo resolví corrigiendo el encabezado de la clase tswitch en switchtst.prg añadiendo los valores loval y lradstyle.

Así funciona perfectamente, añadí al ejemplo que los switches fueran uno no oval, uno oval y uno radstyle:
Code: Select all  Expand view

#include "fivewin.ch"

#xcommand @ <nRow>, <nCol> SWITCH [ <oSw> VAR ] <lVar> ;
             [ PROMPT <cCaption> ] ;
             [ <of:OF, WINDOW, DIALOG> <oWnd> ] ;
             [ SIZE <nWidth>, <nHeight> ] ;
             [ <help:HELPID, HELP ID> <nHelpId> ] ;
             [ FONT <oFont> ] ;
             [ <change: ON CLICK, ON CHANGE> <uClick> ] ;
             [ VALID   <ValidFunc> ] ;
             [ <color: COLOR, COLORS> <nClrFore> [,<nClrBack>] ] ;
             [ <design: DESIGN> ] ;
             [ <pixel: PIXEL> ] ;
             [ MESSAGE <cMsg> ] ;
             [ <update: UPDATE> ] ;
             [ WHEN <WhenFunc> ] ;
             [ BORDERSIZE <nBorderSize> ] [ BORDERCOLOR <nClrBorder> ] ;
             [ THUMBSIZE  <nThumbSize>  ] [ THUMBCOLOR  <nClrThumb> ] ;
           [ RADSTYLE  <lRadStyle>  ] [ OVAL  <lOval> ];           
      => ;
         [ <oSw> := ] TSwitch():New( <nRow>, <nCol>, <cCaption>,;
             bSETGET(<lVar>), <oWnd>, <nWidth>, <nHeight>, <nHelpId>,;
             [<{uClick}>], <oFont>, <{ValidFunc}>, <nClrFore>, <nClrBack>,;
             <.design.>, <.pixel.>, <cMsg>, <.update.>, <{WhenFunc}>, ;
             <nBorderSize>, <nClrBorder>, <nThumbSize>, <nClrThumb>, <lRadStyle>, <lOval> )

function Main()

   local oWnd, oFont
   local lVar1, lVar2, lVar3
   local oYn1, oYn2, oYn3, oSay1, oSay2, oSay3

   lVar1 := lVar2 := lVar3 := .t.

   

   DEFINE FONT oFont NAME "Segoe UI Light" SIZE 0,-18 BOLD

   DEFINE WINDOW oWnd COLOR CLR_GRAY,CLR_WHITE
   oWnd:SetFont( oFont )
//   oWnd:nOpacity := 140

   @  98, 40 SAY oSay1 PROMPT If( lVar1, 'On', 'Off' ) SIZE 60,30 PIXEL OF oWnd UPDATE

   @ 100,207 SWITCH oYn1 VAR lVar1 OVAL .f. PIXEL OF oWnd UPDATE ;
      COLOR CLR_GREEN, CLR_GRAY ;
      ON CHANGE oWnd:Update()

   @ 128, 40 SAY oSay2 PROMPT If( lVar2, 'On', 'Off' ) SIZE 60,30 PIXEL OF oWnd UPDATE

   @ 130,207 SWITCH oYn2 VAR lVar2 OVAL .t. PIXEL OF oWnd UPDATE ;
      COLOR CLR_GREEN, CLR_GRAY ;
      THUMBSIZE 16 THUMBCOLOR CLR_BLUE ;
      ON CHANGE oWnd:Update()

   @ 158, 40 SAY oSay3 PROMPT If( lVar3, 'On', 'Off' ) SIZE 60,30 PIXEL OF oWnd UPDATE

   @ 160,207 SWITCH oYn3 VAR lVar3 OVAL .f. RADSTYLE .t.PIXEL OF oWnd UPDATE ;
      ON CHANGE oWnd:Update()                                                   //con radstyle oval debe ser .f.
   
   ACTIVATE WINDOW oWnd
   RELEASE FONT oFont

return nil

 


Quizá sería conveniente corregir este cabezal para próximas versiones y añadirlo a fivewin.ch o a un "switch.ch", eso lo dejo a vuestro criterio :).
Saludos/Regards,
José Murugosa
FWH + Harbour + Bcc7. Una seda!
User avatar
jose_murugosa
 
Posts: 1143
Joined: Mon Feb 06, 2006 4:28 pm
Location: Uruguay

Re: Switches (switchtst.prg)

Postby joseluisysturiz » Wed Jun 07, 2017 4:21 pm

Saludos, disculpa mi ignorancia, podrias dar una idea de su utilidad.? gracias, saludos... :shock:
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: Switches (switchtst.prg)

Postby jose_murugosa » Wed Jun 07, 2017 5:28 pm

Image

Son los switches tipo Android :)
El primero es en formato rectangular (no oval) en off, el segundo es de tipo oval en on, y el tercero es tipo Radio en on en la imagen, es el resultado del código que está más arriba.
Saludos/Regards,
José Murugosa
FWH + Harbour + Bcc7. Una seda!
User avatar
jose_murugosa
 
Posts: 1143
Joined: Mon Feb 06, 2006 4:28 pm
Location: Uruguay

Re: Switches (switchtst.prg)

Postby karinha » Wed Jun 07, 2017 5:31 pm

En que momento se podrá usar?

Image

??????????
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7187
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Switches (switchtst.prg)

Postby jose_murugosa » Thu Jun 08, 2017 9:56 am

Karinha,

No entendí tu pregunta..

Es una opción de diferente estética a los checkboxes, disponible en las últimas versiones de fivewin.
Saludos/Regards,
José Murugosa
FWH + Harbour + Bcc7. Una seda!
User avatar
jose_murugosa
 
Posts: 1143
Joined: Mon Feb 06, 2006 4:28 pm
Location: Uruguay

Re: Switches (switchtst.prg)

Postby karinha » Thu Jun 08, 2017 12:54 pm

Gracias José. Me parece, que este modelo sigue siendo un poco primitivo. No me gustó. Creo que tiene que ser mejorado.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7187
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Switches (switchtst.prg)

Postby joseluisysturiz » Thu Jun 08, 2017 2:57 pm

Jose, gracias por tu explicacion e idea, "entre gustos y colores", siempre es bueno salir de la rutina y tener opciones y asi no existe monopolio, pero de verdad crei seria para algo "diferente", igual de mi parte te felicito y agradezco tu aporte, pero para mi es como mezclar naranjas con cebollas, me gusta mas el stylo original de los checkbox, para que inventar la rueda.?, gracias, saludos... :shock:
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: Switches (switchtst.prg)

Postby jose_murugosa » Thu Jun 08, 2017 3:06 pm

Totalmente valido estimado. :-)
Saludos/Regards,
José Murugosa
FWH + Harbour + Bcc7. Una seda!
User avatar
jose_murugosa
 
Posts: 1143
Joined: Mon Feb 06, 2006 4:28 pm
Location: Uruguay

Re: Switches (switchtst.prg)

Postby nageswaragunupudi » Fri Jun 09, 2017 10:41 am

The command translate in fivewin.ch is the correct one.
Just remove the xcommand inside the sample program.

This is the revised sample switchtst.prg
Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local oWnd, oFont
   local lVar1, lVar2, lVar3
   local oYn1, oYn2, oYn3, oSay1, oSay2, oSay3

   lVar1 := lVar2 := lVar3 := .t.

   DEFINE FONT oFont NAME "Segoe UI Light" SIZE 0,-18 BOLD

   DEFINE WINDOW oWnd COLOR CLR_GRAY,CLR_WHITE
   oWnd:SetFont( oFont )
//   oWnd:nOpacity := 140

   @  98, 40 SAY oSay1 PROMPT If( lVar1, 'On', 'Off' ) SIZE 60,30 PIXEL OF oWnd UPDATE

   @ 100,207 SWITCH oYn1 VAR lVar1 PIXEL OF oWnd UPDATE ;
      COLOR CLR_GREEN, CLR_GRAY ;
      ON CHANGE oWnd:Update()

   @ 128, 40 SAY oSay2 PROMPT If( lVar2, 'On', 'Off' ) SIZE 60,30 PIXEL OF oWnd UPDATE

   @ 130,207 SWITCH oYn2 VAR lVar2 PIXEL OF oWnd UPDATE OVALSTYLE ;
      COLOR CLR_GREEN, CLR_GRAY ;
      THUMBSIZE 16 THUMBCOLOR CLR_BLUE ;
      ON CHANGE oWnd:Update()

   @ 158, 40 SAY oSay3 PROMPT If( lVar3, 'On', 'Off' ) SIZE 60,30 PIXEL OF oWnd UPDATE

   @ 160,207 SWITCH oYn3 VAR lVar3  PIXEL OF oWnd UPDATE RADIOSTYLE ;
      ON CHANGE oWnd:Update()

   ACTIVATE WINDOW oWnd
   RELEASE FONT oFont

return nil
 

Rectangular and Oval styles are used in Windows 8.1 and 10.
Not only in Android.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10242
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Switches (switchtst.prg)

Postby karinha » Fri Jun 09, 2017 1:49 pm

Very good mister Nages, thanks.

Image

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7187
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 23 guests

cron