Posición de Tcalendar en un Dialogo

Post Reply
Marcelo Via Giglio
Posts: 1033
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Posición de Tcalendar en un Dialogo

Post by Marcelo Via Giglio »

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: Select all

#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
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: Posición de Tcalendar en un Dialogo

Post by Daniel Garcia-Gil »

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 ... S.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: Select all

#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
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Marcelo Via Giglio
Posts: 1033
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: Posición de Tcalendar en un Dialogo

Post by Marcelo Via Giglio »

Daniel,

gracias por responder

Marcelo
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: Posición de Tcalendar en un Dialogo

Post by Silvio »

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 ?

Image
Best Regards, Saludos

Falconi Silvio
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: Posición de Tcalendar en un Dialogo

Post by Daniel Garcia-Gil »

Silvio

whats is the dialog and calendar size???
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: Posición de Tcalendar en un Dialogo

Post by Silvio »

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
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: Posición de Tcalendar en un Dialogo

Post by Daniel Garcia-Gil »

Silvio

you need more small calendar area... 85, 75
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: Posición de Tcalendar en un Dialogo

Post by Silvio »

for these measure I not see all the calendar on windows seven do you want see it ?

pls look it


Image
Best Regards, Saludos

Falconi Silvio
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: Posición de Tcalendar en un Dialogo

Post by Daniel Garcia-Gil »

Silvio

you should calculate the control size
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: Posición de Tcalendar en un Dialogo

Post by Silvio »

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
Post Reply