galería de imágenes

Re: galería de imágenes

Postby José Luis Sánchez » Tue Jan 19, 2021 5:40 pm

Antonio, this is the error.log

Application
===========
Path and name: C:\alanit\develop\bitacora\bitacora.exe (32 bits)
Size: 5,786,624 bytes
Compiler version: Harbour 3.2.0dev (r1904111533)
FiveWin version: FWH 19.05
C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
Windows version: 6.2, Build 9200

Time from start: 0 hours 0 mins 6 secs
Error occurred at: 19-01-2021, 18:39:03
Error description: Error BASE/1004 No existe el m‚todo: CENTER
Args:
[ 1] = U
[ 2] = O TWINDOW

Stack Calls
===========
Called from: ..\contrib\hbct\ctmisc.prg => CENTER( 0 )
Called from: .\prg\fwh\TALBUM.PRG => (b)TALBUM_ACTIVATE( 96 )
Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE( 1064 )
Called from: .\prg\fwh\TALBUM.PRG => TALBUM:ACTIVATE( 96 )
Called from: .\prg\btc\PLIBROS.PRG => LIGALERIA( 2769 )
Called from: .\prg\btc\PLIBROS.PRG => (b)LIBROS( 230 )
Called from: .\prg\fwh\C5VMENU.PRG => TVMENU:EVALACTION( 1637 )
Called from: .\prg\fwh\C5VMENU.PRG => TVMENU:LBUTTONUP( 1339 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1791 )
Called from: .\prg\fwh\C5VMENU.PRG => TVMENU:HANDLEEVENT( 883 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3546 )
Called from: => WINRUN( 0 )
Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE( 1078 )
Called from: .\prg\btc\MAIN.PRG => TAPPLICATION:ACTIVATE( 258 )
Called from: .\prg\btc\MAIN.PRG => MAIN( 42 )

System
======
CPU type: Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz 3500 Mhz
Hardware memory: 8121 megs

Free System resources: 0 %
GDI resources: 0 %
User resources: 0 %

Windows total applications running: 5
1 ,
2 , C:\WINDOWS\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.19041.746_none_11afeb8
3 , C:\alanit\develop\bitacora\bitacora.exe
4 DDE Server Window, C:\WINDOWS\System32\OLE32.DLL
5 GDI+ Window (bitacora.exe), C:\WINDOWS\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.19041.746_none_429ade728a91c37

Variables in use
================
Procedure Type Value
==========================
CENTER
Param 1: O Class: ERROR
(b)TALBUM_ACTIVATE
Param 1: O Class: TWINDOW
Local 1: U
Local 2: U
TWINDOW:ACTIVATE
Param 1: O Class: TWINDOW
TALBUM:ACTIVATE
Param 1: C "NORMAL"
Param 2: U
Param 3: U
Param 4: U
Param 5: B {|| ... }
Param 6: U
Param 7: B {|| ... }
Param 8: B {|| ... }
Param 9: U
Param 10: U
Param 11: U
Param 12: U
Param 13: U
Param 14: U
Param 15: U
Param 16: U
Param 17: B {|| ... }
Param 18: U
Param 19: U
Param 20: L .F.
Local 1: O Class: TWINDOW
Local 2: O Class: TSCROLLBAR
Local 3: U
LIGALERIA
Local 1: O Class: TALBUM
(b)LIBROS
Local 1: C "LI"
Local 2: N 93
Local 3: N 10
Local 4: A Len: 172
Local 5: A Len: 172
Local 6: A Len: 172
Local 7: O Class: TALBUM
TVMENU:EVALACTION
Param 1: O Class: TVMENU
TVMENU:LBUTTONUP
Param 1: N 0
Local 1: O Class: TVITEM
Local 2: U
TCONTROL:HANDLEEVENT
Param 1: N 245
Param 2: N 91
Param 3: N 0
Local 1: N 11
Local 2: N 0
TVMENU:HANDLEEVENT
Param 1: N 514
Param 2: N 0
Param 3: N 16056411
Local 1: U
_FWH
Param 1: N 514
Param 2: N 0
Param 3: N 16056411
WINRUN
Param 1: N 16056411
Param 2: N 514
Param 3: N 0
Param 4: N 16056411
Param 5: N 154
Local 1: O Class: TVMENU
TWINDOW:ACTIVATE
Param 1: N 722670
TAPPLICATION:ACTIVATE
Param 1: C "NORMAL"
Param 2: U
Param 3: U
Param 4: U
Param 5: B {|| ... }
Param 6: U
Param 7: U
Param 8: B {|| ... }
Param 9: U
Param 10: U
Param 11: U
Param 12: U
Param 13: U
Param 14: U
Param 15: U
Param 16: U
Param 17: B {|| ... }
Param 18: U
Param 19: U
Param 20: L .F.
Local 1: O Class: TWINDOW
Local 2: U
Local 3: U
MAIN
Local 1: O Class: TAPPLICATION

Linked RDDs
===========
DBF
DBFFPT
DBFBLOB
DBFCDX
DBFNTX

DataBases in use
================

1: => LI RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
93 229 .F. .F.

Indexes in use TagName
Upper( LiCodigo ) CODIGO
Upper( LiTitulo ) TITULO
Upper( LiTitOrig ) TITULORIGI
Upper( LiAutor ) + Upper( LiTitulo AUTOR
Upper( LiMateria ) + Upper( LiTitulMATERIA
Upper( LiPropiet ) + Upper( LiTitulPROPIETARI
Upper( LiEditor ) + Upper( LiTituloEDITOR
Str( LiAnoEdic, 4 ) + Upper( LiTituANOEDIC
Upper( LiColecc ) + Upper( LiTituloCOLECCION
=> DToS( LiFchAdq ) + Upper( LiTitulo FCHCOMPRA
DToS( LiFechaPr ) + Upper( LiTituloFCHPRESTAM
DToS( LiFechaPr ) + Upper( LiPrestaPRESTADOS
Upper( LiUbicaci ) + Upper( LiTitulUBICACION

Relations in use

2: MU RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
64 194 .F. .F.

Indexes in use TagName
=> Upper( MuCodigo ) CODIGO
Upper( MuTitulo ) TITULO
Upper( MuAutor ) + Upper( MuTitulo INTERPRETE
Upper( MuMateria ) + Upper( MuTitulMATERIA
Upper( MuAutor2 ) + Upper( MuTituloCOMPOSITOR
Upper( MuDirector ) + Upper( MuTituDIRECTOR
Upper( MuPropiet ) + Upper( MuTitulPROPIETARI
Upper( MuEditor ) + Upper( MuTituloEDITOR
Str( MuAnoEdic, 4 ) + Upper( MuTituANOEDIC
Upper( MuColecc ) + Upper( MuTituloCOLECCION
DToS( MuFchAdq ) + Upper( MuTitulo FCHCOMPRA
DToS( MuFchPres ) + Upper( MuTituloFCHPRESTAM
DToS( MuFchPres ) + Upper( MuPrestaPRESTADOS
Upper( MuUbicaci ) + Upper( MuTitulUBICACION
MuSoporte SOPORTE

Relations in use

3: CN RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
2 3 .F. .F.

Indexes in use TagName
=> Upper( CaTitulo ) TITULO
Upper( CaInterp ) + Upper( CaTituloINTERPRETE
Upper( CaAutor ) + Upper( CaTitulo COMPOSITOR
Upper( CaMateria ) + Upper( CaTitulMATERIA
Upper( CaDuracc ) + Upper( CaTituloDURACION

Relations in use

4: CD RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
4 5 .F. .F.

Indexes in use TagName
=> Upper( CdMuCodigo ) + Upper( CdOrdeCDMUCODIGO
Upper( CdCaTitulo ) CDCATITULO
Upper( CdCaTitulo ) + Upper( CdCaAuTITAUTOR
Upper( CdCaAutor ) + Upper( CdCaTitAUTORTIT

Relations in use

5: VI RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
2 3 .F. .F.

Indexes in use TagName
=> Upper( ViNumero ) CODIGO
Upper( ViTitulo ) TITULO
Upper( ViOriginal ) ORIGINAL
Upper( ViMateria ) + Upper( ViTitulMATERIA
Upper( ViPropiet ) + Upper( ViTitulPROPIETARI
Upper( ViDirector ) + Upper( ViTituDIRECTOR
Upper( ViActor ) + Upper( ViTitulo ACTOR
Upper( ViActriz ) + Upper( ViTituloACTRIZ
Upper( ViProduct ) + Upper( ViTitulEDITOR
Str( ViAnyo, 4 ) + Upper( ViTitulo ANOEDIC
Upper( ViColecc ) + Upper( ViTituloCOLECCION
DToS( ViFchAdq ) + Upper( ViTitulo FCHCOMPRA
DToS( ViFchPres ) + Upper( ViTituloFCHPRESTAM
DToS( ViFchPres ) + Upper( ViPrestaPRESTADOS
Upper( ViUbicaci ) + Upper( ViTitulUBICACION
Upper( ViFotogra ) + Upper( ViTitulFOTOGRAFIA

Relations in use

6: SO RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
1 166 .F. .F.

Indexes in use TagName
=> Upper( SoCodigo ) CODIGO
Upper( SoTitulo ) TITULO
Upper( SoMateria ) + Upper( SoTitulMATERIA
Upper( SoPropiet ) + Upper( SoTitulPROPIETARI
Upper( SoEditor ) + Upper( SoTituloEDITOR
DToS( SoFchComp ) + Upper( SoTituloFCHCOMPRA
DToS( SoFecha ) + Upper( SoTitulo )FCHPRESTAM
DToS( SoFecha ) + Upper( SoPrestad PRESTADOS
Upper( SoGuardado ) + Upper( SoTituUBICACION

Relations in use

7: IN RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
1 4 .F. .F.

Indexes in use TagName
=> Upper( InCodigo ) CODIGO
Upper( InNombre ) TITULO
Upper( InMateria ) + Upper( InNombrMATERIA
Upper( InDirecc ) + Upper( InNombreDIRECCION
Str( InDiseno, 1 ) + Upper( InNombrVDISENO
Str( InConteni, 1 ) + Upper( InNombVCONTENIDO
Str( InValorac, 1 ) + Upper( InNombVGLOBAL
DToS( InFchVis ) + Upper( InNombre FCHVISITA
Upper( InServic ) + Upper( InNombreSERVICIO

Relations in use

8: MA RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
42 86 .F. .F.

Indexes in use TagName
=> Upper( Matipo ) + Upper( MaMateria MATERIA
Upper( MaMateria ) LMATERIA
Upper( MaMateria ) MMATERIA
Upper( MaMateria ) VMATERIA
Upper( MaMateria ) SMATERIA
Upper( MaMateria ) IMATERIA

Relations in use

9: UB RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
6 7 .F. .F.

Indexes in use TagName
=> Upper( UbTipo ) + Upper( UbUbicaci UBICACION
Upper( UbUbicaci ) LUBICACION
Upper( UbUbicaci ) MUBICACION
Upper( UbUbicaci ) VUBICACION
Upper( UbUbicaci ) SUBICACION

Relations in use

10: ID RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
3 5 .F. .F.

Indexes in use TagName
=> Upper( IDIOMA ) IDIOMA

Relations in use

11: AG RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
24 37 .F. .F.

Indexes in use TagName
=> Upper( PENOMBRE ) CONTACTOS
Upper( PENOMBRE ) PROPIETARI
Upper( PENOMBRE ) COMPRAS
Upper( PECODIGO ) CODIGO

Relations in use

12: AU RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
431 522 .F. .F.

Indexes in use TagName
=> Upper( AUNOMBRE ) ESCRITORES
AuMateria + AuNombre MESCRITORE
Upper( AUNOMBRE ) INTERPRETE
AuMateria + AuNombre MINTERPRET
Upper( AUNOMBRE ) COMPOSITOR
AuMateria + AuNombre MCOMPOSITO
Upper( AUNOMBRE ) DIRMUSICA
AuMateria + AuNombre MDIRMUSICA
Upper( AUNOMBRE ) DIRCINE
AuMateria + AuNombre MDIRCINE
Upper( AUNOMBRE ) ACTORES
AuMateria + AuNombre MACTORES
Upper( AUNOMBRE ) FOTOGRAFIA
AuMateria + AuNombre MFOTOGRAFI
Upper( AUNOMBRE ) ALL_LIBROS
Upper( AUNOMBRE ) ALL_DISCOS
Upper( AUNOMBRE ) ALL_VIDEOS

Relations in use

13: ED RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
115 157 .F. .F.

Indexes in use TagName
=> Upper( EDNOMBRE ) EDLIBROS
Upper( EDNOMBRE ) EDDISCOS
Upper( EDNOMBRE ) EDVIDEOS
Upper( EDNOMBRE ) EDSOFTWARE

Relations in use

14: CL RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
3 15 .F. .F.

Indexes in use TagName
=> Upper( CLNOMBRE ) COLIBROS
Upper( CLNOMBRE ) CODISCOS
Upper( CLNOMBRE ) COVIDEOS

Relations in use

15: CA RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
1 3 .F. .F.

Indexes in use TagName
=> Upper( CATEGORIA ) TODOS

Relations in use

16: NO RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
1 3 .F. .F.

Indexes in use TagName
=> Str( Notipo, 1 ) + Upper( NoTitulo TIPO
Str( Notipo, 1 ) + Upper( NoTitulo LIBROS
Str( Notipo, 1 ) + Upper( NoTitulo DISCOS
Str( Notipo, 1 ) + Upper( NoTitulo VIDEOS
Str( Notipo, 1 ) + Upper( NoTitulo SOFTWARE

Relations in use

17: MD RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
1 0 .T. .T.

Indexes in use TagName

Relations in use

18: SM RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
1 2 .F. .F.

Indexes in use TagName
Upper( SMSOPORTE ) SOPORTE

Relations in use

19: PR RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
1 2 .F. .F.

Indexes in use TagName
Upper(prcodigo)+dtos(prfchprest) PRL1
Upper(prtitulo)+dtos(prfchprest) PRL2
Upper(prpenombre)+dtos(prfchprest) PRL3
dtos(prfchprest)+upper(prcodigo) PRL4
Upper(prcodigo)+dtos(prfchprest) PRM1
Upper(prtitulo)+dtos(prfchprest) PRM2
Upper(prpenombre)+dtos(prfchprest) PRM3
dtos(prfchprest)+upper(prcodigo) PRM4
Upper(prcodigo)+dtos(prfchprest) PRV1
Upper(prtitulo)+dtos(prfchprest) PRV2
Upper(prpenombre)+dtos(prfchprest) PRV3
dtos(prfchprest)+upper(prcodigo) PRV4
Upper(prcodigo)+dtos(prfchprest) PRS1
Upper(prtitulo)+dtos(prfchprest) PRS2
Upper(prpenombre)+dtos(prfchprest) PRS3
dtos(prfchprest)+upper(prcodigo) PRS4

Relations in use

Classes in use:
===============
1 ERROR
2 HBCLASS
3 HBOBJECT
4 TAGET
5 TAPPLICATION
6 TINI
7 TFONT
8 TWINDOW
9 TCONTROL
10 TICON
11 TBRUSH
12 TMENU
13 TREG32
14 TMENUITEM
15 TMSGBAR
16 TRECT
17 TMSGITEM
18 TTIMER
19 TRIBBONBAR
20 TRPANEL
21 TRBGROUP
22 TRBTN
23 TDIALOG
24 TFSDI
25 TXBROWSE
26 TXBRWCOLUMN
27 TVMENU
28 TC5IMGLIST
29 TVITEM
30 TTABS
31 TSPLITTER
32 TSCROLLBAR
33 TBTNBMP
34 TCLIPBOARD
35 TXIMAGE
36 TALBUM
37 TSAY
38 TSTRUCT

Memory Analysis
===============
735 Static variables

Dynamic memory consume:
Actual Value: 5373952 bytes
Highest Value: 5373952 bytes
User avatar
José Luis Sánchez
 
Posts: 556
Joined: Thu Oct 13, 2005 9:23 am
Location: Novelda - Alicante - España

Re: galería de imágenes

Postby Antonio Linares » Tue Jan 19, 2021 6:07 pm

José Luis,

thanks

Please post here also the source code of your .\prg\fwh\TALBUM.PRG
regards, saludos

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

Re: galería de imágenes

Postby José Luis Sánchez » Tue Jan 19, 2021 7:02 pm

Sorry, I tried and gives me error with

oAlbum := TAlbum():New( aImages, aLabels, aRecno ):Activate()

and also with:

oAlbum := TAlbum():New( aImages, aLabels, aRecno )
oAlbum:Activate()

Here is my TAlbum class. I modified to show a label and I'm trying to edit the record of the cover:

Code: Select all  Expand view


CLASS TAlbum

   DATA aPhotos
   DATA aLabel
   DATA aRecno
   DATA oWnd

   DATA nWndWidth  INIT oApp():oGrid:nWidth+40  // 800
   DATA nWndHeight INIT oApp():oGrid:nHeight // 800
   DATA nImgWidth  INIT 180
   DATA nGutter    INIT 20
   DATA nImgCols PROTECTED
   DATA nOffset    INIT 0 PROTECTED
   DATA nHeight
   DATA lExit INIT .F.

   ACCESS oVScroll INLINE ::oWnd:oVScroll

   METHOD New( aPhotos, aLabel, aRecno ) CONSTRUCTOR
   METHOD Activate()

PROTECTED:
   METHOD CreateWindow()
   METHOD CreateControls()
   METHOD SetVScroll()
   METHOD GoUp()
   METHOD GoDown()
   METHOD ThumbPos( nPos )
   METHOD MouseWheel()
   METHOD VSetPos() INLINE ::oWnd:oVScroll:SetPos( -::nOffSet )
   METHOD GoTop()
   METHOD GoBottom()
   METHOD KeyDown( nKey )
   METHOD ScrollWnd( nPixels )
   METHOD Resize( nType, nWidth, nHeight )

ENDCLASS

//----------------------------------------------------------------------------//

METHOD New( aPhotos, aLabel, aRecno ) CLASS TAlbum

   ::aPhotos := aPhotos
   ::aLabel  := aLabel
   ::aRecno  := aRecno

return Self

//----------------------------------------------------------------------------//

METHOD Activate() CLASS TAlbum
   local hWndMain
   ::CreateWindow()
   ::CreateControls()
   ::SetVScroll()
   ::oWnd:bResized := { |t,w,h| ::Resize( t, w, h ) }
   ::lExit := .F.

   ACTIVATE WINDOW ::oWnd ;
      ON INIT ::oWnd:Center( oApp():oWndMain ) ;
      VALID (::lExit := .t.)

   StopUntil( { || ::lExit  } )
   
return Self

//----------------------------------------------------------------------------//

METHOD CreateWindow() CLASS TAlbum

   local oMain, x, y

   if ( oMain := WndMain() ) != nil .and. oMain:IsKindOf( "TMDIFRAME" )
      DEFINE WINDOW ::oWnd MDICHILD OF oMain VSCROLL

   else
      x  := Int( ( ScreenWidth() - ::nWndWidth ) / 2 )
      y  := Int( ( ScreenHeight() - ::nWndHeight ) / 2 )
      DEFINE WINDOW ::oWnd FROM y,x TO ::nWndHeight + y, ::nWndWidth + x PIXEL VSCROLL ;
         TITLE 'Galería de portadas de libros' ; // OF oApp():oWndMain ;
         COLOR CLR_BLACK, CLR_WHITE NOMINIMIZE NOZOOM // 0xe8e8e8
      //DEFINE DIALOG ::oWnd FROM y,x TO ::nWndHeight + y, ::nWndWidth + x PIXEL ; // VSCROLL ;
      //   COLOR CLR_BLACK, CLR_WHITE // NOMINIMIZE NOZOOM
   endif
   ::lExit := .t.

return Self

//----------------------------------------------------------------------------//

METHOD CreateControls() CLASS TAlbum

   local nImgWidth   := ::nImgWidth
   local nImgHeight  := Int( nImgWidth * 4 / 3 )
   local nGutter     := ::nGutter
   local nRows, nCols, nRow, nCol, x, y, nImage, xMax
   Local nImages := Len( ::aPhotos )
   local oImage
   local oSay
   local nRecno

   nCols    := Int( ( ::oWnd:nWidth - nGutter ) / ( nImgWidth + nGutter ) )
   nRows    := Ceiling( nImages / nCols )
   xMax     := nCols * ( nImgWidth * nGutter )

   y        := nGutter
   nImage   := 1
   do while nImage <= nImages
      x     := nGutter
      nCol  := 1

      do while nCol <= nCols .and. nImage <= nImages

         @ y, x XIMAGE oImage SIZE nImgWidth, nImgHeight OF ::oWnd NOBORDER
         oImage:SetSource( If( HB_ISARRAY( ::aPhotos[ nImage ] ), ::aPhotos[ nImage, 1 ], ::aPhotos[ nImage ] ) )
         oImage:nUserControl := 0
         oImage:lBmpTransparent := .F.
         nRecno := ::aRecno[nImage]
         // para devolver el recno tienes que hacer detached local
         oImage:bLDblClick := { || (MsgInfo(nRecno), LiForm( oApp():oGrid, "edt", , nRecno )) }

         @ y+nImgHeight+(nGutter/2), x SAY oSay PROMPT ::aRecno[nImage] FONT oApp():oFont ;
            SIZE nImgWidth, 2*nGutter CENTER PIXEL OF ::oWnd

         #if FW_VersionNo >= 21010
            oImage:Shadow()
         #else
            oImage:bPainted := PaintBlock( oImage )
         #endif
         nImage++
         nCol++
         x  += ( nImgWidth + 2*nGutter )
      enddo
      y  += ( nImgHeight + nGutter )
   enddo

   ::nImgCols  := nCols
   ::nHeight   := y

return Self

//----------------------------------------------------------------------------//

METHOD Resize( nType, nWidth, nHeight ) CLASS TAlbum

   local nImgHeight  := Int( ::nImgWidth * 4 / 3 )
   local nRows, nCols, nRow, nCol, x, y, nImage, nImages := Len( ::aPhotos )

   if nWidth == nil
      return nil
   endif

   nCols    := Int( ( ::oWnd:nWidth - ::nGutter ) / ( ::nImgWidth + ::nGutter ) )
   if nCols == ::nImgCols
      return nil
   endif
   nRows    := Ceiling( nImages / nCols )

   y        := ::nGutter
   nImage   := 1
   do while nImage <= nImages
      x     := ::nGutter
      nCol  := 1

      do while nCol <= nCols .and. nImage <= nImages

         WITH OBJECT ::oWnd:aControls[ nImage ]
            :nTop      := y
            :nLeft     := x
         END
         nImage++
         x  += ( ::nImgWidth + ::nGutter )
         nCol++
      enddo
      y  += ( nImgHeight + ::nGutter )
   enddo

   ::nImgCols  := nCols
   ::nHeight   := y
   ::oVScroll:SetRange( 0, ::nHeight - ::oWnd:nHeight )
   ::nOffSet   := 0
   ::VSetPos()

return nil

//----------------------------------------------------------------------------//

METHOD SetVScroll() CLASS TAlbum

   local oSelf    := Self

   WITH OBJECT ::oWnd:oVScroll
      :SetRange( 0, ::nHeight - ::oWnd:nHeight )
      :bGoUp      := { || oSelf:GoUp() }
      :bGoDown    := { || oSelf:GoDown() }
      :bPos       := { |nPos| oSelf:ThumbPos( nPos ) }
      :bGoTop     := { || oSelf:GoTop() }
      :bGoDown    := { || oSelf:GoDown() }
   END

   ::oWnd:bMouseWheel := ;
      { |k,nDelta| oSelf:MouseWheel( k, nDelta ) }

   ::oWnd:bKeyDown := { |k| oSelf:KeyDown( k ) }

return Self

//----------------------------------------------------------------------------//

METHOD ScrollWnd( nPixels ) CLASS TAlbum

   ScrollWindow( ::oWnd:hWnd, 0,  nPixels, 0, GetClientRect( ::oWnd:hWnd ) )

return Self

//----------------------------------------------------------------------------//

METHOD GoUp() CLASS TAlbum

   local nPixels  := Min( 20, ::oVScroll:nMin - ::nOffset )

   ::ScrollWnd( nPixels )
   ::nOffSet += nPixels
   ::VSetPos()

return Self

//----------------------------------------------------------------------------//

METHOD GoDown() CLASS TAlbum

   local nPixels  := Min( 20, ::oVScroll:nMax + ::nOffSet )

   ::ScrollWnd( -nPixels )
   ::nOffSet -= nPixels
   ::VSetPos()

return Self

//----------------------------------------------------------------------------//

METHOD ThumbPos( nPos ) CLASS TAlbum

   AEval( ::oWnd:aControls, { |o| o:nTop -= ( nPos + ::nOffSet ) } )
   ::nOffSet   := -nPos
   ::VSetPos()

return Self

//----------------------------------------------------------------------------//

METHOD MouseWheel( k, nDelta ) CLASS TAlbum

   if nDelta > 0
      ::GoUp()
   else
      ::GoDown()
   endif
   ::VSetPos()

return Self

//----------------------------------------------------------------------------//

METHOD GoTop() CLASS TAlbum

   AEval( ::oWnd:aControls, { |o| o:nTop -= ::nOffSet } )
   ::nOffSet   := 0
   ::VSetPos()

return Self

//----------------------------------------------------------------------------//

METHOD GoBottom() CLASS TAlbum

   AEval( ::oWnd:aControls, { |o| o:nTop -= ( ::oVScroll:nMax + ::nOffSet ) } )
   ::nOffSet  := -::oVScroll:nMax
   ::VSetPos()

return Self

//----------------------------------------------------------------------------//

METHOD KeyDown( nKey ) CLASS TAlbum

   SWITCH nKey
   case VK_UP
      if GetKeyState( VK_CONTROL )
         ::GoTop()
      else
         ::GoUp()
      endif
      return 0
      EXIT
   case VK_DOWN
      if GetKeyState( VK_CONTROL )
         ::GoBottom()
      else
         ::GoDown()
      endif
      return 0
      EXIT
   case VK_HOME
      ::GoTop()
      return 0
      EXIT
   case VK_END
      ::GoBottom()
      return 0
      EXIT
   END

return nil

//----------------------------------------------------------------------------//

#if FW_VersionNo < 21010

//----------------------------------------------------------------------------//

static function PaintBlock( oImage )
return { || DrawShadow( oImage ) }

//----------------------------------------------------------------------------//

static function DrawShadow( oImage )

   local aRect := { oImage:nTop, oImage:nLeft, oImage:nTop + oImage:nHeight, oImage:nLeft + oImage:nWidth }
   local hDC   := oImage:oWnd:GetDC()
   local n, nColor, hPen, nIncClr, nSize := 10

   n        := Int( ( 0xf0 - 0x48 ) / ( nSize - 1 ) )
   nIncClr  := n + 256 * n + 256 * 256 * n
   nColor   := 0x484848
   for n := 0 to nSize - 1
      hPen     := CreatePen( PS_SOLID, 1, nColor )
      MoveTo( hDC, aRect[ 4 ] + n, aRect[ 1 ] + n )
      LineTo( hDC, aRect[ 4 ] + n, aRect[ 3 ] + n, hPen )
      MoveTo( hDC, aRect[ 2 ] + n, aRect[ 3 ] + n )
      LineTo( hDC, aRect[ 4 ] + n + 1, aRect[ 3 ] + n, hPen )
      DeleteObject( hPen )
      nColor   += nIncClr
   next

   oImage:oWnd:ReleaseDC()

return nil

#endif

//----------------------------------------------------------------------------//
 
function bLiRecno(aRecno, nImage)
   ? nImage
   ? aRecno[nImage]
return aRecno[nImage]
 


Regards,
User avatar
José Luis Sánchez
 
Posts: 556
Joined: Thu Oct 13, 2005 9:23 am
Location: Novelda - Alicante - España

Re: galería de imágenes

Postby Enrico Maria Giordano » Tue Jan 19, 2021 8:25 pm

Code: Select all  Expand view
ON INIT ::oWnd:Center( oApp():oWndMain )


You are using oWnd property of TWindow not of TAlbum. Assign

Code: Select all  Expand view
oAlbum = Self


at the start of the method and then use

Code: Select all  Expand view
ON INIT oAlbum:oWnd:Center( oApp():oWndMain )


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: galería de imágenes

Postby José Luis Sánchez » Fri Jan 22, 2021 5:15 pm

Thanks Enrico.

I need that TAlbum class inherits from TControl because I need to put it in a dialog. It's very difficult for me to control the application flow with 2 windows, so I need to create a dialog and inside it the talbum class.

I have seen the code from Antonio, and also noticed about the TScrollPanel class existing in FWH. I'll try to build the TAlbum class from TScrollPanel so I'd have scroll features it it.

Regards,
José Luis
User avatar
José Luis Sánchez
 
Posts: 556
Joined: Thu Oct 13, 2005 9:23 am
Location: Novelda - Alicante - España

Re: galería de imágenes

Postby nageswaragunupudi » Fri Jan 22, 2021 5:58 pm

José Luis Sánchez wrote:Thanks Enrico.

I need that TAlbum class inherits from TControl because I need to put it in a dialog. It's very difficult for me to control the application flow with 2 windows, so I need to create a dialog and inside it the talbum class.

I have seen the code from Antonio, and also noticed about the TScrollPanel class existing in FWH. I'll try to build the TAlbum class from TScrollPanel so I'd have scroll features it it.

Regards,
José Luis


Please wait a little while.
Very soon we are posting full TAlbum class derived from TPanel
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: galería de imágenes

Postby José Luis Sánchez » Fri Jan 22, 2021 6:14 pm

Mr. Rao,

I've done what I need just with a TScrollPanel and your code of showing the images. I'll post it when I've a nice sample. I didn't known that FWH has a TScrollPanel control, sorry.

¡¡ Muchas gracias a todos !!
User avatar
José Luis Sánchez
 
Posts: 556
Joined: Thu Oct 13, 2005 9:23 am
Location: Novelda - Alicante - España

Re: galería de imágenes

Postby José Luis Sánchez » Fri Jan 22, 2021 6:19 pm

Here you have !!! That is all that I need :-)

Code: Select all  Expand view



#include "fivewin.ch"

REQUEST DBFCDX

//----------------------------------------------------------------------------//

function Main()

   local oDlg, oFont, oBold, oPanel
   local aPhotos

   aPhotos := DirectoryRecurse( "c:\fivetech\fwh1905\bitmaps\*.*" )
   ASort( aPhotos, nil, nil, { |x,y| x[ 2 ] > y[ 2 ] } )
   ASize( aPhotos, 200 )

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE FONT oBold NAME "TAHOMA" SIZE 0,-14 BOLD

   DEFINE DIALOG oDlg SIZE 1600,800 PIXEL TRUEPIXEL FONT oFont ;
      TITLE "FWH TScrollPanel"

   //
   oPanel   := TScrollPanel():New( 20, 20, 700, 1580, oDlg, .t. )
   oPanel:SetFont( oDlg:oFont )
   //

   @ 740, 020 BUTTON "Aceptar"   SIZE 100,40 PIXEL OF oDlg ACTION ( MsgInfo('bye'), oDlg:End() )

   ACTIVATE DIALOG oDlg CENTERED ON INIT ( PlaceControls( oPanel, aPhotos ) )

   RELEASE FONT oFont, oBold

return nil

function PlaceControls( oPanel, aPhotos )

    local nImgWidth   := 180
    local nImgHeight  := Int( nImgWidth * 4 / 3 )
    local nGutter     := 20
    local nRows, nCols, nRow, nCol, x, y, nImage, xMax, nImages := Len( aPhotos )
    local oImage
 
    nCols    := Int( ( oPanel:nWidth - nGutter ) / ( nImgWidth + nGutter ) )
    nRows    := Ceiling( nImages / nCols )
    xMax     := nCols * ( nImgWidth * nGutter )
 
    y        := nGutter
    nImage   := 1
    do while nImage <= nImages
       x     := nGutter
       nCol  := 1
 
       do while nCol <= nCols .and. nImage <= nImages
 
          @ y, x XIMAGE oImage SIZE nImgWidth, nImgHeight OF oPanel NOBORDER
          oImage:SetSource( If( HB_ISARRAY( aPhotos[ nImage ] ), aPhotos[ nImage, 1 ], aPhotos[ nImage ] ) )
          oImage:nUserControl := 0
 //#if FW_VersionNo >= 21010
 //         oImage:Shadow()
 //#else
 //         oImage:bPainted := PaintBlock( oImage )
 //#endif
          nImage++
          nCol++
          x  += ( nImgWidth + nGutter )
       enddo
       y  += ( nImgHeight + nGutter )
    enddo
 
    //::nImgCols  := nCols
    // ::nHeight   := y
 

   oPanel:SetRange() // call this after defining all controls

return nil
 
 


Kind regards,
User avatar
José Luis Sánchez
 
Posts: 556
Joined: Thu Oct 13, 2005 9:23 am
Location: Novelda - Alicante - España

Re: galería de imágenes

Postby nageswaragunupudi » Fri Jan 22, 2021 7:09 pm

Yes, TScrollPanel works well.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: galería de imágenes

Postby Antonio Linares » Fri Jan 22, 2021 7:38 pm

José Luis,

Very good idea :-)

On the scrollbar, the top and bottom arrows seem not to be working
Same for the mouse wheel

We are going to check it
regards, saludos

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

Re: galería de imágenes

Postby José Luis Sánchez » Sat Jan 23, 2021 8:12 am

nageswaragunupudi wrote:
José Luis Sánchez wrote:Thanks Enrico.

I need that TAlbum class inherits from TControl because I need to put it in a dialog. It's very difficult for me to control the application flow with 2 windows, so I need to create a dialog and inside it the talbum class.

I have seen the code from Antonio, and also noticed about the TScrollPanel class existing in FWH. I'll try to build the TAlbum class from TScrollPanel so I'd have scroll features it it.

Regards,
José Luis


Please wait a little while.
Very soon we are posting full TAlbum class derived from TPanel


Mr. Rao,
A new class derived from TScrollPanel would be nice with some added features:
* A new data to tell how many pictures show in a row, and calculate the gutter to adjust and 'center' the row in the control
* Possibility to have one picture highlighted
* Cursor movement in the images, and automatically scroll the images when go down from the latest showed row.

I just give you some ideas for the class ;-)

Kind regards,
User avatar
José Luis Sánchez
 
Posts: 556
Joined: Thu Oct 13, 2005 9:23 am
Location: Novelda - Alicante - España

Re: galería de imágenes

Postby JoseAlvarez » Sat Jan 23, 2021 1:48 pm

Hola Jose Luis.

Soy jose alvarez , de Venezuela,

podrias ayudarme a hacer este tipo de menu? hace tiempo quiero hacer algo asi y aun no doy con la manera.

Image

Cualquier ayuda sabria agradecerte. Uso Fw 17.01 , xHarbour, Borland 5.5 y Pelles c (solo como editor de recursos)

Un Abrazo,
"Los errores en programación, siempre están entre la silla y el teclado..."

Fwh 19.06 32 bits + Harbour 3.2 + Borland 7.4 + MariaDB + TDolphin

Carora, Estado Lara, Venezuela.
User avatar
JoseAlvarez
 
Posts: 795
Joined: Sun Nov 09, 2014 5:01 pm

Re: galería de imágenes

Postby José Luis Sánchez » Sat Jan 23, 2021 3:00 pm

Hola José,

eso es la clase c5vmenu de Paco García. La tienes completa en los fuentes de Cuaderno de Bitácora que tengo publicados en Github: https://github.com/JoseluisSanchez/bitacora. Ahí están los fuentes y cómo uso yo la clase.

Saludos,
User avatar
José Luis Sánchez
 
Posts: 556
Joined: Thu Oct 13, 2005 9:23 am
Location: Novelda - Alicante - España

Re: galería de imágenes

Postby JoseAlvarez » Sat Jan 23, 2021 4:39 pm

José Luis Sánchez wrote:Hola José,

eso es la clase c5vmenu de Paco García. La tienes completa en los fuentes de Cuaderno de Bitácora que tengo publicados en Github: https://github.com/JoseluisSanchez/bitacora. Ahí están los fuentes y cómo uso yo la clase.

Saludos,


ooookkkkk, muchisimas gracias jose luis... agradecido altamente...

gracias al foro de FW...
"Los errores en programación, siempre están entre la silla y el teclado..."

Fwh 19.06 32 bits + Harbour 3.2 + Borland 7.4 + MariaDB + TDolphin

Carora, Estado Lara, Venezuela.
User avatar
JoseAlvarez
 
Posts: 795
Joined: Sun Nov 09, 2014 5:01 pm

Re: galería de imágenes

Postby José Luis Sánchez » Sun Jan 24, 2021 3:13 pm

Hola a todos,
Ya tengo funcionando la galería de portadas de libros. Muchas gracias a Antonio, Mr. Rao, Angel y Enrico por vuestra ayuda. Pongo a continuación el código que estoy utilizando.

Code: Select all  Expand view

// _____________________________________________________________________________//

Function LiGaleria()
   LOCAL cAlias  := "LI"
   LOCAL nRecno  := ( cAlias )->( RecNo() )
   LOCAL nOrder  := ( cAlias )->( ordNumber() )
   local aImages := {}
   local aLabels := {}
   local aRecno  := {}
   local oDlgAlbum, oAlbum

   LI->(DbGoTop())
   WHILE ! LI->(EOF())
      IF ! Empty(Rtrim(LI->LiImagen))
         AAdd(aImages, Rtrim(LI->LiImagen))
         AAdd(aLabels, Rtrim(LI->LiTitulo))
         AAdd(aRecno, LI->(Recno()))
      ENDIF
      LI->(DbSkip())
   ENDDO
   LI->(DbGoTo(nRecno))

   DEFINE DIALOG oDlgAlbum SIZE oApp():oGrid:nWidth, oApp():oGrid:nHeight PIXEL TRUEPIXEL ;
      TITLE "Galería de portadas de libros"
   oDlgAlbum:SetFont(oApp():oFont)
   //
   oAlbum := TScrollPanel():New( 20, 20, oApp():oGrid:nHeight-50, oApp():oGrid:nWidth-20, oDlgAlbum, .f. )
   oAlbum:SetColor(CLR_WHITE, CLR_WHITE)
   oAlbum:SetFont( oDlgAlbum:oFont )

   @ oApp():oGrid:nHeight-40, oApp():oGrid:nWidth-96 BUTTON "Aceptar" ;
      SIZE 76, 24 PIXEL OF oDlgAlbum ACTION oDlgAlbum:End()

   ACTIVATE DIALOG oDlgAlbum ;
      ON INIT ( LiAlbum( oAlbum, aImages, aRecno, oDlgAlbum ), oDlgAlbum:Center( oApp():oWndMain ) )

   RETURN NIL  

function LiAlbum( oPanel, aPhotos, aRecno, oDlgAlbum )
   local nImgPerRow  := 8
   local nImgWidth   // := 180
   local nImgHeight  // := Int( nImgWidth * 4 / 3 )
   local nHGutter    := 10
   local nVGutter    := 20
   local nCols       := nImgPerRow
   local nRows, nRow, nCol, x, y, nImage, xMax, nImages := Len( aPhotos )
   local oImage, oSay

   // el ancho del scrollbar es 16
   nImgWidth := INT((oPanel:nWidth-16-(nImgPerRow+1)*nHGutter)/nImgPerRow)
   nImgHeight:= Int( nImgWidth * 4 / 3 )
   nRows    := Ceiling( nImages / nCols )
   xMax     := nCols * ( nImgWidth * nHGutter )
   y        := nVGutter
   nImage   := 1
   do while nImage <= nImages
      x     := nHGutter
      nCol  := 1
      do while nCol <= nCols .and. nImage <= nImages
         // llamo a una funcion para conseguir detached locals
         LiAlbumImage(y, x, nImgWidth, nImgHeight, oPanel, aPhotos, aRecno, nImage, nVGutter, oDlgAlbum)
         nImage++
         nCol++
         x  += ( nImgWidth + nHGutter )
      enddo
      y  += ( nImgHeight + 2*nVGutter )
   enddo
   //::nImgCols  := nCols
   // ::nHeight   := y
   oPanel:SetRange() // call this after defining all controls

return nil

Function LiAlbumImage(y, x, nImgWidth, nImgHeight, oPanel, aPhotos, aRecno, nImage, nVGutter, oDlgAlbum)
   local oImage, oSay, nLiRecno
   nLiRecno := aRecno[nImage]
   @ y, x XIMAGE oImage SIZE nImgWidth, nImgHeight OF oPanel NOBORDER
   oImage:SetSource( If( HB_ISARRAY( aPhotos[ nImage ] ), aPhotos[ nImage, 1 ], aPhotos[ nImage ] ) )
   oImage:nUserControl := 0
   oImage:lBmpTransparent := .f.
   oImage:bLDblClick := { || ( LiForm( oApp():oGrid, "edt", , nLiRecno, oDlgAlbum )) }

   @ y+nImgHeight+(nVGutter/2), x SAY oSay PROMPT nLiRecno FONT oApp():oFont ;
      COLOR CLR_BLACK, CLR_WHITE ;
      SIZE nImgWidth, 2*nVGutter CENTER PIXEL OF oPanel
return NIL
 


He modificado el código de Mr. Rao para definir el número de imágenes en horizontal que tiene la galería y que calcule el ancho de la imagen en consecuencia. También defino dos separaciones, una vertical y otro horizontal. La vertical la puedo usar para mostrar el título del libro u otro texto. El el código de arriba estoy mostrando el número de registro que corresponde a cada portada, para efectos de depuración, luego quitaré esto. En mi caso además de montar el array de imágenes monto otro de números de registro para que al hace doble click vaya a editar el libro correspondiente. Para conseguir esto he tenido que usar la técnica de 'detached locals' a la hora de crear las imágenes del álbum.

Saludos,
José Luis
User avatar
José Luis Sánchez
 
Posts: 556
Joined: Thu Oct 13, 2005 9:23 am
Location: Novelda - Alicante - España

PreviousNext

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 52 guests