FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour calendar not run ( DBLCLICK)
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
calendar not run ( DBLCLICK)
Posted: Sat May 20, 2023 05:11 PM
I use a get to select date

@ nRow, 70 GET aGet[1] VAR ddatacambio SIZE 100,24 PIXEL OF oDlgSub;
BITMAP "date.bmp" ACTION ( Selecdata(@ddatacambio, aGet[1]),aGet[1]:refresh())

the calendar run but when I double click it not run
i.e. it doesn't close the dialog and it doesn't refresh the date in the get
Code (fw): Select all Collapse
#include "FiveWin.ch"
#include "calendar.ch"

Function SelecData(dFechaPres, oGet)

   local oDlg, oButton1, oButton2, oSayFecha, oCalendar
   local lOk := .f.
   local dFecha
   local aPoint := AdjustWnd(oGet, 97*2, 88*2)

    local nWd  := GetSysMetrics(0) * .20
    local nHt  := (GetSysMetrics(1) / 5 )

   IF Empty(dFechaPres)
      dFecha := Date()
   ELSE
      dFecha := dFechaPres
   ENDIF

   DEFINE DIALOG oDlg SIZE nWd, nHt   PIXEL TRUEPIXEL ;
   COLOR CLR_BLACK,  RGB( 245,245,235)  ;
   TITLE "Selezione data"

   oDlg:lHelpIcon = .f.
   *oDlg:SetFont(oApp():oFont)

   @ 0,1 CALENDAR oCalendar VAR dFecha ;
         SIZE 200, 170 OF oDlg ;
         DBLCLICK  ( lOk := .t., oDlg:End())
 *  oCalendar:SetFont(oApp():oFont)
   oCalendar:oCursor := TCursor():New(,'HAND')

   ACTIVATE DIALOG oDlg               ;
      ON PAINT ( oDlg:Move(aPoint[1], aPoint[2],,,.t.), ;
                 oCalendar:SetFocus(.t.) )

   if lOK
      oGet:cText( oCalendar:dDate )
      sysrefresh()
   endif

return NIL
function AdjustWnd( oBtn, nWidth, nHeight )

   local nMaxWidth, nMaxHeight
   local aPoint

   aPoint := { oBtn:nTop + oBtn:nHeight(), oBtn:nLeft }
   clientToScreen( oBtn:oWnd:hWnd, @aPoint )

   nMaxWidth  := GetSysMetrics(0)
   nMaxHeight := GetSysMetrics(1)

   if  aPoint[2] + nWidth > nMaxWidth
      aPoint[2] := nMaxWidth -  nWidth
   endif

   if  aPoint[1] + nHeight > nMaxHeight
      aPoint[1] := nMaxHeight - nHeight
   endif

   return aPoint
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: calendar not run ( DBLCLICK)
Posted: Sat May 20, 2023 05:42 PM
hi Silvio,

try
Code (fw): Select all Collapse
   DBLCLICK MsgInfo( oCalendar:GetDate() ) ;
greeting,

Jimmy
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: calendar not run ( DBLCLICK)
Posted: Sat May 20, 2023 05:56 PM
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: calendar not run ( DBLCLICK)
Posted: Sat May 20, 2023 07:10 PM
karinha wrote:https://forums.fivetechsupport.com/viewtopic.php?f=6&t=42588&p=256489&hilit=DBLCLICK&sid=2be243c98a21a4ca0d0c035997a14f73&sid=2be243c98a21a4ca0d0c035997a14f73#p256489

Regards.
I not understood How resolve it
no entendi como solucionarlo


this is the test
Code (fw): Select all Collapse
#include "FiveWin.ch"
#include "calendar.ch"



Function Test()
   local oFont,oBold
   local oDlgSub,oBarSub
   local nRecord
   local oBtnAnnulla,oBtnAiuto,oBtnConferma
   local oCursorBtn :=TCursor():New(,'HAND')

   local nWd  := GetSysMetrics(0) * .35
   local nHt  := (GetSysMetrics(1) / 5 )

   local ddatacambio:=ctod("  /  /  "),cGiorno:="",nCambio:=""

   local nRow:= 0,nCol:= 10
   local nInterlinea := 30
   local oBtnGetExchange
   local cMoneta_azienda:="EUR"

   local oSay:=array(2)
   local aGet:=array(2)

   oFont := TFont():New( "Tahoma", 0, 14,, )
   oBold := TFont():New( "Tahoma", 0, 14,,.t. )

   DEFINE DIALOG oDlgSub SIZE nWd, nHt   PIXEL TRUEPIXEL ;
   COLOR CLR_BLACK,  RGB( 245,245,235)  FONT oFont  ;
   TITLE "test"


   nRow+=8
   @ nRow, 10 SAY oSay[1] PROMPT  "Data " SIZE 100,25  PIXEL OF oDlgSub  TRANSPARENT  FONT oFont
   nRow-=2
   @ nRow, 70 GET aGet[1] VAR ddatacambio SIZE 100,24 PIXEL OF oDlgSub;
      BITMAP "CALEND" ACTION ( SelecFecha(@ddatacambio, aGet[1]),aGet[1]:refresh())


ACTIVATE DIALOG oDlgSub CENTER
return nil
//---------------------------------------------------------------------------------//


Function SelecFecha(dFechaPres, oGet)

   local oDlg,  oSayFecha, oCalendar
   local lOk := .f.
   local dFecha
   local aPoint := AdjustWnd(oGet, 97*2, 88*2)

    local nWd  := GetSysMetrics(0) * .18
    local nHt  := (GetSysMetrics(1) / 5 )

   IF Empty(dFechaPres)
      dFecha := Date()
   ELSE
      dFecha := dFechaPres
   ENDIF

   DEFINE DIALOG oDlg SIZE nWd, nHt   PIXEL TRUEPIXEL ;
   COLOR CLR_BLACK,  RGB( 245,245,235)  ;
   TITLE "Selezione data"
   oDlg:lHelpIcon = .f.

   @ 0,1 CALENDAR oCalendar VAR dFecha ;
         SIZE 200, 170 OF oDlg    ;
         DBLCLICK ( MsgInfo('Dobleclick'), lOk := .T., oDlg:End() )

        oCalendar:bLDblClick := {|| ( MsgInfo('Dobleclick'), lOk := .T., oDlg:End() ) }
       oCalendar:oCursor := TCursor():New(,'HAND')

   ACTIVATE DIALOG oDlg               ;
      ON PAINT ( oDlg:Move(aPoint[1], aPoint[2],,,.t.), ;
                 oCalendar:SetFocus(.t.) )

   if lOK
      oGet:cText( oCalendar:dDate )
      sysrefresh()
   endif

   return NIL

     function AdjustWnd( oBtn, nWidth, nHeight )

   local nMaxWidth, nMaxHeight
   local aPoint

   aPoint := { oBtn:nTop + oBtn:nHeight(), oBtn:nLeft }
   clientToScreen( oBtn:oWnd:hWnd, @aPoint )

   nMaxWidth  := GetSysMetrics(0)
   nMaxHeight := GetSysMetrics(1)

   if  aPoint[2] + nWidth > nMaxWidth
      aPoint[2] := nMaxWidth -  nWidth
   endif

   if  aPoint[1] + nHeight > nMaxHeight
      aPoint[1] := nMaxHeight - nHeight
   endif

   return aPoint
¿Funciona para ti?
does it work for you?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: calendar not run ( DBLCLICK)
Posted: Sat May 20, 2023 07:30 PM

What I understood in the topic is that you need to report the problem to Master Antônio, so he can send an update. Explain the problem to Liñares, please.

Lo que entendí en el tema es que debe informar el problema al maestro Antônio para que envíe una actualización. Explíquele el problema a Liñares, por favor.

Regards, saludos.

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: calendar not run ( DBLCLICK)
Posted: Sat May 20, 2023 08:18 PM
hi Silvio,

you use the wrong Control ;)
you have to use DTPICKER instead of CALENDAR :!:

in CLASS TCALENDAR is
Code (fw): Select all Collapse
METHOD HandleEvent() VIRTUAL
which "disable" Event like to "close" it ... i don´t understand "why" ...

CALENDAR can show more the 1 Month

you can "mark" DateStart to DateEnd so you do not need 2 x DTPICKER

p.s. as CLASS TCALENDAR seem not "hardcode" somewhere else you can make a copy and delete METHOD HandleEvent()
greeting,

Jimmy
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: calendar not run ( DBLCLICK)
Posted: Sun May 21, 2023 11:26 AM

Jimmy,

if i use datepick instead of calendar then i don't get empty date.

why do i need the date to be empty?

because I have to lock the btnbmp control in fact the btnbmp control is active only when the data field is not empty.

Do you understand now why I have to use a control other than datepick?

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: calendar not run ( DBLCLICK)
Posted: Sun May 21, 2023 04:45 PM
Please someone can tell me where is the error ?
I need to use tcalendar and not datepick because I need the empty date on the get




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



Function Test()
   local oFont,oBold
   local oDlgSub,oBarSub
   local nRecord
   local oBtnAnnulla,oBtnAiuto,oBtnConferma
   local oCursorBtn :=TCursor():New(,'HAND')

   local nWd  := GetSysMetrics(0) * .35
   local nHt  := (GetSysMetrics(1) / 5 )

   local ddatacambio:=ctod("  /  /  "),cGiorno:="",nCambio:=""

   local nRow:= 0,nCol:= 10
   local nInterlinea := 30
   local oBtnGetExchange
   local cMoneta_azienda:="EUR"

   local oSay:=array(2)
   local aGet:=array(2)

   oFont := TFont():New( "Tahoma", 0, 14,, )
   oBold := TFont():New( "Tahoma", 0, 14,,.t. )

   DEFINE DIALOG oDlgSub SIZE nWd, nHt   PIXEL TRUEPIXEL ;
   COLOR CLR_BLACK,  RGB( 245,245,235)  FONT oFont  ;
   TITLE "test"


   nRow+=8
   @ nRow, 10 SAY oSay[1] PROMPT  "Data " SIZE 100,25  PIXEL OF oDlgSub  TRANSPARENT  FONT oFont
   nRow-=2
   @ nRow, 70 GET aGet[1] VAR ddatacambio SIZE 100,24 PIXEL OF oDlgSub;
      BITMAP "CALEND" ACTION ( SelecFecha(@ddatacambio, aGet[1]),aGet[1]:refresh())


ACTIVATE DIALOG oDlgSub CENTER
return nil
//---------------------------------------------------------------------------------//


Function SelecFecha(dFechaPres, oGet)

   local oDlg,  oSayFecha, oCalendar
   local lOk := .f.
   local dFecha
   local aPoint := AdjustWnd(oGet, 97*2, 88*2)

    local nWd  := (GetSysMetrics(0) * .18) -30
    local nHt  := (GetSysMetrics(1) / 4 )-20

   IF Empty(dFechaPres)
      dFecha := Date()
   ELSE
      dFecha := dFechaPres
   ENDIF

   DEFINE DIALOG oDlg SIZE nWd, nHt   PIXEL TRUEPIXEL ;
   COLOR CLR_BLACK,  RGB( 245,245,235)  ;
   TITLE "Selezione data"
   oDlg:lHelpIcon = .f.

   @ 0,1 CALENDAR oCalendar VAR dFecha ;
         SIZE 200, 200 OF oDlg
        * DBLCLICK ( MsgInfo('Dobleclick'), lOk := .T., oDlg:End() )

        oCalendar:bLDblClick := {|| ( MsgInfo('Dobleclick'), lOk := .T., oDlg:End() ) }
       oCalendar:oCursor := TCursor():New(,'HAND')

   ACTIVATE DIALOG oDlg               ;
      ON PAINT ( oDlg:Move(aPoint[1], aPoint[2],,,.t.), ;
                 oCalendar:SetFocus(.t.) )

   if lOK
      oGet:cText( oCalendar:dDate )
      sysrefresh()
   endif

   return NIL

     function AdjustWnd( oBtn, nWidth, nHeight )

   local nMaxWidth, nMaxHeight
   local aPoint

   aPoint := { oBtn:nTop + oBtn:nHeight(), oBtn:nLeft }
   clientToScreen( oBtn:oWnd:hWnd, @aPoint )

   nMaxWidth  := GetSysMetrics(0)
   nMaxHeight := GetSysMetrics(1)

   if  aPoint[2] + nWidth > nMaxWidth
      aPoint[2] := nMaxWidth -  nWidth
   endif

   if  aPoint[1] + nHeight > nMaxHeight
      aPoint[1] := nMaxHeight - nHeight
   endif

   return aPoint
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: calendar not run ( DBLCLICK)
Posted: Sun May 21, 2023 05:00 PM
hi Silvio,

the "Error" is "by Concept" of TCalendar which have
METHOD HandleEvent ( ) VIRTUAL

so it will NOT react on Event like Dblclick or other :!:

you can make a copy of CLASS TCalendar(), modify and include it in you App

---

as you say you want a "empty" Input Field
but why do you "overlay" GET with Calendar / DTPicker when do "no Input yet" :?:

you can use a Button to "show" Calendar / DTPicker
you can use WHEN to "popup" Calendar / DTPicker
greeting,

Jimmy
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: calendar not run ( DBLCLICK)
Posted: Sun May 21, 2023 07:06 PM
Jimmy wrote:hi Silvio,

the "Error" is "by Concept" of TCalendar which have
METHOD HandleEvent ( ) VIRTUAL

so it will NOT react on Event like Dblclick or other :!:

you can make a copy of CLASS TCalendar(), modify and include it in you App

---

as you say you want a "empty" Input Field
but why do you "overlay" GET with Calendar / DTPicker when do "no Input yet" :?:

you can use a Button to "show" Calendar / DTPicker
you can use WHEN to "popup" Calendar / DTPicker

>you can use a Button to "show" Calendar / DTPicker
>you can use WHEN to "popup" Calendar / DTPicker
As I allready explain U I not want use datepick


I add this
Code (fw): Select all Collapse
 #define WM_MOUSELEAVE       675

METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TCalendar

   if nMsg == WM_MOUSELEAVE
      return ::Super:MouseLeave( nHiWord( nLParam ), nLoWord( nLParam ), nWParam )
   endif


return ::Super:HandleEvent( nMsg, nWParam, nLParam )
but not run
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: calendar not run ( DBLCLICK)
Posted: Sun May 21, 2023 07:50 PM
hi Silvio,
Silvio.Falconi wrote: I add this
Code (fw): Select all Collapse
 #define WM_MOUSELEAVE       675

METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TCalendar

   if nMsg == WM_MOUSELEAVE
      return ::Super:MouseLeave( nHiWord( nLParam ), nLoWord( nLParam ), nWParam )
   endif


return ::Super:HandleEvent( nMsg, nWParam, nLParam )
but not run
how you did this :?:

i have made a copy and "disable" METHOD HandleEvent() to "react" on Event like VK_ESCAPE
greeting,

Jimmy
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: calendar not run ( DBLCLICK)
Posted: Sun May 21, 2023 08:08 PM

METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TCalendar

// TODO: Verify others messages

if nMsg==WM_LBUTTONUP

      ::Super:HandleEvent( nMsg, nWParam, nLParam )

   endif

return nil

wich is the message for doubleclick ? ( wm_ ?)

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: calendar not run ( DBLCLICK) - Resolved - !!!!!
Posted: Sun May 21, 2023 08:20 PM
Resolved !!!! from Cristobal on December 2022 topic https://forums.fivetechsupport.com/viewtopic.php?f=6&t=42588&hilit=handleevent&sid=be8d4e36fad4faadc29be0a06fc6690c&sid=be8d4e36fad4faadc29be0a06fc6690c#p256286

Antonio, why not corrected it into fwh package ???

Code (fw): Select all Collapse
 //METHOD HandleEvent()  VIRTUAL
   METHOD HandleEvent( nMsg, nWParam, nLParam )
Code (fw): Select all Collapse
METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TCalendar

   Do Case

      case nMsg == WM_LBUTTONDOWN
           return ::LButtonDown( nHiWord( nLParam ), nLoWord( nLParam ), nWParam )

      case nMsg == WM_LBUTTONUP
           return ::LButtonUp( nHiWord( nLParam ), nLoWord( nLParam ), nWParam )

   EndCase

return ::Super:HandleEvent( nMsg, nWParam, nLParam )
on line 619 METHOD LButtonDown rem the called to isoverday
IF ! ::lDblClick //.and. IsOverDay( ::hWnd, nRow, nCol )
on line 651 METHOD LButtonUp rem the called to isoverday
Code (fw): Select all Collapse
IF ValType( ::nRowDbl ) == "N" /*.and. IsOverDay( ::hWnd, nRow, nCol )*/ .AND. ;
            Abs( ::nRowDbl - nRow  ) <= HEIGHTDBLCLICK .AND. Abs( ::nColDbl - nCol ) <= WIDTHDBLCLICK

run the DBLCLICK but then the calendar not run because I cannot change mounth or years
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: calendar not run ( DBLCLICK) - Resolved - !!!!!
Posted: Mon May 22, 2023 06:12 AM
Dear Silvio,

> Antonio, why not corrected it into fwh package ???
> run the DBLCLICK but then the calendar not run because I cannot change mounth or years

You answered yourself

Try this:
Code (fw): Select all Collapse
METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TCalendar

   Do Case

      case nMsg == WM_LBUTTONDOWN
           return ( ::LButtonDown( nHiWord( nLParam ), nLoWord( nLParam ), nWParam ), nil )

      case nMsg == WM_LBUTTONUP
           return ( ::LButtonUp( nHiWord( nLParam ), nLoWord( nLParam ), nWParam ), nil )

   EndCase
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: calendar not run ( DBLCLICK)
Posted: Mon May 22, 2023 08:04 PM
hi Antonio,

how to use those modification with CLASS TCalendar() :?:

do i make a copy of tcalenda.prg and include it in my App
or make a won CLASS FROM
or how to build new LIB with modify Source :?:
greeting,

Jimmy