Page 1 of 1
Cambiar imágenes en Grid
Posted: Sun Jul 15, 2012 4:56 pm
by arroya2
Hola amigos.
Las imágines de este GRID dependen de si lSelec es verdadero o falso.
Lo que necesito es que, si el valor de lSelec cambia, lo haga tambien su imagen correspondiente.
Code: Select all
@ 10, 10 GRID Grid_1 OF wTablaAviso ;
WIDTH 800 ;
HEIGHT 301 ;
HEADERS { '', 'Nombre y Apellidos' } ;
WIDTHS { 0, 760 } ;
ROWSOURCE 'Clientes' ;
COLUMNFIELDS { 'Clientes->lSelec', 'Rtrim(Clientes->Nombre)+" "+Rtrim(Clientes->Apellidos)' } ;
FONT 'Arial' ;
SIZE 14 ;
IMAGE {'Led_On', 'Nada'}
¿Cómo lo puedo hacer?
Gracias
Rafael Pérez
Translated by Google:
Hello friends.
The images from this GRID lSelec depend on whether true or false.
What I need is that if the value of lSelec changes, it does also its corresponding image.
Code: Select all
@ 10, 10 GRID Grid_1 OF wTablaAviso ;
WIDTH 800 ;
HEIGHT 301 ;
HEADERS { '', 'Nombre y Apellidos' } ;
WIDTHS { 0, 760 } ;
ROWSOURCE 'Clientes' ;
COLUMNFIELDS { 'Clientes->lSelec', 'Rtrim(Clientes->Nombre)+" "+Rtrim(Clientes->Apellidos)' } ;
FONT 'Arial' ;
SIZE 14 ;
IMAGE {'Led_On', 'Nada'}
How I can do?
Thanks
Rafael Perez
Re: Cambiar imágenes en Grid
Posted: Sun Jul 15, 2012 7:13 pm
by IMATECH
Hi !
To work as espected,
All array image names need a valid image resource...
file.rc
Code: Select all
Led_On BITMAP ..\Res\Led_On.bmp
Nada BITMAP ..\Res\Blank_image.bmp
Re: Cambiar imágenes en Grid
Posted: Sun Jul 15, 2012 7:51 pm
by arroya2
Hola M., Ronaldo eso lo tengo bien, te muestro el código:
Code: Select all
// Using a resource file like this, you can include bitmaps, icons and sounds
// inside EXE.
//
// Resource Resource Resource
// name Type FileName
//
Led_On BITMAP \Iconos\Led_On.bmp
Nada BITMAP \Iconos\Nada.bmp
Add ICON \Iconos\Add.ico
First ICON \Iconos\First.ico
Last ICON \Iconos\Last.ico
Left ICON \Iconos\Left.ico
Right ICON \Iconos\Right.ico
F01 ICON \Iconos\F01.ico
F02 ICON \Iconos\F02.ico
F03 ICON \Iconos\F03.ico
F04 ICON \Iconos\F04.ico
F05 ICON \Iconos\F05.ico
F06 ICON \Iconos\F06.ico
F07 ICON \Iconos\F07.ico
F08 ICON \Iconos\F08.ico
F09 ICON \Iconos\F09.ico
F10 ICON \Iconos\F10.ico
F11 ICON \Iconos\F11.ico
F12 ICON \Iconos\F12.ico
Al ejecutar el programa, cuando se crea el GRID las imágenes se cargan correctamente para cada registro según el valor de lSelec. Posteriormente si se cambia el valor de lSelec, las imágenes que se cargaron al principio no cambian. Si lSelec:=.F. la imagen debe ser 'Led-On', si lSelec:=.T. la imagen debe ser 'Nada'
Resumiendo las imágenes se cargan correctamente en la creación del GRID, pero si cambio el valor de lSelec en cualquier registro, la imagen permanece sin cambiar.
Me imagino que se debe incluir en las propiedades del GRID alguna función o procedimiento en 'ON CHANGE', ¿pero cómo?
Saludos
Rafael Pérez
Translated by Google:
Hi M., Ronaldo. I have it so good, I show the code:
Code: Select all
Led_On BITMAP \Iconos\Led_On.bmp
Nada BITMAP \Iconos\Nada.bmp
Add ICON \Iconos\Add.ico
First ICON \Iconos\First.ico
Last ICON \Iconos\Last.ico
Left ICON \Iconos\Left.ico
Right ICON \Iconos\Right.ico
F01 ICON \Iconos\F01.ico
F02 ICON \Iconos\F02.ico
F03 ICON \Iconos\F03.ico
F04 ICON \Iconos\F04.ico
F05 ICON \Iconos\F05.ico
F06 ICON \Iconos\F06.ico
F07 ICON \Iconos\F07.ico
F08 ICON \Iconos\F08.ico
F09 ICON \Iconos\F09.ico
F10 ICON \Iconos\F10.ico
F11 ICON \Iconos\F11.ico
F12 ICON \Iconos\F12.ico
When you run the program, when you create the images load GRID correctly for each record based on the value of lSelec. Then if you change the value of lSelec, images that were loaded at first change. If lSelec: =. F. the image must be 'Led-On', if lSelec: =. T. the image must be 'Nada'
In short: the images are loaded correctly in the creation of GRID, but if I change the value of lSelec in any record, the image remains unchanged.
I imagine that must be included in the properties of a function or procedure GRID 'ON CHANGE', but how?
Regards
Rafael Perez
Re: Cambiar imágenes en Grid
Posted: Sun Jul 15, 2012 9:19 pm
by IMATECH
Yes: in ON CHANGE event you have to set Column 1 to [0,1]
or try to use
Code: Select all
...
ON CHANGE { || This.Refresh() }
...
Can you post the code for Grid Create and AddItems ?
Regards
Re: Cambiar imágenes en Grid
Posted: Mon Jul 16, 2012 9:01 pm
by arroya2
Chacal.GO wrote:
Yes: in ON CHANGE event you have to set Column 1 to [0,1]
or try to use
Code: Select all
...
ON CHANGE { || This.Refresh() }
...
Can you post the code for Grid Create and AddItems ?
Regards
Gracias.
El siguiente archivo contiene el Programa que no funciona:
Saludos
Rafael Pérez
Translated by Google:
Thank you.
The following file contains the program does not work:
Regards
Rafael Perez
Re: Cambiar imágenes en Grid
Posted: Mon Jul 16, 2012 10:44 pm
by IMATECH
Let's try again:
Code: Select all
DEFINE GRID Grid_1
ROW 10
COL 10
WIDTH 400
HEIGHT 300
HEADERS {'...','Nombre y Apellidos', 'Status' }
WIDTHS { 20, 300, 70}
VALUE { 1, 1 }
IMAGE { 'Led_On.Bmp' ,'Led_Off.Bmp' }
JUSTIFY { GRID_JTFY_LEFT, GRID_JTFY_LEFT, GRID_JTFY_LEFT }
FONTCOLOR {0,0,255}
ONDBLCLICK SelecDes()
MULTISELECT .F.
ROWSOURCE 'Test'
COLUMNFIELDS { 'IIF(Test->Married,1,0)', 'Rtrim(Test->First)+" - "+Rtrim(Test->Last)', 'IIF(Test->Married,"Si","No")' }
END GRID
Add after any table data change
SelecDes(),SelecTodos() and DesSelecTodos()
wTablaAviso.Grid_1.Refresh()
Regards
Re: Cambiar imágenes en Grid
Posted: Tue Jul 17, 2012 7:34 am
by arroya2
M. Ronaldo thank you very much, everything is solved.
Regards
Rafael Perez