Cursor get coloreado al editar (Solucionado)

Cursor get coloreado al editar (Solucionado)

Postby ACC69 » Tue Aug 11, 2015 5:33 pm

Hola buenos dias de antemano les envio cordial saludos.

Pues eso, adjunto la imagen

http://s2.subirimagenes.com/otros/previ ... orget2.jpg

Image

En esta imagen en el campo referencia, habra forma de cambiar en ese estado al entrar en edicion, este coloreado en azul y su vez, al editar , borre automaticamente para escribir otra referencia,y asi que muestre en todos los campos gets a editar ...espero haberme explicado ,pero la imagen dice mas que mil palabras lo que quiero hacer ..este es una imagen de muestra de un sistema de compac i contabilidad...

Saludos cordiales.

Atte: Adrian C. C.

acc69@hotmail.com
Last edited by ACC69 on Thu Aug 13, 2015 10:28 pm, edited 1 time in total.
ACC69
 
Posts: 632
Joined: Tue Dec 12, 2006 7:34 pm

Re: Cursor get coloreado al editar

Postby cmsoft » Tue Aug 11, 2015 11:02 pm

Prueba con
Code: Select all  Expand view
oGet:bGotFocus := {|| oGet:SelectAll() }
para cada uno de los gets de tu dialog
User avatar
cmsoft
 
Posts: 1189
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: Cursor get coloreado al editar

Postby Antonio Linares » Wed Aug 12, 2015 8:06 am

Asi puedes hacer que el GET activo cambie automaticamente de color:

SetGetColorFocus( CLR_YELLOW )

revisa FWH\include\colors.ch
regards, saludos

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

Re: Cursor get coloreado al editar

Postby ACC69 » Wed Aug 12, 2015 2:38 pm

Antonio Linares wrote:Asi puedes hacer que el GET activo cambie automaticamente de color:

SetGetColorFocus( CLR_YELLOW )

revisa FWH\include\colors.ch



Hola buenos dias, gracias a ambos por su interes, pruebo y les comento..!

Saludos y buendia.

Atte: Adrian C. C.
acc69@hotmail.com
ACC69
 
Posts: 632
Joined: Tue Dec 12, 2006 7:34 pm

Re: Cursor get coloreado al editar

Postby ACC69 » Wed Aug 12, 2015 4:13 pm

cmsoft wrote:Prueba con
Code: Select all  Expand view
oGet:bGotFocus := {|| oGet:SelectAll() }
para cada uno de los gets de tu dialog



Gracias Ing. cmsfot , funciona de maravilla, era lo que andaba buscando :D :)
Pero ahora tengo un pequeño inconveniente:

REDEFINE GET oG_D[01] VAR cCta ID 105 OF oDlg2 BITMAP "AYUDA" PICT "@K ###################"
REDEFINE GET oG_D[02] VAR nSegNg ID 106 OF oDlg2 BITMAP "AYUDA" PICT "9999" WHEN lAP_SN
REDEFINE GET oG_D[03] VAR cRefe ID 107 OF oDlg2 PICT "@K!"
REDEFINE GET oG_D[04] VAR cObserva ID 108 OF oDlg2 PICT "@K!"
REDEFINE GET oG_D[05] VAR cConcept2 ID 109 OF oDlg2 PICT "@X"
REDEFINE GET oG_D[06] VAR nCarg ID 110 OF oDlg2 PICT "99,999,999.99"
REDEFINE GET oG_D[07] VAR nAbon ID 111 OF oDlg2 PICT "99,999,999.99"

oG_D[01]:bGotFocus := {|| oG_D[01]:SelectAll() } // En cada get funciona bien en cada campo....pero habra otra forma ...!
oG_D[02]:bGotFocus := {|| oG_D[02]:SelectAll() }
oG_D[03]:bGotFocus := {|| oG_D[03]:SelectAll() }


Aqui habra otra forma que tome todo el conttrol sin necesidad de un arreglo For
oG_D:bGotFocus := {|| oG_D:SelectAll() } // Aqui como hacerle para que me tome todos los controles gets...pero me marca error o como evaluarlo

Aqui sin necesidad de un For , ya que tengo varios dialogos con GETS
For nI=1 to 7
oG_D[nI]:bGotFocus := {|| oG_D[nI]:SelectAll() }
Next nI

Gracias Ing. Antonio Linares, pero era lo que mas buscaba en el ejemplo del Ing. cmsoft :) :D tal cual de la imagen de la edicion

Saludos y buen dia.!

Atte: Adrian C. C.
acc69@hotmail.com
ACC69
 
Posts: 632
Joined: Tue Dec 12, 2006 7:34 pm

Re: Cursor get coloreado al editar

Postby hmpaquito » Wed Aug 12, 2015 5:07 pm

Hola, necesita hacer uso del concepto Clipper "detached local", asi:

Code: Select all  Expand view
For nI=1 to 7
   oG_D[nI]:bGotFocus := GenBlock(oG_D, nI)
Next nI

STATIC FUNCTION GenBlock(oG_D, nI)
Local b
b:= {|| oG_D[nI]:SelectAll() }
RETURN b
 


Con esto se arregla.
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: Cursor get coloreado al editar

Postby cnavarro » Wed Aug 12, 2015 5:47 pm

Tambien puedes intentar

Code: Select all  Expand view


For nI=1 to 7
     oG_D[nI]:bGotFocus := { | o | o:SelectAll() }
Next nI

 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Cursor get coloreado al editar

Postby ACC69 » Wed Aug 12, 2015 10:03 pm

cnavarro wrote:Tambien puedes intentar

Code: Select all  Expand view


For nI=1 to 7
     oG_D[nI]:bGotFocus := { | o | o:SelectAll() }
Next nI

 



Hola buenas tardes, gracias a ambos Ing. Cristobal y hmpaquito,pero es lo que trato de evitar, de no usar el For,ya que tengo declarado la variable : oG_D := ARRAY(7) y no estoy haciendo ciclo For ,dentro de los gets,creo que no me queda que hacerlo uno por uno como del ejemplo que puse,o evaluar los gets como eval() ,pero no la busque forma,me marca error ,y si le cambio quitandole :

oG_D[01]
oG_D[02]
oG_D[03] // y dejarlo oG_D Var cuenta..y asi sucesivamente cada variable, me Implica mover todo mi codigo y las validaciones que tengo en todos mis dialogos . :cry:

Saludos y gracias por el interes.!

Atte: Adrian C. C.
acc69@hotmail.com
ACC69
 
Posts: 632
Joined: Tue Dec 12, 2006 7:34 pm

Re: Cursor get coloreado al editar

Postby karinha » Thu Aug 13, 2015 3:16 pm

Code: Select all  Expand view

#include "FiveWin.ch"

function Main()

   local oDlg, IDCOR
   local dDay   := Date()
   local aGet   := ARRAY(5)
   local cName  := [MY NAME]
   local cEnder := [MY ADRESS]
   local cCity  := [MY CITY]
   local cPais  := [MY COUNTRY]

   define dialog oDlg title "From Code" size 300,300

   @ 2,  6 GET aGet[1] VAR dDay   OF oDlg SIZE 60, 10

   @ 3,  6 GET aGet[2] VAR cName  OF oDlg SIZE 60, 10

   @ 4,  6 GET aGet[3] VAR cEnder OF oDlg SIZE 60, 10

   @ 5,  6 GET aGet[4] VAR cCity  OF oDlg SIZE 60, 10

   @ 6,  6 GET aGet[5] VAR cPais  OF oDlg SIZE 60, 10

   For IDCor = 1 To 5

      aGet[IDCOR]:bGotFocus := { | o | o:SelectAll() }

   NEXT

   @ 6,  7 BUTTON "&Ok" OF oDlg SIZE 30, 12 ACTION oDlg:End()
   @ 6, 16 BUTTON "&Cancel" SIZE 30, 12 OF oDlg ACTION oDlg:End() CANCEL

   ACTIVATE DIALOG oDlg CENTERED

return nil
 


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

Re: Cursor get coloreado al editar

Postby ACC69 » Thu Aug 13, 2015 5:11 pm

karinha wrote:
Code: Select all  Expand view

#include "FiveWin.ch"

function Main()

   local oDlg, IDCOR
   local dDay   := Date()
   local aGet   := ARRAY(5)
   local cName  := [MY NAME]
   local cEnder := [MY ADRESS]
   local cCity  := [MY CITY]
   local cPais  := [MY COUNTRY]

   define dialog oDlg title "From Code" size 300,300

   @ 2,  6 GET aGet[1] VAR dDay   OF oDlg SIZE 60, 10

   @ 3,  6 GET aGet[2] VAR cName  OF oDlg SIZE 60, 10

   @ 4,  6 GET aGet[3] VAR cEnder OF oDlg SIZE 60, 10

   @ 5,  6 GET aGet[4] VAR cCity  OF oDlg SIZE 60, 10

   @ 6,  6 GET aGet[5] VAR cPais  OF oDlg SIZE 60, 10

   For IDCor = 1 To 5

      aGet[IDCOR]:bGotFocus := { | o | o:SelectAll() }

   NEXT

   @ 6,  7 BUTTON "&Ok" OF oDlg SIZE 30, 12 ACTION oDlg:End()
   @ 6, 16 BUTTON "&Cancel" SIZE 30, 12 OF oDlg ACTION oDlg:End() CANCEL

   ACTIVATE DIALOG oDlg CENTERED

return nil
 





Hola buenos dias, gracias por tu interes Karinha, pero en el post anterior, mencione que no queria hacer uso de For...Next en cada dialogo que tengo mis gets, pero ya veo que nadie ha buscado ese solucion de evaluar con AEVAL() y tampoco le hallo ya hice un sin fin de pruebas y marca error, y creo que ni tampoco el maestro Antonio Linares, espero alguien mas haya solucionado.

Aunque no me queda de otra que hacerlo esta manera, con For...Next :cry:

Saludos cordiales y buen dia.

Atte: Adrian C. C.
ACC69
 
Posts: 632
Joined: Tue Dec 12, 2006 7:34 pm

Re: Cursor get coloreado al editar

Postby cnavarro » Thu Aug 13, 2015 6:03 pm

Espero haberte entendido

Code: Select all  Expand view

#include "FiveWin.ch"

function Main()
   local oDlg, IDCOR
   local dDay   := Date()
   local aGet   := ARRAY(5)
   local cName  := [MY NAME]
   local cEnder := [MY ADRESS]
   local cCity  := [MY CITY]
   local cPais  := [MY COUNTRY]

  SetGetColorFocus( CLR_YELLOW )

   define dialog oDlg title "From Code" size 300,300
   @ 2,  6 GET aGet[1] VAR dDay   OF oDlg SIZE 60, 10
   @ 3,  6 GET aGet[2] VAR cName  OF oDlg SIZE 60, 10
   @ 4,  6 GET aGet[3] VAR cEnder OF oDlg SIZE 60, 10
   @ 5,  6 GET aGet[4] VAR cCity  OF oDlg SIZE 60, 10
   @ 6,  6 GET aGet[5] VAR cPais  OF oDlg SIZE 60, 10

   GetSelectAll( oDlg )

   @ 6,  7 BUTTON "&Ok" OF oDlg SIZE 30, 12 ACTION oDlg:End()
   @ 6, 16 BUTTON "&Cancel" SIZE 30, 12 OF oDlg ACTION oDlg:End() CANCEL

   ACTIVATE DIALOG oDlg CENTERED

return nil
 
Function GetSelectAll( oDlg )
   AEval( oDlg:aControls, { | o | IF( o:ClassName() = "TGET", ( o:bGotFocus := { | o | o:SelectAll() } ), ) } )  
Return nil

 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Cursor get coloreado al editar

Postby carlos vargas » Thu Aug 13, 2015 8:32 pm

yo modifique tget agregando la data CLASSDATA lSetSel INIT .F., y modificando el metodo gotfocus

Code: Select all  Expand view
 
   CLASSDATA lSetSel    INIT .F.    //NEW CARLOS VARGAS  
   CLASSDATA lDisColors INIT .T. // Use standard disabled colors
   CLASSDATA lClrFocus  INIT .F. // change GET color when focused
 

Code: Select all  Expand view

METHOD GotFocus( hCtlLost ) CLASS TGet

    ::lFocused = .T.

    #ifdef __XHARBOUR__
       ::oGet:VarGet()
    #endif

    if ! Empty( ::cPicture ) .and. ::oGet:Type == "N"
       ::oGet:Picture := StrTran( ::cPicture, ",", "" )
    endif

    if ! ::lDrag
       ::oGet:KillFocus()   // to properly initialize internal status
       ::oGet:SetFocus()
       if Upper( ::oWnd:ClassName() ) == "TCOMBOBOX"
          ::oGet:Buffer := ::oGet:Original
       endif
       if ::lClrFocus
          ::nOldClrPane = ::nClrPane
          ::SetColor( ::nClrText,;
              If( ValType( ::nClrFocus ) == "B", Eval( ::nClrFocus ), ::nClrFocus ) )
       endif
       ::DispText()
       if ::oGet:Type $ "DN" .or. ::oGet:Pos != 1 // 28/06/05 AL
          ::nPos := ::oGet:Pos // 1   28/06/05 AL
       endif
       ::oGet:Pos := ::nPos
       ::SetPos( ::nPos )
       CallWindowProc( ::nOldProc, ::hWnd, WM_SETFOCUS )
       if Set( _SET_INSERT )
          DestroyCaret()
          CreateCaret( ::hWnd, 0, If( ::lChangeCaret, 6, 1 ),;
                       ::nGetChrHeight() - 1 )
          ShowCaret( ::hWnd )
       endif
    else
       HideCaret( ::hWnd )
    endif

    ::Super:GotFocus( hCtlLost )

//NEW CARLOS VARGAS
    if ::lSetSel
       if !Empty( ::cPicture ) .and. "K" $ ::cPicture .and. !::lReadOnly .and. !Empty( ::oGet:Buffer )
          if !( ::oGet:Type = "D" .and. CToD( ::oGet:Buffer ) = CToD( "" ) )
             ::SelectAll()
          endif
       endif
    endif
//END NEW

    if ! Empty( ::oBtn )
       ::oBtn:lCancel := .T.
    endif        

return 0
 


luego en codigo
Code: Select all  Expand view
redefine get .... picture "@K 999,999.99"
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
carlos vargas
 
Posts: 1683
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Cursor get coloreado al editar

Postby ACC69 » Thu Aug 13, 2015 9:43 pm

cnavarro wrote:Espero haberte entendido

Code: Select all  Expand view

#include "FiveWin.ch"

function Main()
   local oDlg, IDCOR
   local dDay   := Date()
   local aGet   := ARRAY(5)
   local cName  := [MY NAME]
   local cEnder := [MY ADRESS]
   local cCity  := [MY CITY]
   local cPais  := [MY COUNTRY]

  SetGetColorFocus( CLR_YELLOW )

   define dialog oDlg title "From Code" size 300,300
   @ 2,  6 GET aGet[1] VAR dDay   OF oDlg SIZE 60, 10
   @ 3,  6 GET aGet[2] VAR cName  OF oDlg SIZE 60, 10
   @ 4,  6 GET aGet[3] VAR cEnder OF oDlg SIZE 60, 10
   @ 5,  6 GET aGet[4] VAR cCity  OF oDlg SIZE 60, 10
   @ 6,  6 GET aGet[5] VAR cPais  OF oDlg SIZE 60, 10

   GetSelectAll( oDlg )

   @ 6,  7 BUTTON "&Ok" OF oDlg SIZE 30, 12 ACTION oDlg:End()
   @ 6, 16 BUTTON "&Cancel" SIZE 30, 12 OF oDlg ACTION oDlg:End() CANCEL

   ACTIVATE DIALOG oDlg CENTERED

return nil
 
Function GetSelectAll( oDlg )
   AEval( oDlg:aControls, { | o | IF( o:ClassName() = "TGET", ( o:bGotFocus := { | o | o:SelectAll() } ), ) } )  
Return nil

 



Hola buenas tardes, gracias Ing. Cristobal, pruebo y le comento el resultado, mas o menos de esa manera queria hacer con Aeval() , pero sin añadir classname y tget y el odlg.
Pruebo y le comento el resultado .

Saludos y gracias.

Atte: Adrian C. C.
ACC69
 
Posts: 632
Joined: Tue Dec 12, 2006 7:34 pm

Re: Cursor get coloreado al editar

Postby cnavarro » Thu Aug 13, 2015 9:52 pm

Adrian, para que pueda ser una function "genérica" aplicable a cualquier dialogo se ha de "filtrar" los controles del dialogo para que solo lo aplique a los Get's, de ahi el ClassName()
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Cursor get coloreado al editar..(Solucionado)

Postby ACC69 » Thu Aug 13, 2015 10:28 pm

cnavarro wrote:Adrian, para que pueda ser una function "genérica" aplicable a cualquier dialogo se ha de "filtrar" los controles del dialogo para que solo lo aplique a los Get's, de ahi el ClassName()



Gracias Ing. Cristobal,funciono de maravilla.. :) agradezco tu ayuda y el tiempo prestado y si tienes razon en lo que mencionas, cosa que no se me paso por la mente .

Gracias de nuevo .

Saludos !
Atte: Adrian C. C.
ACC69
 
Posts: 632
Joined: Tue Dec 12, 2006 7:34 pm

Next

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 93 guests