FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Refrescar Say en un Tpanel
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Refrescar Say en un Tpanel
Posted: 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 (fw): Select all Collapse
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
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Refrescar Say en un Tpanel
Posted: Fri Dec 07, 2018 11:35 PM
Prueba asi
Code (fw): Select all Collapse
oPanel:aControls[ 1 ]:Refresh()


o

Code (fw): Select all Collapse
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
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: Refrescar Say en un Tpanel
Posted: Sat Dec 08, 2018 02: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
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: Refrescar Say en un Tpanel
Posted: Sat Dec 08, 2018 02: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 (fw): Select all Collapse
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

Continue the discussion