calendar not run ( DBLCLICK)

calendar not run ( DBLCLICK)

Postby Silvio.Falconi » Sat May 20, 2023 5: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: Select all  Expand view

#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

 
Last edited by Silvio.Falconi on Mon May 22, 2023 6:54 pm, edited 2 times in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: calendar not run ( DBLCLICK)

Postby Jimmy » Sat May 20, 2023 5:42 pm

hi Silvio,

try
Code: Select all  Expand view
  DBLCLICK MsgInfo( oCalendar:GetDate() ) ;
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: calendar not run ( DBLCLICK)

Postby karinha » Sat May 20, 2023 5:56 pm

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: calendar not run ( DBLCLICK)

Postby Silvio.Falconi » Sat May 20, 2023 7:10 pm



I not understood How resolve it
no entendi como solucionarlo


this is the test
Code: Select all  Expand view


#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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: calendar not run ( DBLCLICK)

Postby karinha » Sat May 20, 2023 7: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
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: calendar not run ( DBLCLICK)

Postby Jimmy » Sat May 20, 2023 8:18 pm

hi Silvio,

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

in CLASS TCALENDAR is
Code: Select all  Expand view
METHOD HandleEvent() VIRTUAL

which "disable" Event like to "close" it ... i don´t understand "why" ...

CALENDAR can show more the 1 Month
Image
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
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: calendar not run ( DBLCLICK)

Postby Silvio.Falconi » 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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: calendar not run ( DBLCLICK)

Postby Silvio.Falconi » Sun May 21, 2023 4: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


Image


Code: Select all  Expand view
#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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: calendar not run ( DBLCLICK)

Postby Jimmy » Sun May 21, 2023 5: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
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: calendar not run ( DBLCLICK)

Postby Silvio.Falconi » Sun May 21, 2023 7: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: Select all  Expand view
#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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: calendar not run ( DBLCLICK)

Postby Jimmy » Sun May 21, 2023 7:50 pm

hi Silvio,
Silvio.Falconi wrote:I add this
Code: Select all  Expand view
#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
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: calendar not run ( DBLCLICK)

Postby Silvio.Falconi » Sun May 21, 2023 8: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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: calendar not run ( DBLCLICK) - Resolved - !!!!!

Postby Silvio.Falconi » Sun May 21, 2023 8: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: Select all  Expand view
//METHOD HandleEvent()  VIRTUAL
   METHOD HandleEvent( nMsg, nWParam, nLParam )


Code: Select all  Expand view

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: Select all  Expand view
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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: calendar not run ( DBLCLICK) - Resolved - !!!!!

Postby Antonio Linares » Mon May 22, 2023 6: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: Select all  Expand view
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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: calendar not run ( DBLCLICK)

Postby Jimmy » Mon May 22, 2023 8: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
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 37 guests