FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Dudas probando METRO
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Dudas probando METRO
Posted: Tue May 21, 2024 03:01 AM

Saludos al foro:

Estoy probando la clase METRO y tengo los siguientes detalles

Hay un bot贸n para salir de la aplicaci贸n de manera controlada con el MsgNoYes( "Desea salir ?"),

pero si doy clic izquierdo fuera de cualquier bot贸n, la aplicaci贸n se cierre sin m谩s, c贸mo obligo

a que pase por el MsgNoYes() ?????

Y una m谩s, no encuentro c贸mo o donde puedo mover la fecha y RELOJ que aparecen??

Saludos

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Dudas probando METRO
Posted: Tue May 21, 2024 03:51 AM

Estimado Armando,

Puedes copir aqui el PRG para ver como lo est谩s usando ? gracias

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Dudas probando METRO
Posted: Tue May 21, 2024 03:57 AM
Master:

Por supuesto, muchas gracias

Pr谩cticamente es el mismo a METRO.PRG
Code (fw): Select all Collapse
#include "FiveWin.ch"
#include "metro.ch"
#include "Ado.ch"

MEMVAR oApp

STATIC oWindow

// Para que los acentos se vean bien
REQUEST HB_LANG_ES
REQUEST HB_CODEPAGE_ESWIN

FUNCTION Main()

聽 聽LOCAL oMetro

聽 聽SET CENTURY ON
聽 聽SET DATE TO FRENCH
聽 聽SET DELETED ON
聽 聽SET OPTIMIZE ON
聽 聽SETBALLOON(.T.)

聽 聽HB_CDPSELECT("ESWIN")
聽 聽HB_LangSelect( "ESWIN" )

聽 聽FWSetLanguage( 2 ) 聽 聽 聽// Para poner el PREVIEW en Espa帽ol

// Para que los acentos se vean bien
聽 聽SET( _SET_CODEPAGE, "ESWIN" )

聽 聽oApp := TAplicacion()

聽 聽LeeIni()

聽 聽IF ! Conecta()
聽 聽 聽 QUIT
聽 聽ENDIF

聽 聽oApp:oCon:Execute("USE " + AllTrim(oApp:cDBName))

聽 聽DEFINE METRO oMetro ;
聽 聽 聽 TITLE "AppRpt, Archivos para contabilidad" ;
聽 聽 聽 BACKGROUND "D:\FWH2307\bitmaps\hires\earth.bmp"

聽 聽DEFINE METROBUTTON OF oMetro ;
聽 聽 聽 PROMPT "Ventas del mes" COLOR CLR_WHITE, RGB( 234, 112, 39 ) ;
聽 聽 聽 IMAGE "D:\FWH2307\bitmaps\metro\Stock.bmp" ;
聽 聽 聽 ACTION AppRpt1a(oWindow)

聽 聽DEFINE METROBUTTON OF oMetro ;
聽 聽 聽 PROMPT "Cuentas por cobrar" COLOR CLR_WHITE, RGB( 181, 31, 60 ) ;
聽 聽 聽 IMAGE "D:\FWH2307\bitmaps\metro\Users.bmp" ;
聽 聽 聽 ACTION AppRpt1b(oWindow)

聽 聽DEFINE METROBUTTON OF oMetro ;
聽 聽 聽 PROMPT "Ventas del mes" COLOR CLR_WHITE, RGB( 24, 152, 78 ) ;
聽 聽 聽 IMAGE "D:\FWH2307\bitmaps\metro\utilities.bmp";
聽 聽 聽 ACTION AppRpt1c(oWindow)

聽 聽DEFINE METROBUTTON OF oMetro ;
聽 聽 聽 PROMPT "Ventas del mes" COLOR CLR_WHITE, RGB( 2, 174, 224 ) ;
聽 聽 聽 IMAGE "D:\FWH2307\bitmaps\metro\print.bmp";
聽 聽 聽 ACTION AppRpt1d(oWindow)

聽 聽DEFINE METROBUTTON OF oMetro ;
聽 聽 聽 PROMPT "Pagos recibidos del mes" COLOR CLR_WHITE, RGB( 234, 112, 39 ) ;
聽 聽 聽 IMAGE "D:\FWH2307\bitmaps\metro\graphics.bmp"

聽 聽DEFINE METROBUTTON OF oMetro ;
聽 聽 聽 PROMPT "Cuentas por cobrar del mes" COLOR CLR_WHITE, RGB( 2, 70, 133 ) LARGE ;
聽 聽 聽 IMAGE "D:\FWH2307\bitmaps\metro\internet.bmp";
聽 聽 聽 ACTION AppRpt1f(oWindow)

聽 聽DEFINE METROBUTTON OF oMetro ;
聽 聽 聽 PROMPT "Exit" COLOR CLR_WHITE, RGB( 2, 174, 224 ) ;
聽 聽 聽 IMAGE "D:\FWH2307\bitmaps\metro\exit.bmp" ;
聽 聽 聽 ACTION IF( MsgYesNo( "Seguro desea salir ?" ,oApp:cAplicacion), oMetro:End(),)

聽 聽ACTIVATE METRO oMetro

RETURN(Nil)

/*
* ---------------------------------------------------------------------------- *
*/
CLASS TAplicacion
聽 聽DATA cRazonSocial 聽 聽INIT "Empresa no registrada, s.a. de c.v."
聽 聽DATA cAplicacion 聽 聽 INIT "漏 " + STR( YEAR( DATE( ) ), 4, 0 ) + " Sistema para emisi贸n de reportes"// + SPACE(2) + FWVERSION
聽 聽DATA cAppAlias 聽 聽 聽 INIT "漏 " + STR( YEAR( DATE( ) ), 4, 0 ) + " AppRpt"
聽 聽DATA cCopyRight 聽 聽 聽INIT "漏 2024-" + STR( YEAR( DATE( ) ), 4, 0 ) + " by S.O.I., s.a. de c.v."
聽 聽DATA cVersion 聽 聽 聽 聽INIT "Versi贸n 1.0M00"

聽 聽DATA cDescription 聽 聽INIT Nil
聽 聽DATA cServer 聽 聽 聽 聽 INIT Nil
聽 聽DATA cUser 聽 聽 聽 聽 聽 INIT Nil
聽 聽DATA cPass 聽 聽 聽 聽 聽 INIT Nil
聽 聽DATA nPort 聽 聽 聽 聽 聽 INIT Nil
聽 聽DATA cDriveName 聽 聽 聽INIT Nil
聽 聽DATA cDBName 聽 聽 聽 聽 INIT Nil
聽 聽DATA oCon 聽 聽 聽 聽 聽 聽INIT NIL
ENDCLASS


/*
* ---------------------------------------------------------------------------- *
*/
STATIC FUNCTION LeeIni()
聽 聽 LOCAL oIni

聽 聽 INI oIni FILE ".\AppRpt.Ini"
聽 聽 聽 GET oApp:cDescription 聽 SECTION "MYSQL" 聽 聽 聽ENTRY "Description" 聽OF oIni DEFAULT "漏 Sistema para Emisi贸n de Reportes"
聽 聽 聽 GET oApp:cServer 聽 聽 聽 聽SECTION "MYSQL" 聽 聽 聽ENTRY "Server" 聽 聽 聽 OF oIni DEFAULT "localhost"
聽 聽 聽 GET oApp:cUser 聽 聽 聽 聽 聽SECTION "MYSQL" 聽 聽 聽ENTRY "User" 聽 聽 聽 聽 OF oIni DEFAULT "root"
聽 聽 聽 GET oApp:cPass 聽 聽 聽 聽 聽SECTION "MYSQL" 聽 聽 聽ENTRY "PassWord" 聽 聽 OF oIni DEFAULT "91502127"
聽 聽 聽 GET oApp:nPort 聽 聽 聽 聽 聽SECTION "MYSQL" 聽 聽 聽ENTRY "Port" 聽 聽 聽 聽 OF oIni DEFAULT 3306
聽 聽 聽 GET oApp:cDriveName 聽 聽 SECTION "MYSQL" 聽 聽 聽ENTRY "DriveName" 聽 聽OF oIni DEFAULT "Driver={MySQL ODBC 5.1 Driver}"
聽 聽 聽 GET oApp:cDBName 聽 聽 聽 聽SECTION "DATABASE" 聽 ENTRY "DBName" 聽 聽 聽 OF oIni DEFAULT "SiaWin"
聽 聽ENDINI
RETURN( NIL )


/*
* ---------------------------------------------------------------------------- *
*/
STATIC FUNCTION Conecta( )
聽 聽LOCAL oError

聽 聽TRY
聽 聽 oApp:oCon := TOleAuto( ) :new( "adodb.connection" )
聽 聽CATCH oError
聽 聽MsgStop( "No se ha podido crear la conexi贸n al servidor !", oApp:cAplicacion )
聽 聽RETURN( .F. )
聽 聽END

聽 聽oApp:oCon:ConnectionString := AllTrim( oApp:cDriveName ) + ;
聽 聽 聽 ";Server=" + AllTrim( oApp:cServer ) + ;
聽 聽 聽 ";Port=" + STR( oApp:nPort ) + ;
聽 聽 聽 ";Database=" + "" + ;
聽 聽 聽 ";User=" + AllTrim( oApp:cUser ) + ;
聽 聽 聽 ";Password=" + AllTrim( oApp:cPass ) + ;
聽 聽 聽 ";Option=3;"

聽 聽oApp:oCon:CommandTimeout 聽 聽 聽:= 1800 聽 聽 // 30 Minutos * 60 segundos
聽 聽oApp:oCon:ConnectionTimeout 聽 := 28800 聽 聽// 聽8 horas * 360 segundos

聽 聽TRY
聽 聽 聽 oApp:oCon:Open()
聽 聽 聽 oApp:oCon:Execute( "SET SESSION wait_timeout = 86400;" )
聽 聽CATCH oError
聽 聽 聽 MsgInfo( "No se pudo lograr la conexi贸n al servidor, REVISE LA CONEXION DE SU RED O LA CONEXION A INTERNET !" + CRLF +;
聽 聽 聽 聽 聽 聽 聽 聽oApp:oCon:ConnectionString, oApp:cAplicacion )
聽 聽 聽 FW_ShowAdoError(oApp:oCon)
聽 聽 聽 RETURN( .F. )
聽 聽END
RETURN( .T. )
Saludos
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 1144
Joined: Mon Feb 05, 2007 07:15 PM
Re: Dudas probando METRO
Posted: Tue May 21, 2024 04:21 AM
cierto Armando, tengo usando tmetro desde hace mucho tiempo
y no me hab铆a percatado de ese BUG,
pens茅 que mi cliente estaba loco :D :D :) :) :lol: :lol:
Cesar Cortes Cruz

SysCtrl Software

Mexico



' Sin +- FWH es mejor "
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Dudas probando METRO
Posted: Tue May 21, 2024 05:11 AM
Armando,

En la Clase TMetro hay que hacer esta modificaci贸n: Lo incluimos en el pr贸ximo build de FWH.
Code (fw): Select all Collapse
METHOD Activate() CLASS TMetro

聽 聽ACTIVATE WINDOW ::oWnd MAXIMIZED ;
聽 聽 聽 ON PAINT ( cPS,;
聽 聽 聽 聽 聽 聽 聽 聽 聽DrawBitmap( hDC, ::hBitmap, 0, 0, GetSysMetrics( 0 ), GetSysMetrics( 1 ) ),;
聽 聽 聽 聽 聽 聽 聽 聽 聽::oWnd:Say( 3, 16, ::cTitle,,, ::oFont,, .T. ),;
聽 聽 聽 聽 聽 聽 聽 聽 聽::oWnd:Say( 2, 130, CDoW( Date() ),,, ::oFont,, .T. ),;
聽 聽 聽 聽 聽 聽 聽 聽 聽::oWnd:Say( 7, 130, CMonth( Date() ) + " " + ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽AllTrim( Str( Day( Date() ) ) ),,, ::oFont,, .T. ) ) 
聽 聽 聽 // ON CLICK ( nRow, nCol, nKeyFlags, ::oWnd:End() ) 聽 聽

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Dudas probando METRO
Posted: Tue May 21, 2024 05:25 AM
Aqui est谩 la Clase TMetro modificada para poder variar la posici贸n del t铆tulo, dia, mes y hora. Incluimos estos cambios en el pr贸ximo build de FWH.

Muchas gracias por el feedback :-)

* Enhancement: Class TMetro was exiting when clicking on the window, now it is ok. New DATAs for the
title, day, month and hour, so they can be placed on different coordinates. Many thanks to Armando feedback!
Code (fw): Select all Collapse
#include "FiveWin.ch"

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

CLASS TMetro

聽 聽DATA 聽oWnd, oFont, oFontB
聽 聽DATA 聽cFileName
聽 聽DATA 聽aButtons
聽 聽DATA 聽nOriginX, nOriginY
聽 聽DATA 聽nBtnWidth, nBtnHeight
聽 聽DATA 聽cTitle
聽 聽DATA 聽nRow, nCol
聽 聽DATA 聽oTimer
聽 聽DATA 聽hBitmap
聽 聽DATA 聽nTimeRow 聽INIT 聽13
聽 聽DATA 聽nTimeCol 聽INIT 135
聽 聽DATA 聽nTitleRow INIT 聽 3 
聽 聽DATA 聽nTitleCol INIT 聽16
聽 聽DATA 聽nDayRow 聽 INIT 聽 2
聽 聽DATA 聽nDayCol 聽 INIT 130
聽 聽DATA 聽nMonthRow INIT 聽 7
聽 聽DATA 聽nMonthCol INIT 130
聽 聽
聽 聽METHOD New( cTitle, nBtnWidth, nBtnHeight, cFileName )
聽 聽
聽 聽METHOD Activate()
聽 聽
聽 聽METHOD AddButton( cCaption, nClrText, nClrPane, lLarge, cImgName, bAction ) 
聽 聽
聽 聽METHOD End() INLINE ::oWnd:End(), ::oFont:End(), ::oFontB:End(), DeleteObject( ::hBitmap )
聽 聽
ENDCLASS

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

METHOD New( cTitle, nBtnWidth, nBtnHeight, cFileName ) CLASS TMetro

聽 聽DEFAULT cTitle := "MyApp", nBtnWidth := 132, nBtnHeight := 132
聽 聽
聽 聽::cTitle 聽 聽 = cTitle
聽 聽::aButtons 聽 = {}
聽 聽::nBtnWidth 聽= nBtnWidth
聽 聽::nBtnHeight = nBtnHeight
聽 聽::nOriginX 聽 = 200
聽 聽::nOriginY 聽 = 200
聽 聽::nRow 聽 聽 聽 = 聽 0
聽 聽::nCol 聽 聽 聽 = 聽 0
聽 聽
聽 聽if File( cFileName )
聽 聽 聽 ::hBitmap = ReadBitmap( 0, cFileName )
聽 聽endif 聽 聽 
聽
聽 聽DEFINE FONT ::oFont NAME "Segoe UI Light" SIZE 0, -52 

聽 聽DEFINE FONT ::oFontB NAME "Segoe UI Light" SIZE 0, -60 BOLD 

聽 聽DEFINE WINDOW ::oWnd STYLE nOr( WS_POPUP, WS_VISIBLE ) ;
聽 聽 聽 COLOR CLR_WHITE, RGB( 15, 109, 57 )
聽 聽
聽 聽DEFINE TIMER ::oTimer OF ::oWnd ACTION ::oWnd:Say( ::nTimeRow, ::nTimeCol, Time(),, CLR_BLACK, ::oFontB )
聽 聽
聽 聽ACTIVATE TIMER ::oTimer
聽 聽
return Self 聽 

//----------------------------------------------------------------------------//
聽 聽
METHOD Activate() CLASS TMetro

聽 聽ACTIVATE WINDOW ::oWnd MAXIMIZED ;
聽 聽 聽 ON PAINT ( cPS,;
聽 聽 聽 聽 聽 聽 聽 聽 聽DrawBitmap( hDC, ::hBitmap, 0, 0, GetSysMetrics( 0 ), GetSysMetrics( 1 ) ),;
聽 聽 聽 聽 聽 聽 聽 聽 聽::oWnd:Say( ::nTitleRow, ::nTitleCol, ::cTitle,,, ::oFont,, .T. ),;
聽 聽 聽 聽 聽 聽 聽 聽 聽::oWnd:Say( ::nDayRow, ::nDayCol, CDoW( Date() ),,, ::oFont,, .T. ),;
聽 聽 聽 聽 聽 聽 聽 聽 聽::oWnd:Say( ::nMonthRow, ::nMonthCol, CMonth( Date() ) + " " + ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽AllTrim( Str( Day( Date() ) ) ),,, ::oFont,, .T. ) )
return nil 聽 

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

METHOD AddButton( cCaption, nClrText, nClrPane, lLarge, cImgName, bAction ) CLASS TMetro

聽 聽local oBtn
聽 聽local nX := ::nOriginX + ( ::nRow * ( ::nBtnHeight + 8 ) ) 
聽 聽local nY := ::nOriginY + ( ::nCol * ( ::nBtnWidth + 8 ) )
聽 聽
聽 聽DEFAULT lLarge := .F.
聽 聽
聽 聽if File( cImgName )
聽 聽 聽 @ nX, nY BTNBMP oBtn ;
聽 聽 聽 聽 聽SIZE ( ::nBtnWidth * If( lLarge, 2, 1 ) ) + If( lLarge, 8, 0 ), ::nBtnHeight ;
聽 聽 聽 聽 聽OF ::oWnd PROMPT cCaption NOBORDER FILENAME cImgName
聽 聽else 聽 
聽 聽 聽 @ nX, nY BTNBMP oBtn ;
聽 聽 聽 聽 聽SIZE ( ::nBtnWidth * If( lLarge, 2, 1 ) ) + If( lLarge, 8, 0 ), ::nBtnHeight ;
聽 聽 聽 聽 聽OF ::oWnd PROMPT cCaption NOBORDER RESOURCE cImgName
聽 聽endif 聽 
聽 聽 聽 
聽 聽oBtn:bAction = bAction 聽 
聽 聽 聽 
聽 聽oBtn:SetColor( nClrText, nClrPane ) 聽 聽
聽 聽
聽 聽AAdd( ::aButtons, oBtn )
聽 聽
聽 聽::nCol++
聽 聽if lLarge
聽 聽 聽 ::nCol++
聽 聽endif 聽 
聽 聽if ( ATail( ::aButtons ):nLeft + ATail( ::aButtons ):nWidth ) > ( ::nOriginY * 4 ) + 50 
聽 聽 聽 ::nRow++
聽 聽 聽 ::nCol = 0
聽 聽endif 聽 
聽 聽
return nil 聽 聽

//----------------------------------------------------------------------------//
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Dudas probando METRO
Posted: Tue May 21, 2024 02:25 PM

Maestro Antonio:

Muchas gracias, voy a probarla.

Saludos

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Dudas probando METRO
Posted: Tue May 21, 2024 03:48 PM

Maestro Antonio:

Ahora todo esta excelente, solo un detalle m谩s de est茅tica en el reloj:

Cuando el 煤ltimo d铆gito de los segundos es cero, por ejemplo :50 al pasar

al siguiente segundo :51, se queda parte del cero, es decir el 1 es menos

ancho que el cero. ojal谩 me haya explicado.

Gracias Antonio

Saludos

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Dudas probando METRO
Posted: Wed May 22, 2024 09:13 AM
Armando,

Esta parece una buena y simple soluci贸n. La incluimos para el pr贸ximo build de FWH.
Code (fw): Select all Collapse
 聽 DEFINE TIMER ::oTimer OF ::oWnd ;
聽 聽 聽 ACTION ::oWnd:Say( ::nTimeRow, ::nTimeCol, " " + Time() + " ",, CLR_BLACK, ::oFontB,, .F. )
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Dudas probando METRO
Posted: Wed May 22, 2024 02:07 PM

Maestro:

Excelente, simple pero funcional.

SAludos

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero

Continue the discussion