FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Actualizar xBrowse con un Clic del rat贸n?
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Re: Actualizar xBrowse con un Clic del rat贸n?
Posted: Sat Aug 19, 2023 12:52 PM
Gracias por su tiempo Mr. Rao
Esto solucion贸 el error en tiempo de ejecucion
return IfNil( cContents, "" )
local cDefault := MEMOREAD( "c:\fwh\bitmaps\sea.bmp" )

AEval( aCols, { |a,i| a[ 4 ] := WebPageContents( a[ 4 ] ), ;
If( Empty( a[ 4 ] ), a[ 4 ] := cDefault, nil ) } )
Esto muestra solamente la primer foto faltante, pero si hay muchas, las otras no las muestra
Pruebe este ejemplo:
Code (fw): Select all Collapse
#include "Fivewin.ch"
#include "xbrowse.ch"
FUNCTION cmsoft()
LOCAL oDlg1, oBrwTmp,;
聽 聽 聽 aCols := {;
{'VIRTUOSA CLASICA', 聽1900.00, 'Carne 120 grs. Cheddar, Lechuga, Tomate y Mayonesa, Mostaza y K茅tchup. Incluye Papas Fritas.','https://bcnresto.com/img/000010/00010110.jpg'},;
{'VIRTUOSA CLASICA 2', 聽1900.00, 'Carne 120 grs. Cheddar, Lechuga, Tomate y Mayonesa, Mostaza y K茅tchup. Incluye Papas Fritas.','https://bcnresto.com/img/000010/00010114.jpg'},;
{'VIRTUOSA MIX', 聽1900.00, 'Carne 120 grs. Cheddar, Huevo Bacon y BBQ. Incluye Papas Fritas.','https://bcnresto.com/img/000010/00000020.jpg'},;
{'VIRTUOSA CHEESE ONION', 1900.00, 'Carne 120 grs. Cheddar, Cebolla Caramelizada Bacon y BBQ. Incluye Papas Fritas.','https://bcnresto.com/img/000010/00000021.jpg'},;
{'VIRTUOSA MEGA', 1900.00, 'Carne 120grs. Cheddar, lechuga, pepinos, cebolla picada y salsa mil islas. Incluye papas fritas.','https://bcnresto.com/img/000010/00000022.jpg'},;
{'VIRTUOSA NAPO', 1900.00, 'Carne 120 grs. Jam贸n, Queso, Tomate y Mayonesa. Incluye Papas Fritas.','https://bcnresto.com/img/000010/00000023.jpg'},;
{'BRAHMA 1 L.', 300.00 , 'Bien fria','https://bcnresto.com/img/000010/00000054.jpg'},;
{'BRAHMA 2 L.', 400.00 , 'Bien fria','https://bcnresto.com/img/000010/00000055.jpg'},;
{'BRAHMA 3 L.', 500.00 , 'Bien fria','https://bcnresto.com/img/000010/00000056.jpg'},;
{'BRAHMA 4 L.', 600.00 , 'Bien fria','https://bcnresto.com/img/000010/00000057.jpg'},;
{'BRAHMA 5 L.', 700.00 , 'Bien fria','https://bcnresto.com/img/000010/00000058.jpg'},;
{'BRAHMA 6 L.', 800.00 , 'Bien fria','https://bcnresto.com/img/000010/00000059.jpg'};
}
聽 聽local cDefault := MEMOREAD( "c:\fwh21\bitmaps\sea.bmp" )

聽 聽AEval( aCols, { |a,i| a[ 4 ] := WebPageContents( a[ 4 ] ), ;
聽 聽 聽 聽 聽 聽 聽 聽 聽If( Empty( a[ 4 ] ), a[ 4 ] := cDefault, nil ) } )

DEFINE DIALOG oDlg1 TITLE "Visor de productos" SIZE 700,700 PIXEL TRUEPIXEL RESIZABLE
聽 聽@ 20, 20 XBROWSE oBrwTmp SIZE -20,-20 pixel OF oDlg1 ARRAY aCols 聽;
聽 聽 聽 HEADERS "Producto", "Precio", "Descripcion","Foto";
聽 聽 聽 COLUMNS 1,2,3,4;
聽 聽 聽 SIZES nil, nil, 150,200;
聽 聽 聽 CELL LINES NOBORDER
聽 聽WITH OBJECT oBrwTmp
聽 聽 聽 :nStretchCol 聽 := 3
聽 聽 聽 :nRowHeight 聽 聽:= 150
聽 聽 聽 :aCols[4]:cDataType := "P"
聽 聽 聽 :CreateFromCode()
聽 聽END
ACTIVATE DIALOG oDlg1 CENTERED
RETURN nil
Tambien, ya que en realidad los datos los obtengo de una consulta sql, en caso de usar DATASOURCE en lugar de ARRAY habia intentado esto
Code (fw): Select all Collapse
:aCols[4]:bStrData := {|| IF(EMPTY(WebPageContents( oQry:url, .f. )),MemoRead(".\logo.jpg"),WebPageContents(oQry:url,.f.)) 聽}
Y obtenia el mismo efecto, solo mostraba en la primer imagen faltante
Por que puede ser?
Agradezco su interes en el tema
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Actualizar xBrowse con un Clic del rat贸n?
Posted: Sat Aug 19, 2023 01:22 PM
This shows only the first missing photo, but if there are too many, it doesn't show the others.
But here it is working fine.
I got the default image in all cases.

I extended the array like this:
Code (fw): Select all Collapse
{'VIRTUOSA NAPO', 1900.00, 'Carne 120 grs. Jam贸n, Queso, Tomate y Mayonesa. Incluye Papas Fritas.','https://bcnresto.com/img/000010/00000023.jpg'},;
{'BRAHMA 1 L.', 300.00 , 'Bien fria','https://bcnresto.com/img/000010/00000054.jpg'}, ;
{'BRAHMA 2 L.', 500.00 , 'Bien fria','https://bcnresto.com/img/000010/00000054.jpg'}, ;
{'BRAHMA 3 L.', 600.00 , 'Bien fria','https://bcnresto.com/img/000010/00000054.jpg'}, ;
{'BRAHMA 4 L.', 700.00 , 'Bien fria','https://bcnresto.com/img/000010/00000054.jpg'};
}
I see the default image in all the 4 last rows.



Wondering why is not working for you.
May I know your FWH version? Let me check with your version at my end.
Regards



G. N. Rao.

Hyderabad, India
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Re: Actualizar xBrowse con un Clic del rat贸n?
Posted: Sat Aug 19, 2023 01:37 PM

Compiler version: Harbour 3.2.0dev (r2008190002)

FiveWin version: FWH 22.06

C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)

Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Re: Actualizar xBrowse con un Clic del rat贸n?
Posted: Sat Aug 19, 2023 01:49 PM
Mr. Rao:
I extended the array like this:
En la extension del array puso siempre la misma url
Cambie por
Code (fw): Select all Collapse
 聽 聽 聽aCols := {;
{'VIRTUOSA CLASICA', 聽1900.00, 'Carne 120 grs. Cheddar, Lechuga, Tomate y Mayonesa, Mostaza y K茅tchup. Incluye Papas Fritas.','https://bcnresto.com/img/000010/00010110.jpg'},;
{'VIRTUOSA CLASICA 2', 聽1900.00, 'Carne 120 grs. Cheddar, Lechuga, Tomate y Mayonesa, Mostaza y K茅tchup. Incluye Papas Fritas.','https://bcnresto.com/img/000010/00010114.jpg'},;
{'VIRTUOSA MIX', 聽1900.00, 'Carne 120 grs. Cheddar, Huevo Bacon y BBQ. Incluye Papas Fritas.','https://bcnresto.com/img/000010/00000020.jpg'},;
{'VIRTUOSA CHEESE ONION', 1900.00, 'Carne 120 grs. Cheddar, Cebolla Caramelizada Bacon y BBQ. Incluye Papas Fritas.','https://bcnresto.com/img/000010/00000021.jpg'},;
{'VIRTUOSA MEGA', 1900.00, 'Carne 120grs. Cheddar, lechuga, pepinos, cebolla picada y salsa mil islas. Incluye papas fritas.','https://bcnresto.com/img/000010/00000022.jpg'},;
{'VIRTUOSA NAPO', 1900.00, 'Carne 120 grs. Jam贸n, Queso, Tomate y Mayonesa. Incluye Papas Fritas.','https://bcnresto.com/img/000010/00000023.jpg'},;
{'BRAHMA 1 L.', 300.00 , 'Bien fria','https://bcnresto.com/img/000010/00000054.jpg'},;
{'BRAHMA 2 L.', 400.00 , 'Bien fria','https://bcnresto.com/img/000010/00000055.jpg'},;
{'BRAHMA 3 L.', 500.00 , 'Bien fria','https://bcnresto.com/img/000010/00000056.jpg'},;
{'BRAHMA 4 L.', 600.00 , 'Bien fria','https://bcnresto.com/img/000010/00000057.jpg'},;
{'BRAHMA 5 L.', 700.00 , 'Bien fria','https://bcnresto.com/img/000010/00000058.jpg'},;
{'BRAHMA 6 L.', 800.00 , 'Bien fria','https://bcnresto.com/img/000010/00000059.jpg'};
}
El error fue mio al copiar y pegar las urls
Puede decirme si esto le muestra todas las imagenes por default?
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Actualizar xBrowse con un Clic del rat贸n?
Posted: Sat Aug 19, 2023 02:45 PM
You are right.

Please use this:
Code (fw): Select all Collapse
 聽 AEval( aCols, { |a,i| a[ 4 ] := WebPageContents( a[ 4 ], .f. ), ;
聽 聽 聽 聽 聽 聽 聽 聽 聽If( IsBinaryData( a[ 4 ] ), nil, a[ 4 ] := cDefault ) } )
Regards



G. N. Rao.

Hyderabad, India
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Re: Actualizar xBrowse con un Clic del rat贸n?
Posted: Sat Aug 19, 2023 03:03 PM
Excelente Mr. Rao!!
Ahora si funciona perfecto!
Aprovechando la sugerencia, tambi茅n hice para el caso de que quiera leer directamente desde la Query
Code (fw): Select all Collapse
:aCols[4]:bStrData := {|| IF(!IsBinaryData(WebPageContents( oQry:url, .f. )),;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽MemoRead(".\logo.jpg"),WebPageContents(oQry:url,.f.)) 聽}
Y tambien funcion贸 perfecto!
Si bien, funciona, si quiero hacer un oBrw:Report() luego, no pone las imagenes de los url vacios
Si funciona perfecto si lo hago desde array.
Pero seguire investigando para ver como poder hacerlo.
Muchas gracias por el tiempo dedicado!
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Actualizar xBrowse con un Clic del rat贸n?
Posted: Tue Aug 22, 2023 02:46 AM
Please try this code as it is and then modify to Dolphin
You need to change the default image to your default image in this sample.
Code (fw): Select all Collapse
FUNCTION cmsoft()

聽 聽local oDlg, oBrw
聽 聽local cDefault
聽 聽local oCn, oRs

聽 聽local hImages

聽 聽oCn 聽 := maria_Connect( "208.91.198.197:3306,fwhdemo,gnraofwh,Bharat@1950", .t. )
聽 聽if oCn == nil
聽 聽 聽 ? "can not connect to server"
聽 聽 聽 return nil
聽 聽endif

聽 聽oRs 聽 := oCn:cmsoft_images

聽 聽cDefault := MEMOREAD( "c:\fwh\bitmaps\sea.bmp" )
聽 聽cDefault := cValToChar( FW_ReadImage( nil, cDefault )[ 1 ] )

聽 聽MsgRun( "Reading", "Images", { || hImages := ReadImages( oRs, cDefault ) } )

聽 聽DEFINE DIALOG oDlg TITLE "Visor de productos" SIZE 700,730 PIXEL TRUEPIXEL RESIZABLE

聽 聽@ 50, 20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
聽 聽 聽 DATASOURCE oRs 聽;
聽 聽 聽 COLUMNS "Producto", "Precio", "Descripcion","Foto";
聽 聽 聽 HEADERS nil, nil, nil, "Foto" ;
聽 聽 聽 SIZES nil, nil, 150,200;
聽 聽 聽 CELL LINES NOBORDER

聽 聽WITH OBJECT oBrw
聽 聽 聽 :nStretchCol 聽 := 3
聽 聽 聽 :nRowHeight 聽 聽:= 150
聽 聽 聽 WITH OBJECT :aCols[4]
聽 聽 聽 聽 聽:cDataType := "P"
聽 聽 聽 聽 聽:bEditValue := { || hImages[ oRs:foto ] }
聽 聽 聽 END
聽 聽 聽 :CreateFromCode()
聽 聽END

聽 聽@ 10,20 BUTTON "REPORT" SIZE 100,30 PIXEL OF oDlg ACTION oBrw:Report()

聽 聽ACTIVATE DIALOG oDlg CENTERED

聽 聽oRs:Close()
聽 聽oCn:Close()

聽 聽PalBmpFree( Val( cDefault ) )
聽 聽HEval( hImages, { |k,v| PalBmpFree( Val( v ) ) } )

RETURN nil

static function ReadImages( oRs, cDefault )

聽 聽local hImages, c, n, nRecs

聽 聽nRecs := oRs:RecCount()
聽 聽oRs:GoTop()

聽 聽hImages 聽:= {=>}
聽 聽for n := 1 to nRecs
聽 聽 聽 c 聽:= WebPageContents( oRs:foto )
聽 聽 聽 if IsBinaryData( c )
聽 聽 聽 聽 聽hImages[ oRs:foto ] := cValToChar( FW_ReadImage( nil, c )[ 1 ] )
聽 聽 聽 else
聽 聽 聽 聽 聽hImages[ oRs:foto ] := cDefault
聽 聽 聽 endif
聽 聽 聽 oRs:Skip()
聽 聽next
聽 聽oRs:GoTop()

return hImages
Click on "REPORT" button on the top to generate report
Regards



G. N. Rao.

Hyderabad, India
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Re: Actualizar xBrowse con un Clic del rat贸n?
Posted: Tue Aug 22, 2023 11:33 AM

Excelente Mr. Rao!

Funcion贸 perfecto!

Muchas gracias por su tiempo!

Continue the discussion