FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Posici贸n de Tcalendar en un Dialogo
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM

Posici贸n de Tcalendar en un Dialogo

Posted: Wed Apr 27, 2011 12:31 PM
Hola,

saben como ubicar un tcalendar en un dialogo dise帽ado desde c贸digo?

El siguiente ejemplo no mustra el calendario al inicio (0,0) del dialogo, pero si en el lugar del
definimos un window la cosa cambia y si funciona


Code (fw): Select all Collapse
#include "FiveWin.ch"
#include "calendar.ch"

FUNCTION Main()
聽 聽LOCAL oWnd, oCal
聽 聽LOCAL dHoy := Date()

聽 聽SET DATE TO BRITISH
聽 聽SET EPOCH TO 1980 聽 
聽 聽
聽
聽 聽DEFINE DIALOG oWnd FROM 0, 0 TO 170, 170 PIXEL 
聽 
聽 聽@ 0, 0 CALENDAR oCal VAR dHoy OF oWnd PIXEL DAYSTATE size 100,100
聽 聽 
聽 聽ACTIVATE DIALOG oWnd聽ON INIT oCal:move(0,0)

聽
RETURN NIL
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM

Re: Posici贸n de Tcalendar en un Dialogo

Posted: Wed Apr 27, 2011 02:25 PM
Marcelo

El problema (que no es problema) viene del api de window, el api usa unidades logicas para las coordenadas de los dialogos, luego son transformadas a pixels despues de su creacion, usando algoritmos de conversion dependiendo del "font", el tema no es tan simple, pero es loq ue nos ofrece el api

http://msdn.microsoft.com/en-us/library/ms645475(VS.85).aspx

el tama帽o del calendar es mas "grande", reducelo

tips: detalla la relacion del tama帽o del dialogo con el tama帽o del control

Code (fw): Select all Collapse
#include "FiveWin.ch"
#include "calendar.ch"

FUNCTION Main()
   LOCAL oWnd, oCal
   LOCAL dHoy := Date()

   SET DATE TO BRITISH
   SET EPOCH TO 1980   
   
 
   DEFINE DIALOG oWnd FROM 0, 0 TO 150, 170 PIXEL 
  
   @ 0, 0 CALENDAR oCal VAR dHoy OF oWnd PIXEL DAYSTATE size 85,75
    
   ACTIVATE DIALOG oWnd ON INIT oCal:move(0,0)

 
RETURN NIL
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM

Re: Posici贸n de Tcalendar en un Dialogo

Posted: Wed Apr 27, 2011 02:31 PM

Daniel,

gracias por responder

Marcelo

Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM

Re: Posici贸n de Tcalendar en un Dialogo

Posted: Wed Apr 27, 2011 08:02 PM
Daniel,
I tried to inser your calendar on dialog but perhaps on windows seven there is an error

look the picture

I see a space , the control is at @0,0 but it show on down of the caption

any idea ?

Best Regards, Saludos



Falconi Silvio
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM

Re: Posici贸n de Tcalendar en un Dialogo

Posted: Wed Apr 27, 2011 08:05 PM

Silvio

whats is the dialog and calendar size???

Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM

Re: Posici贸n de Tcalendar en un Dialogo

Posted: Wed Apr 27, 2011 08:31 PM

I have windows seven 64 bit home premium

include "FiveWin.ch"

include "calendar.ch"

include "constant.ch"

FUNCTION SHW_CAL()
LOCAL oWnd, oCal
LOCAL dHoy := Date()
Local nBottom := 13
Local nRight := 25.4
Local nWidth := Max( nRight * DLG_CHARPIX_W, 180 )
Local nHeight := nBottom * DLG_CHARPIX_H
Local oFontCal :=TFont():New( GetDefaultFontName(), 0, GetDefaultFontHeight(),, )

SET DATE TO BRITISH
SET EPOCH TO 1980

DEFINE DIALOG oWnd SIZE nWidth, nHeight PIXEL ;
STYLE nOr( DS_MODALFRAME, WS_POPUP, WS_CAPTION, 4 );
TITLE "Seleziona una data" FONT oFontCal

@ 0, 0 CALENDAR oCal VAR dHoy OF oWnd PIXEL DAYSTATE size 100,100

ACTIVATE DIALOG oWnd ON INIT oCal:move(0,0)

RETURN dHoy

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

pragma BEGINDUMP

include "Windows.h"

include "hbapi.h"

HB_FUNC( GETDEFAULTFONTNAME )
{
LOGFONT lf;
GetObject( ( HFONT ) GetStockObject( DEFAULT_GUI_FONT ) , sizeof( LOGFONT ), &lf );
hb_retc( lf.lfFaceName );
}

HB_FUNC( GETDEFAULTFONTHEIGHT )
{
LOGFONT lf;
GetObject( ( HFONT ) GetStockObject( DEFAULT_GUI_FONT ) , sizeof( LOGFONT ), &lf );
hb_retni( lf.lfHeight );
}

pragma ENDDUMP

Best Regards, Saludos



Falconi Silvio
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM

Re: Posici贸n de Tcalendar en un Dialogo

Posted: Wed Apr 27, 2011 08:47 PM

Silvio

you need more small calendar area... 85, 75

Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM

Re: Posici贸n de Tcalendar en un Dialogo

Posted: Wed Apr 27, 2011 09:01 PM
for these measure I not see all the calendar on windows seven do you want see it ?

pls look it


Best Regards, Saludos



Falconi Silvio
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM

Re: Posici贸n de Tcalendar en un Dialogo

Posted: Wed Apr 27, 2011 09:34 PM

Silvio

you should calculate the control size

Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM

Re: Posici贸n de Tcalendar en un Dialogo

Posted: Thu Apr 28, 2011 07:10 AM

ok, but I saw on Win xp it could be easy

then when I try it on Seven I have some problems.....

I saw for sample one dialog with says on xp run ok

the same dialog with the same says at same coordinates run bad

I think we must rewrite all dialog for windows seven and I have many problems because I must create two version for the same application

Best Regards, Saludos



Falconi Silvio

Continue the discussion