Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #10052 > unrolled thread
| Started by | ccyasa.sbassano@gmail.com |
|---|---|
| First post | 2016-12-14 07:33 -0800 |
| Last post | 2016-12-21 06:47 +0100 |
| Articles | 13 — 3 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
Month selector ccyasa.sbassano@gmail.com - 2016-12-14 07:33 -0800
Re: Month selector "Karl-Heinz" <invalid@invalid.invalid> - 2016-12-14 19:26 +0100
Re: Month selector ccyasa.sbassano@gmail.com - 2016-12-14 13:04 -0800
Re: Month selector ccyasa.sbassano@gmail.com - 2016-12-15 04:47 -0800
Re: Month selector "Karl-Heinz" <invalid@invalid.invalid> - 2016-12-15 18:25 +0100
Re: Month selector ccyasa.sbassano@gmail.com - 2016-12-15 10:23 -0800
Re: Month selector "Karl-Heinz" <invalid@invalid.invalid> - 2016-12-15 19:24 +0100
Re: Month selector ccyasa.sbassano@gmail.com - 2016-12-15 10:34 -0800
Re: Month selector ccyasa.sbassano@gmail.com - 2016-12-17 03:47 -0800
Re: Month selector D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2016-12-18 18:01 +0100
Re: Month selector "Karl-Heinz" <invalid@invalid.invalid> - 2016-12-19 08:58 +0100
Re: Month selector ccyasa.sbassano@gmail.com - 2016-12-20 11:39 -0800
Re: Month selector "Karl-Heinz" <invalid@invalid.invalid> - 2016-12-21 06:47 +0100
| From | ccyasa.sbassano@gmail.com |
|---|---|
| Date | 2016-12-14 07:33 -0800 |
| Subject | Month selector |
| Message-ID | <b30ab6dc-18be-4a96-864c-3bcbdc4c8cb8@googlegroups.com> |
Hi, i'm trying to show the window that appears when a user clicks on month using datetimepicker. For example, the user clicks on December 2016 and a window with these info is showed: < 2016 > jan feb mar aprl may jun jul aug sep oct nov dec but no luck with that. That window i need to show. Can anyone help me with this? It's possible? Thanks.
[toc] | [next] | [standalone]
| From | "Karl-Heinz" <invalid@invalid.invalid> |
|---|---|
| Date | 2016-12-14 19:26 +0100 |
| Message-ID | <ebdh6jFil8dU1@mid.individual.net> |
| In reply to | #10052 |
Hi ??????
> i'm trying to show the window that appears when
> a user clicks on month using datetimepicker.
> < 2016 >
> jan feb mar aprl
> may jun jul aug
> sep oct nov dec
Here´s the code to show the dropdown calendar in month view. More view
options are mentioned below.
--------------
METHOD ControlNotify(oEvent) CLASS <YourWindowClass>
LOCAL pNMHDR AS _winNMHDR
LOCAL hMonthControl AS PTR
DO CASE
CASE DWORD ( oEvent:NotifyCode ) == DTN_DROPDOWN
pNMHDR := PTR ( _CAST , oEvent:lParam )
IF pNMHDR.hwndFrom == <oYourDTPicker>:Handle()
hMonthControl := SendMessage(<oYourDTPicker>:Handle() ,
DTM_GETMONTHCAL , 0 , 0L )
SendMessage( hMonthControl, MCM_SETCURRENTVIEW, 0 , MCMV_MONTH )
ENDIF
ENDCASE
RETURN SUPER:ControlNotify(oEvent)
-------------
missing defines:
--------------
DEFINE MCM_SETCURRENTVIEW := MCM_FIRST + 32
DEFINE MCMV_CENTURY := 3
DEFINE MCMV_DAY := 0
DEFINE MCMV_DECADE := 2
DEFINE MCMV_MONTH := 1
Regards
Karl-Heinz
[toc] | [prev] | [next] | [standalone]
| From | ccyasa.sbassano@gmail.com |
|---|---|
| Date | 2016-12-14 13:04 -0800 |
| Message-ID | <98197fe4-14be-4ff9-ae6c-17c327b99333@googlegroups.com> |
| In reply to | #10054 |
El miércoles, 14 de diciembre de 2016, 15:26:29 (UTC-3), Karl-Heinz escribió: > Hi ?????? > > > i'm trying to show the window that appears when > > a user clicks on month using datetimepicker. > > < 2016 > > > jan feb mar aprl > > may jun jul aug > > sep oct nov dec > > Here´s the code to show the dropdown calendar in month view. More view > options are mentioned below. > > -------------- > > METHOD ControlNotify(oEvent) CLASS <YourWindowClass> > LOCAL pNMHDR AS _winNMHDR > LOCAL hMonthControl AS PTR > > DO CASE > > CASE DWORD ( oEvent:NotifyCode ) == DTN_DROPDOWN > > pNMHDR := PTR ( _CAST , oEvent:lParam ) > > > IF pNMHDR.hwndFrom == <oYourDTPicker>:Handle() > > hMonthControl := SendMessage(<oYourDTPicker>:Handle() , > DTM_GETMONTHCAL , 0 , 0L ) > > SendMessage( hMonthControl, MCM_SETCURRENTVIEW, 0 , MCMV_MONTH ) > > ENDIF > > > ENDCASE > > RETURN SUPER:ControlNotify(oEvent) > > ------------- > missing defines: > -------------- > > DEFINE MCM_SETCURRENTVIEW := MCM_FIRST + 32 > > DEFINE MCMV_CENTURY := 3 > DEFINE MCMV_DAY := 0 > DEFINE MCMV_DECADE := 2 > DEFINE MCMV_MONTH := 1 > > > Regards > Karl-Heinz Hi, thanks Karl, this is that i need. Regards. Sebastián
[toc] | [prev] | [next] | [standalone]
| From | ccyasa.sbassano@gmail.com |
|---|---|
| Date | 2016-12-15 04:47 -0800 |
| Message-ID | <5caec2e2-9b90-44d4-954e-fc4bfe7e8b68@googlegroups.com> |
| In reply to | #10054 |
El miércoles, 14 de diciembre de 2016, 15:26:29 (UTC-3), Karl-Heinz escribió: > Hi ?????? > > > i'm trying to show the window that appears when > > a user clicks on month using datetimepicker. > > < 2016 > > > jan feb mar aprl > > may jun jul aug > > sep oct nov dec > > Here´s the code to show the dropdown calendar in month view. More view > options are mentioned below. > > -------------- > > METHOD ControlNotify(oEvent) CLASS <YourWindowClass> > LOCAL pNMHDR AS _winNMHDR > LOCAL hMonthControl AS PTR > > DO CASE > > CASE DWORD ( oEvent:NotifyCode ) == DTN_DROPDOWN > > pNMHDR := PTR ( _CAST , oEvent:lParam ) > > > IF pNMHDR.hwndFrom == <oYourDTPicker>:Handle() > > hMonthControl := SendMessage(<oYourDTPicker>:Handle() , > DTM_GETMONTHCAL , 0 , 0L ) > > SendMessage( hMonthControl, MCM_SETCURRENTVIEW, 0 , MCMV_MONTH ) > > ENDIF > > > ENDCASE > > RETURN SUPER:ControlNotify(oEvent) > > ------------- > missing defines: > -------------- > > DEFINE MCM_SETCURRENTVIEW := MCM_FIRST + 32 > > DEFINE MCMV_CENTURY := 3 > DEFINE MCMV_DAY := 0 > DEFINE MCMV_DECADE := 2 > DEFINE MCMV_MONTH := 1 > > > Regards > Karl-Heinz The code works excellent, now i try to subclass DatimePicker as MonthSelector and move the code to MonthSelector to avoid duplicate that code en every window that i need this behaviour. I try adapting the code in MonthSelector:Dispatch method without luck: METHOD Dispatch(oEvent) CLASS MonthSelector LOCAL pNMHDR AS _winNMHDR LOCAL hMonthControl AS PTR IF (oEvent:Message == WM_NOTIFY) pNMHDR:= PTR(_CAST, oEvent:lParam) IF (pNMHDR._code == DTN_DROPDOWN) hMonthControl:= SendMessage(SELF:Handle(), DTM_GETMONTHCAL, 0, 0L) SendMessage(hMonthControl, MCM_SETCURRENTVIEW, 0, MCMV_MONTH) ENDIF ENDIF RETURN SUPER:Dispatch(oEvent) Any hint? Thanks. Sebastián
[toc] | [prev] | [next] | [standalone]
| From | "Karl-Heinz" <invalid@invalid.invalid> |
|---|---|
| Date | 2016-12-15 18:25 +0100 |
| Message-ID | <ebg1vvF6p3nU1@mid.individual.net> |
| In reply to | #10058 |
Hi Sebastian,
>
> METHOD Dispatch(oEvent) CLASS MonthSelector
>
on control level you don´t receive a DTN_DROPDOWN. What you can do is to use
a window base class ( assuming in the example that your DTPickers are
sitting on DataDialogs ) and a DTPicker class.
-----------------------------
CLASS BaseDataDialog INHERIT DataDialog
METHOD ControlNotify(oEvent) CLASS BaseDataDialog
LOCAL pnMHDR AS _winNMHDR
LOCAL oDP AS DateTimePicker
DO CASE
CASE DWORD ( oEvent:NotifyCode ) == DTN_DROPDOWN
pnMHDR := PTR ( _CAST , oEvent:lParam )
oDP := GetObjectByHandle ( pnMHDR.hwndFrom )
IF oDP != NULL_OBJECT .AND. IsMethod ( oDP , #__SetView )
Send ( oDP , #__SetView )
ENDIF
ENDCASE
RETURN SUPER:ControlNotify(oEvent)
------------------------------------
the required DTPicker class
-----------------------------------
CLASS BaseDateTimePicker INHERIT DateTimePicker
PROTECT _nView := MCMV_DAY AS INT // Default is day-view
METHOD __SetView() CLASS BaseDateTimePicker
LOCAL hMonthControl AS PTR
hMonthControl := SendMessage(SELF:Handle() , DTM_GETMONTHCAL , 0 , 0L )
SendMessage( hMonthControl, MCM_SETCURRENTVIEW, 0 , _nView )
RETURN SELF
ASSIGN View ( nView ) CLASS BaseDateTimePicker
// MCMV_CENTURY
// MCMV_DAY
// MCMV_DECADE
// MCMV_MONTH
_nView := nView
RETURN nView
----------
as long as you do not assign a value > MCMV_DAY to <oDP>:View, the dropdown
calendar is shown in day-view.
regards
Karl-Heinz
[toc] | [prev] | [next] | [standalone]
| From | ccyasa.sbassano@gmail.com |
|---|---|
| Date | 2016-12-15 10:23 -0800 |
| Message-ID | <ea6fdc36-bfdb-4c1c-b707-fbb831e0b6f1@googlegroups.com> |
| In reply to | #10069 |
El jueves, 15 de diciembre de 2016, 14:25:21 (UTC-3), Karl-Heinz escribió: > Hi Sebastian, > > > > > METHOD Dispatch(oEvent) CLASS MonthSelector > > > > on control level you don´t receive a DTN_DROPDOWN. What you can do is to use > a window base class ( assuming in the example that your DTPickers are > sitting on DataDialogs ) and a DTPicker class. > > ----------------------------- > CLASS BaseDataDialog INHERIT DataDialog > > METHOD ControlNotify(oEvent) CLASS BaseDataDialog > LOCAL pnMHDR AS _winNMHDR > LOCAL oDP AS DateTimePicker > > > DO CASE > > CASE DWORD ( oEvent:NotifyCode ) == DTN_DROPDOWN > > pnMHDR := PTR ( _CAST , oEvent:lParam ) > > > oDP := GetObjectByHandle ( pnMHDR.hwndFrom ) > > > IF oDP != NULL_OBJECT .AND. IsMethod ( oDP , #__SetView ) > Send ( oDP , #__SetView ) > > ENDIF > > > ENDCASE > > RETURN SUPER:ControlNotify(oEvent) > > ------------------------------------ > the required DTPicker class > ----------------------------------- > > CLASS BaseDateTimePicker INHERIT DateTimePicker > > PROTECT _nView := MCMV_DAY AS INT // Default is day-view > > > METHOD __SetView() CLASS BaseDateTimePicker > LOCAL hMonthControl AS PTR > > hMonthControl := SendMessage(SELF:Handle() , DTM_GETMONTHCAL , 0 , 0L ) > > SendMessage( hMonthControl, MCM_SETCURRENTVIEW, 0 , _nView ) > > > RETURN SELF > > > ASSIGN View ( nView ) CLASS BaseDateTimePicker > > // MCMV_CENTURY > // MCMV_DAY > // MCMV_DECADE > // MCMV_MONTH > > _nView := nView > > RETURN nView > > ---------- > > as long as you do not assign a value > MCMV_DAY to <oDP>:View, the dropdown > calendar is shown in day-view. > > > regards > Karl-Heinz Thanks Karl, something similar i have. I was trying to avoid subclass the windows classes and encapsulate all the code in BaseDateTimePicker, i was thinking that i can check for that event inside this class. Regards. Sebastián
[toc] | [prev] | [next] | [standalone]
| From | "Karl-Heinz" <invalid@invalid.invalid> |
|---|---|
| Date | 2016-12-15 19:24 +0100 |
| Message-ID | <ebg5hgF7lesU1@mid.individual.net> |
| In reply to | #10069 |
Hi Sebastian,
here´s a cleaner ControlNotify - most of the time i´m on a pure Dispatch()
trip ;-)
METHOD ControlNotify(oEvent) CLASS BaseDataDialog
DO CASE
CASE DWORD ( oEvent:NotifyCode ) == DTN_DROPDOWN
IF oEvent:control != NULL_OBJECT .AND. IsMethod ( oEvent:control ,
#__SetView )
Send ( oEvent:control , #__SetView )
ENDIF
ENDCASE
RETURN SUPER:ControlNotify(oEvent)
regards
Karl-Heinz
[toc] | [prev] | [next] | [standalone]
| From | ccyasa.sbassano@gmail.com |
|---|---|
| Date | 2016-12-15 10:34 -0800 |
| Message-ID | <9e499f36-baf5-40c8-a16f-ec24e069cf26@googlegroups.com> |
| In reply to | #10071 |
El jueves, 15 de diciembre de 2016, 15:25:54 (UTC-3), Karl-Heinz escribió: > Hi Sebastian, > > here´s a cleaner ControlNotify - most of the time i´m on a pure Dispatch() > trip ;-) > > > METHOD ControlNotify(oEvent) CLASS BaseDataDialog > > DO CASE > > CASE DWORD ( oEvent:NotifyCode ) == DTN_DROPDOWN > > IF oEvent:control != NULL_OBJECT .AND. IsMethod ( oEvent:control , > #__SetView ) > Send ( oEvent:control , #__SetView ) > > ENDIF > > > ENDCASE > > RETURN SUPER:ControlNotify(oEvent) > > > regards > Karl-Heinz Yes, i see that. Thanks. My mistake thinking that can i put all the code inside de subclass of DateTimePicker. Regards. Sebastián
[toc] | [prev] | [next] | [standalone]
| From | ccyasa.sbassano@gmail.com |
|---|---|
| Date | 2016-12-17 03:47 -0800 |
| Message-ID | <925b3451-498a-427e-b5ec-d923f868891e@googlegroups.com> |
| In reply to | #10071 |
El jueves, 15 de diciembre de 2016, 15:25:54 (UTC-3), Karl-Heinz escribió: > Hi Sebastian, > > here´s a cleaner ControlNotify - most of the time i´m on a pure Dispatch() > trip ;-) > > > METHOD ControlNotify(oEvent) CLASS BaseDataDialog > > DO CASE > > CASE DWORD ( oEvent:NotifyCode ) == DTN_DROPDOWN > > IF oEvent:control != NULL_OBJECT .AND. IsMethod ( oEvent:control , > #__SetView ) > Send ( oEvent:control , #__SetView ) > > ENDIF > > > ENDCASE > > RETURN SUPER:ControlNotify(oEvent) > > > regards > Karl-Heinz One last question, is there is any way to know if the user click on < >, the year, or a month? < 2016 > jan feb mar aprl may jun jul aug sep oct nov dec Regards. Sebastián
[toc] | [prev] | [next] | [standalone]
| From | D.J.W. van Kooten <vankooten@removethis.ic2.com> |
|---|---|
| Date | 2016-12-18 18:01 +0100 |
| Message-ID | <nnfd5cdai257hobbo8094diiq7hlo41q5h@4ax.com> |
| In reply to | #10078 |
Replying on message of Sat, 17 Dec 2016 03:47:29 -0800 (PST) from
ccyasa.sbassano@gmail.com:
Hello Sebastián,
>One last question, is there is any way to know if the user click on < >, the year, or a month?
The MonthCalendar and DateTimePicker both inherit from the Control
Class. You can use the methods there like dispatch, KeyUp, Keydown,
same for the mosue.
I found this in the NG in 2000, from Frank Seidel on a question of
Jamal:
here's how I intercept date changes (should work regardless of the VO
version)
METHOD dispatch(oEvent) CLASS dlgResTermin
LOCAL ptrNMDateTimeChange AS _winNMDATETIMECHANGE
//...
CASE oEvent:Message == WM_NOTIFY
IF oEvent:wParam == DTPICK_ID // DateTimePicker
ptrNMDateTimeChange := PTR(_CAST, oEvent:lPARAM)
IF ptrNMDateTimeChange.NMHDR._code == DTN_DATETIMECHANGE
SELF:OnDateChange()
RETURN 1L
ENDIF
ENDIF
ENDCASE
RETURN SUPER:dispatch(oEvent)
Note that VO20 doesn't include the message and structure, so if you
wnat
to use it there you have to declare:
STRUCTURE NMDATETIMECHANGE
MEMBER nmhdr IS _winNMHDR
MEMBER dwFlags AS DWORD
MEMBER st IS _winSYSTEMTIME
DEFINE DTN_FIRST := (0U-760U)
DEFINE DTN_DATETIMECHANGE := DTN_FIRST + 1
Jamal added:
I figured out the problem. VO is setting focus back the DTPicker on
every change event, this caused my dispatch message not to react
properly. I removed oDTPicker:SetFocus() from the
DateTimeSelectionChanged() method of the WINDOW class
and now all fine.
Should solve your problem I think.
Dick
[toc] | [prev] | [next] | [standalone]
| From | "Karl-Heinz" <invalid@invalid.invalid> |
|---|---|
| Date | 2016-12-19 08:58 +0100 |
| Message-ID | <ebpiauFfb8tU1@mid.individual.net> |
| In reply to | #10078 |
Hi Sebastian,
>
> One last question, is there is any way to know if the user click on < >,
> the year, or a month?
>
I have no idea why you need that, but here´s a quick shot ...
BTW. The result shown in the owner caption should be one of the MCHT_xxx
constants described here:
https://msdn.microsoft.com/en-us/library/windows/desktop/bb760927(v=vs.85).aspx
-------------
METHOD Dispatch(oEvent) CLASS BaseDateTimepicker
LOCAL pnMHDR AS _winNMHDR
LOCAL hMonthControl AS PTR
LOCAL struMCHitTest IS _winMCHITTESTINFO
LOCAL struPoint IS _winPoint
DO CASE
CASE oEvent:Message == WM_NOTIFY
pnMHDR := PTR ( _CAST , oEvent:lParam )
IF pnMHDR._code == MCN_VIEWCHANGE .OR. pnMHDR._code ==
MCN_SELCHANGE
hMonthControl := SendMessage(SELF:Handle() , DTM_GETMONTHCAL , 0
, 0L )
GetCursorPos ( @struPoint )
ScreenToClient (hMonthControl , @struPoint )
struMCHitTest.cbSize := _SIZEOF ( _winMCHITTESTINFO )
struMCHitTest.pt := struPoint
SendMessage ( hMonthControl , MCM_HITTEST , 0 , LONG ( _CAST ,
@struMCHitTest ) )
SELF:owner:caption := NTrim ( struMCHitTest.uHit )
ENDIF
ENDCASE
RETURN SUPER:Dispatch(oEvent)
----------
regards
Karl-Heinz
[toc] | [prev] | [next] | [standalone]
| From | ccyasa.sbassano@gmail.com |
|---|---|
| Date | 2016-12-20 11:39 -0800 |
| Message-ID | <38876112-345b-42b4-b042-55f5b3fbc6f3@googlegroups.com> |
| In reply to | #10084 |
El lunes, 19 de diciembre de 2016, 4:59:28 (UTC-3), Karl-Heinz escribió: > Hi Sebastian, > > > > > One last question, is there is any way to know if the user click on < >, > > the year, or a month? > > > > I have no idea why you need that, but here´s a quick shot ... > > > BTW. The result shown in the owner caption should be one of the MCHT_xxx > constants described here: > > https://msdn.microsoft.com/en-us/library/windows/desktop/bb760927(v=vs.85).aspx > > ------------- > > METHOD Dispatch(oEvent) CLASS BaseDateTimepicker > LOCAL pnMHDR AS _winNMHDR > LOCAL hMonthControl AS PTR > LOCAL struMCHitTest IS _winMCHITTESTINFO > LOCAL struPoint IS _winPoint > > > DO CASE > > CASE oEvent:Message == WM_NOTIFY > > pnMHDR := PTR ( _CAST , oEvent:lParam ) > > > IF pnMHDR._code == MCN_VIEWCHANGE .OR. pnMHDR._code == > MCN_SELCHANGE > > > hMonthControl := SendMessage(SELF:Handle() , DTM_GETMONTHCAL , 0 > , 0L ) > > GetCursorPos ( @struPoint ) > ScreenToClient (hMonthControl , @struPoint ) > > > struMCHitTest.cbSize := _SIZEOF ( _winMCHITTESTINFO ) > struMCHitTest.pt := struPoint > > SendMessage ( hMonthControl , MCM_HITTEST , 0 , LONG ( _CAST , > @struMCHitTest ) ) > > SELF:owner:caption := NTrim ( struMCHitTest.uHit ) > > > ENDIF > > ENDCASE > > > RETURN SUPER:Dispatch(oEvent) > > ---------- > > regards > Karl-Heinz Hi Karl ¿which is the value for MCN_VIEWCHANGE? I find MCN_VIEWCHANGE = MCN_FIRST - 4 with MCN_FIRST = -746, but in Visual Objects MCN_FIRDT = -750, then MCN_VIEWCHANGE:= MCN_FIRST? Thanks.
[toc] | [prev] | [next] | [standalone]
| From | "Karl-Heinz" <invalid@invalid.invalid> |
|---|---|
| Date | 2016-12-21 06:47 +0100 |
| Message-ID | <ebujclFmadsU1@mid.individual.net> |
| In reply to | #10085 |
Hi Sebastian, > > MCN_VIEWCHANGE:= MCN_FIRST? > Yes, following the logic of existing MCN_xxx defines like DEFINE MCN_SELCHANGE := (MCN_FIRST + 1) the Viewchange define is: DEFINE MCN_VIEWCHANGE := (MCN_FIRST + 0) regards Karl-Heinz
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web