Refrescar Say en un Tpanel

Refrescar Say en un Tpanel

Postby FranciscoA » Fri Dec 07, 2018 11:04 pm

Eso, amigos.
Cual es la forma de refrescar un Tsay que está contenido en un TPanel (que contiene otros controles), en un dialogo de recursos?
Es decir, desde un xBrowse, al cambiar posicion , refrescar el say con el valor de x columna del browse.
Algo asi (ej tomado del foro y modificado:
Code: Select all  Expand view
Function MyPanel()
   local oDlg, oPanel
   local oBrw, c1, oSay

   DBUSEAREA(.T.,,"STATES","STATES",.T.)

   DEFINE DIALOG oDlg SIZE 600,600 PIXEL

   @ 140,20 XBROWSE oBrw OF oDlg PIXEL ;
            SIZE 150, 150 ;
            AUTOCOLS ;
            DATASOURCE "STATES"

   oBrw:CreateFromCode()

   c1 := oBrw:aCols[2]:Value
   oBrw:bChange := {|| c1 := oBrw:aCols[2]:Value, oPanel:Refresh() }

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT ( oPanel := CreatePanel( oDlg,@c1,oSay,.t. ) )

   STATES->(DBCLOSEAREA())
return nil

//--------------------------------------//
function CreatePanel( oDlg, c1, oSay )
   local oPanel
   local aGrad  := { { 1, RGB( 216, 230, 238 ), RGB( 103, 154, 194 ) } }
   //local c1    := "Hello World       "
   local c2    := Space( 100 )

   oPanel := TPanel():New( 050,050,250,550,oDlg )
   oPanel:Gradient( aGrad )
   oPanel:bPainted := { || oPanel:Box( 1,1,oPanel:nHeight-1,oPanel:nWidth-1 ) }  //Con borde

   @ 40,20 SAY oSay VAR c1 SIZE 200,24 PIXEL OF oPanel
   @ 80,20 GET c2 SIZE 200,24 PIXEL OF oPanel

return oPanel
 

Gracias.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2114
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: Refrescar Say en un Tpanel

Postby cnavarro » Fri Dec 07, 2018 11:35 pm

Prueba asi
Code: Select all  Expand view

oPanel:aControls[ 1 ]:Refresh()
 


o

Code: Select all  Expand view

AEVal( oPanel:aControls, { | o | o:Refresh() } )
 
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: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Refrescar Say en un Tpanel

Postby FranciscoA » Sat Dec 08, 2018 2:45 pm

Cristobal, gracias por contestar.
Ya lo habia intentado de la primera forma.
No hubo ninguna diferencia. No se refresca el tpanel.
Algún otro modo?
Gracias.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2114
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: Refrescar Say en un Tpanel

Postby FranciscoA » Sat Dec 08, 2018 2:58 pm

Cristobal.
Parece que tu atencióm y el aire fresco de la mañana me dieron la luz, después de muuuuuchas horas.
Era colocar la variable c1 como estática en el prg principal. A veces nos ahogamos en un vaso de agua.

Code: Select all  Expand view
STATIC c1    //esto era la solucion

//----------------------------------------------//
Function MyPanel()
   local oDlg, oPanel
   local oBrw

   DBUSEAREA(.T.,,"STATES","STATES",.T.)

   DEFINE DIALOG oDlg SIZE 600,600 PIXEL

   @ 140,20 XBROWSE oBrw OF oDlg PIXEL ;
            SIZE 150, 150 ;
            AUTOCOLS ;
            DATASOURCE "STATES"

   oBrw:CreateFromCode()

   c1 := oBrw:aCols[2]:Value
   oBrw:bChange := {|| c1 := oBrw:aCols[2]:Value, AEVal( oPanel:aControls, { | o | o:Refresh() } ) }


   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT ( oPanel := CreatePanel( oDlg ) )

   STATES->(DBCLOSEAREA())
return nil

//--------------------------------------//
function CreatePanel( oDlg )
   local oPanel, oDlg
   local aGrad  := { { 1, RGB( 216, 230, 238 ), RGB( 103, 154, 194 ) } }
   //local c1    := "Hello World       "    //static
   local c2    := Space( 100 )

   oPanel := TPanel():New( 050,050,250,550,oDlg )
   oPanel:Gradient( aGrad )
   oPanel:bPainted := { || oPanel:Box( 1,1,oPanel:nHeight-1,oPanel:nWidth-1 ) }  //Con borde

   @ 40,20 SAY oSay VAR c1 SIZE 200,24 PIXEL OF oPanel
   @ 80,20 GET c2 SIZE 200,24 PIXEL OF oPanel

return oPanel
 


Gracias.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2114
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.


Return to FiveWin para Harbour/xHarbour

Who is online

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