position of a dialog near to a get
position of a dialog near to a get
How show a dialog near the get ( get ...bitmap) near to button of the get ?
Best Regards, Saludos
Falconi Silvio
Falconi Silvio
-
- Posts: 1033
- Joined: Fri Oct 07, 2005 3:33 pm
- Location: Cochabamba - Bolivia
Re: position of a dialog near to a get
Silvio,
try to get the coords with getWndRect( oGet:hWnd ) and you can apply the get's width and height too if you need other coords
I think what you want to do is a datepicker, but I have problem to close the dialog (cal) when click outside it
try to get the coords with getWndRect( oGet:hWnd ) and you can apply the get's width and height too if you need other coords
I think what you want to do is a datepicker, but I have problem to close the dialog (cal) when click outside it
Code: Select all
#include "FiveWin.ch"
#include "calendar.ch"
FUNCTION main()
LOCAL oDlg
LOCAL fecha := DATE()
SET DATE TO BRITISH
SET EPOCH TO 1980
DEFINE DIALOG oDlg FROM 10,10 TO 200,300 PIXEL
@ 20,20 GET fecha SIZE 100,22 OF oDlg PIXEL ACTION cal( fecha, self ) BITMAP "close.bmp"
ACTIVATE DIALOG oDlg
RETURN NIL
FUNCTION cal( fecha, oGet )
LOCAL oWnd, oCal, aRect
LOCAL dHoy := fecha, lOk := .T.
aRect := getWndRect( oGet:hWnd )
DEFINE DIALOG oWnd FROM 0, 0 TO 150, 174 PIXEL STYLE WS_CHILD | WS_POPUP | WS_VISIBLE
@ 0, 0 CALENDAR oCal VAR dHoy OF oWnd PIXEL DAYSTATE size 87,75 DBLCLICK oWnd:end()
oWnd:bLostFocus := {|| oWnd:end() }
oCal:bLostFocus := {|| oWnd:end() }
oCal:bKeyDown := {|nkey| IF( nKey = 13 .OR. nKey = 32, oWnd:end(), ) }
ACTIVATE DIALOG oWnd ON INIT oWnd:move(aRect[1] + oGet:nHeight ,aRect[2] )
IF lOk
oGet:cText := dHoy
oGet:refresh()
ENDIF
RETURN NIL
-
- Posts: 1033
- Joined: Fri Oct 07, 2005 3:33 pm
- Location: Cochabamba - Bolivia
Re: position of a dialog near to a get
A possible solution is change the dialog by window, but now don't work ESC to close the calendar
Code: Select all
#include "FiveWin.ch"
#include "calendar.ch"
FUNCTION main()
LOCAL oDlg
LOCAL fecha := DATE()
SET DATE TO BRITISH
SET EPOCH TO 1980
DEFINE DIALOG oDlg FROM 10,10 TO 200,300 PIXEL
@ 20,20 GET fecha SIZE 100,22 OF oDlg PIXEL ACTION cal( fecha, self ) BITMAP "close.bmp"
ACTIVATE DIALOG oDlg
RETURN NIL
FUNCTION cal( fecha, oGet )
LOCAL oWnd, oCal, aRect
LOCAL dHoy := fecha, lOk := .T., lLostFocus := .F.
aRect := getWndRect( oGet:hWnd )
DEFINE WINDOW oWnd FROM 0, 0 TO 150, 174 PIXEL STYLE WS_CHILD | WS_POPUP | WS_VISIBLE
@ 0, 0 CALENDAR oCal VAR dHoy OF oWnd PIXEL DAYSTATE size 150,174 DBLCLICK oWnd:end() //87,75
oCal:bLostFocus := {|| lLostFocus := .T., oWnd:end() }
oCal:bKeyDown := {|nkey| IF( nKey = 13 .OR. nKey = 32, oWnd:end(), ) }
oWnd:oClient := oCal
ACTIVATE WINDOW oWnd ;
ON INIT oWnd:move(aRect[1] + oGet:nHeight ,aRect[2] ) ;
VALID IF( lOk .AND. ! lLostFocus .AND. ! GetKeyState( VK_ESCAPE ), ( oGet:cText := dHoy, oGet:refresh(), .T. ), .T. )
RETURN NIL
-
- Posts: 1033
- Joined: Fri Oct 07, 2005 3:33 pm
- Location: Cochabamba - Bolivia
Re: position of a dialog near to a get
Ok,
this work, but I don't know if it's the best solution
this work, but I don't know if it's the best solution
Code: Select all
#include "FiveWin.ch"
#include "calendar.ch"
FUNCTION main()
LOCAL oDlg
LOCAL fecha := DATE()
SET DATE TO BRITISH
SET EPOCH TO 1980
DEFINE DIALOG oDlg FROM 10,10 TO 200,300 PIXEL
@ 20,20 GET fecha SIZE 100,22 OF oDlg PIXEL ACTION cal( fecha, self ) BITMAP "close.bmp"
ACTIVATE DIALOG oDlg
RETURN NIL
FUNCTION cal( fecha, oGet )
LOCAL oWnd, oCal, aRect
LOCAL dHoy := fecha, lOk := .T., lLostFocus := .F.
aRect := getWndRect( oGet:hWnd )
DEFINE WINDOW oWnd FROM 0, 0 TO 150, 174 PIXEL STYLE WS_CHILD | WS_POPUP | WS_VISIBLE
@ 0, 0 CALENDAR oCal VAR dHoy OF oWnd PIXEL DAYSTATE size 150,174 DBLCLICK oWnd:end() //87,75
oCal:bLostFocus := {|| lLostFocus := .T., oWnd:end() }
oCal:bKeyDown := {|nkey| IF( nKey = 13 .OR. nKey = 32, oWnd:end(), ) }
oWnd:oClient := oCal
oWnd:bKeyDown := {|nkey| IF( GetKeyState( VK_ESCAPE ), oWnd:end(), ) }
ACTIVATE WINDOW oWnd ;
ON INIT ( oWnd:move(aRect[1] + oGet:nHeight ,aRect[2] ), oCal:setFocus() ) ;
VALID IF( lOk .AND. ! lLostFocus .AND. ! GetKeyState( VK_ESCAPE ), ( oGet:cText := dHoy, oGet:refresh(), .T. ), .T. )
RETURN NIL
Re: position of a dialog near to a get
GOOD I'm trying your samples
Best Regards, Saludos
Falconi Silvio
Falconi Silvio
Re: position of a dialog near to a get
on W7 not run good I see only 5 days and not all lines
Best Regards, Saludos
Falconi Silvio
Falconi Silvio
-
- Posts: 1033
- Joined: Fri Oct 07, 2005 3:33 pm
- Location: Cochabamba - Bolivia
Re: position of a dialog near to a get
Hi,
it is strange, because I develop it in win7 32 bits
regards
Marcelo
it is strange, because I develop it in win7 32 bits
regards
Marcelo
Re: position of a dialog near to a get
I have
ASUS G73JW WITH 860 QM INTEL CORE 7
8 GIGA RAM
1,5 GIGA NVIDIA GEFORCE GTX440M
BLUE RAY WRITER
EAX 5.0
BUT WITH WINDOWS HOME PREMIUM 64 BIT
Now I have this resolution of screen : default 125%
I tried also with 150% or 100%
with 100% I see all smaller
ASUS G73JW WITH 860 QM INTEL CORE 7
8 GIGA RAM
1,5 GIGA NVIDIA GEFORCE GTX440M
BLUE RAY WRITER
EAX 5.0
BUT WITH WINDOWS HOME PREMIUM 64 BIT
Now I have this resolution of screen : default 125%
I tried also with 150% or 100%
with 100% I see all smaller
Best Regards, Saludos
Falconi Silvio
Falconi Silvio
-
- Posts: 1033
- Joined: Fri Oct 07, 2005 3:33 pm
- Location: Cochabamba - Bolivia
Re: position of a dialog near to a get
Silvio,
sorry I don't have win7 64.
This is an improve, now work properly when we are using themes
sorry I don't have win7 64.
This is an improve, now work properly when we are using themes
Code: Select all
FUNCTION calendar( fecha, oGet )
//------------------------------------------------------------------------------
LOCAL oWnd, oCal, aRect, w, h, x, y, cps
LOCAL dHoy := fecha, lOk := .T., lLostFocus := .F.
IF isAppthemed()
w := 224; h := 159
ELSE
w := 174; h := 150
ENDIF
aRect := getWndRect( oGet:hWnd )
y := aRect[1] + oGet:nHeight
x := aRect[2]
DEFINE WINDOW oWnd FROM y, x TO y + h, x + w PIXEL STYLE WS_CHILD | WS_POPUP | WS_VISIBLE
@ 0, 0 CALENDAR oCal VAR dHoy OF oWnd PIXEL size h,w DBLCLICK oWnd:end() //87,75
oCal:bLostFocus := {|| lLostFocus := .T., oWnd:end() }
oCal:bKeyDown := {|nkey| IF( nKey = 13 .OR. nKey = 32, oWnd:end(), ) }
oWnd:oClient := oCal
oWnd:bKeyDown := {|nkey| IF( GetKeyState( VK_ESCAPE ), oWnd:end(), ) }
ACTIVATE WINDOW oWnd ;
ON INIT ( oWnd:move(aRect[1] + oGet:nHeight ,aRect[2] ), oCal:setFocus() ) ;
VALID IF( lOk .AND. ! lLostFocus .AND. ! GetKeyState( VK_ESCAPE ), ( oGet:cText := dHoy, oGet:refresh(), .T. ), .T. )
RETURN NIL
Re: position of a dialog near to a get
I understtod I cannot use this feature I must use dtpick only... on win7 64bit
Best Regards, Saludos
Falconi Silvio
Falconi Silvio