MONTHCALENDAR with WIDTH and HEIGHT

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
kcarmody
Posts: 152
Joined: Tue Oct 07, 2014 11:13 am
Has thanked: 8 times
Been thanked: 45 times
Contact:

MONTHCALENDAR with WIDTH and HEIGHT

Post by kcarmody »

I recently wanted to use a large font size on a MONTHCALENDAR control. It's easy to change the font size, but the width and height of the calendar do not change to accomodate the font size -- the calendar stays the same size regardless of the font size -- and there are no WIDTH or HEIGHT clauses in the MONTHCALENCAR command.

I looked through the forum and found that there are some old posts where a MONTHCALENDAR command has WIDTH and HEIGHT. I also looked through Stack Overflow and found that changing the font size in this control does change the size of the control in XP, but does not in Vista. The reason is themes -- in Vista and later, you must first turn off the theme, and then the window will be resized. So I now think that
  1. The WIDTH and HEIGHT clauses were once in HMG but were removed because they stopped working in Vista.
  2. The WIDTH and HEIGHT clauses could be added back in if there were a way to turn off the theme.
I found that there is a way to turn off the theme and add WIDTH and HEIGHT. HMG has an undocumented function SetWindowTheme() which can turn off the theme, and another undocumented function SetWindowPos() which can resize a control. So I created an alternate version of MONTHCAL that does this, and a demo that tests it.

Code: Select all

/* 
  Modified form of MONTHCALENDAR command, with WIDTH and HEIGHT clauses 
  and using _DefineMonthCal2 instead of _DefineMonthCal
*/

#xcommand @ <row>,<col> MONTHCALENDAR <name> ;
    [ <dummy1: OF, PARENT> <parent> ] ;
    [ VALUE <v> ] ;
    [ FONT <fontname> ] ;
    [ SIZE <fontsize> ] ;
    [ WIDTH <width> ] ;
    [ HEIGHT <height> ] ;
    [ <bold : BOLD> ] ;
    [ <italic : ITALIC> ] ;
    [ <underline : UNDERLINE> ] ;
    [ <strikeout : STRIKEOUT> ] ;
    [ TOOLTIP <tooltip> ] ;
    [ < notoday: NOTODAY > ] ;
    [ < notodaycircle: NOTODAYCIRCLE > ] ;
    [ < weeknumbers: WEEKNUMBERS > ] ;
    [ < invisible: INVISIBLE > ] ;
    [ < notabstop: NOTABSTOP > ] ;
    [ ON CHANGE <change> ] ;
    [ HELPID <helpid> ]     ;
  =>;
  _DefineMonthCal2 ( <"name"> , ;
                     <"parent"> , ;
                     <col> , ;
                     <row> , ;
                     <width> , ;
                     <height> , ;
                     <v> , ;
                     <fontname> , ;
                     <fontsize> , ;
                     <tooltip> , ;
                     <.notoday.> , ;
                     <.notodaycircle.> , ;
                     <.weeknumbers.> , ;
                     <{change}>  , <helpid>, <.invisible.>, <.notabstop.> ,<.bold.>, <.italic.>, <.underline.>, <.strikeout.> )

Code: Select all

/* 
    _DefineMonthCal2()

    Modified version of _DefineMonthCal() in SOURCE\h_monthcal.prg

    This version accepts nonzero width and height parameters,
    which set the width and height of the calendar.
*/

MEMVAR _HMG_SYSDATA
#include "hmg.ch"
#include "common.ch"

Function _DefineMonthCal2 ( ControlName, ParentForm, x, y, w, h, value, ;
                           fontname, fontsize, tooltip, notoday, notodaycircle, ;
                           weeknumbers, change, HelpId, invisible, notabstop, ;
                           bold, italic, underline, strikeout )
*-----------------------------------------------------------------------------*
Local cParentForm , mVar , k := 0
Local aControlHandle
Local cParentTabName

   DEFAULT w         TO 0
   DEFAULT h         TO 0
   DEFAULT value     TO date()
   DEFAULT change    TO ""
   DEFAULT bold      TO FALSE
   DEFAULT italic    TO FALSE
   DEFAULT underline TO FALSE
   DEFAULT strikeout TO FALSE

  if _HMG_SYSDATA [ 264 ] = .T.
    ParentForm := _HMG_SYSDATA [ 223 ]
    if .Not. Empty (_HMG_SYSDATA [ 224 ]) .And. ValType(FontName) == "U"
      FontName := _HMG_SYSDATA [ 224 ]
    EndIf
    if .Not. Empty (_HMG_SYSDATA [ 182 ]) .And. ValType(FontSize) == "U"
      FontSize := _HMG_SYSDATA [ 182 ]
    EndIf
  endif
  if _HMG_SYSDATA [ 183 ] > 0
    IF _HMG_SYSDATA [ 240 ] == .F.
    x   := x + _HMG_SYSDATA [ 334 ] [_HMG_SYSDATA [ 183 ]]
    y   := y + _HMG_SYSDATA [ 333 ] [_HMG_SYSDATA [ 183 ]]
    ParentForm := _HMG_SYSDATA [ 332 ] [_HMG_SYSDATA [ 183 ]]
    cParentTabName := _HMG_SYSDATA [ 225 ] 
    ENDIF
  EndIf

  If .Not. _IsWindowDefined (ParentForm)
    MsgHMGError("Window: "+ ParentForm + " is not defined. Program terminated")
  Endif

  If _IsControlDefined (ControlName,ParentForm)
    MsgHMGError ("Control: " + ControlName + " Of " + ParentForm + " Already defined. Program terminated")
  endif

  mVar := '_' + ParentForm + '_' + ControlName

  cParentForm := ParentForm

  ParentForm = GetFormHandle (ParentForm)

  if valtype(fontname) != "U" .and. valtype(fontsize) != "U"
    aControlHandle := InitMonthCal ( ParentForm, 0, x, y, w, h , fontname , fontsize , notoday , notodaycircle , weeknumbers, invisible, notabstop, bold, italic, underline, strikeout )
  Else
    aControlHandle := InitMonthCal ( ParentForm, 0, x, y, w, h , _HMG_SYSDATA [ 342 ] , _HMG_SYSDATA [ 343 ] , notoday , notodaycircle , weeknumbers, invisible, notabstop, bold, italic, underline, strikeout )
  endif

  if ISVISTA() .And. IsAppThemed()
    SetWindowTheme(aControlHandle[1], "", "")
  endif

  if w != 0 .and. h != 0
    SetWindowPos(aControlHandle[1], NIL, x, y, w, h, SWP_NOZORDER)
  endif  

  If _HMG_SYSDATA [ 265 ] = .T.
    aAdd ( _HMG_SYSDATA [ 142 ] , aControlhandle[1] )
  EndIf

  SetMonthCal( aControlHandle[1] ,year(value), month(value), day(value) )

  if valtype(tooltip) != "U"
    SetToolTip ( aControlHandle[1] , tooltip , GetFormToolTipHandle (cParentForm) )
  endif

  w := GetWindowWidth ( aControlHandle[1] )
  h := GetWindowHeight ( aControlHandle[1] )

  k := _GetControlFree()

  Public &mVar. := k

  _HMG_SYSDATA [1] [k] := "MONTHCAL" 
  _HMG_SYSDATA [2]  [k] :=  ControlName 
  _HMG_SYSDATA [3]  [k] :=  aControlHandle[1] 
  _HMG_SYSDATA [4] [k] :=   ParentForm 
  _HMG_SYSDATA [  5 ]  [k] :=  0 
  _HMG_SYSDATA [  6 ]  [k] :=  "" 
  _HMG_SYSDATA [  7 ]  [k] :=  {} 
  _HMG_SYSDATA [  8 ]  [k] :=  Nil 
  _HMG_SYSDATA [  9 ]  [k] :=  "" 
  _HMG_SYSDATA [ 10 ]  [k] :=  "" 
  _HMG_SYSDATA [ 11 ]  [k] :=  "" 
  _HMG_SYSDATA [ 12 ]  [k] :=  change 
  _HMG_SYSDATA [ 13 ]  [k] :=  .F. 
  _HMG_SYSDATA [ 14 ]  [k] :=  Nil 
  _HMG_SYSDATA [ 15 ]  [k] :=  Nil 
  _HMG_SYSDATA [ 16 ]  [k] :=  "" 
  _HMG_SYSDATA [ 17 ]  [k] :=  {} 
  _HMG_SYSDATA [ 18 ]  [k] :=  y 
  _HMG_SYSDATA [ 19 ]   [k] := x 
  _HMG_SYSDATA [ 20 ]   [k] := w 
  _HMG_SYSDATA [ 21 ]   [k] := h 
  _HMG_SYSDATA [ 22 ]   [k] := 0 
  _HMG_SYSDATA [ 23 ]   [k] := iif ( _HMG_SYSDATA [ 183 ] > 0 ,_HMG_SYSDATA [ 333 ] [_HMG_SYSDATA [ 183 ]] , -1 ) 
  _HMG_SYSDATA [ 24 ]  [k] :=  iif ( _HMG_SYSDATA [ 183 ] > 0 ,_HMG_SYSDATA [ 334 ] [_HMG_SYSDATA [ 183 ]] , -1 ) 
  _HMG_SYSDATA [ 25 ]  [k] :=  "" 
  _HMG_SYSDATA [ 26 ]  [k] :=  0 
  _HMG_SYSDATA [ 27 ]  [k] :=  fontname 
  _HMG_SYSDATA [ 28 ]  [k] :=  fontsize 
  _HMG_SYSDATA [ 29 ]  [k] :=  {bold,italic,underline,strikeout} 
  _HMG_SYSDATA [ 30 ]   [k] :=  tooltip  
  _HMG_SYSDATA [ 31 ]  [k] :=   cParentTabName
  _HMG_SYSDATA [ 32 ]  [k] :=   0  
  _HMG_SYSDATA [ 33 ]   [k] :=  ''  
  _HMG_SYSDATA [ 34 ]  [k] :=   if(invisible,FALSE,TRUE) 
  _HMG_SYSDATA [ 35 ]  [k] :=   HelpId 
  _HMG_SYSDATA [ 36 ]  [k] :=   aControlHandle[2] 
  _HMG_SYSDATA [ 37 ]  [k] :=   0 
  _HMG_SYSDATA [ 38 ]  [k] :=   .T. 
  _HMG_SYSDATA [ 39 ] [k] := 0
  _HMG_SYSDATA [ 40 ] [k] := { NIL , NIL , NIL , NIL , NIL , NIL , NIL , NIL }

Return Nil

Code: Select all

/*
  Modified version of SAMPLES\Controls\MonthCalendar\MONTHCAL_4\demo.prg 

  This version has a second calendar with WIDTH and HEIGHT clauses
  and additional menu options.
*/

#include "hmg.ch"

FUNCTION Main()

    DEFINE WINDOW Win_1 ; 
        AT 0,0 ; 
        WIDTH 500 ; 
        HEIGHT 500 ; 
        TITLE 'Win_1' ; 
        MAIN ; 
        NOSIZE  

	DEFINE MAIN MENU
    DEFINE POPUP 'Test 1'
			MENUITEM 'Set Row' ACTION Win_1.Control_1.Row := Val(InputBox('Enter Row',''))
			MENUITEM 'Set Col' ACTION Win_1.Control_1.Col := Val(InputBox('Enter Col',''))
      MENUITEM 'Set Width' ACTION Win_1.Control_1.Width := Val(InputBox('Enter Width',''))
      MENUITEM 'Set Height' ACTION Win_1.Control_1.Height := Val(InputBox('Enter Height',''))
      SEPARATOR
			MENUITEM 'Get Row' ACTION MsgInfo ( Str ( Win_1.Control_1.Row ) )
			MENUITEM 'Get Col' ACTION MsgInfo ( Str ( Win_1.Control_1.Col ) )
			MENUITEM 'Get Width' ACTION MsgInfo ( Str ( Win_1.Control_1.Width ) )
			MENUITEM 'Get Height' ACTION MsgInfo ( Str ( Win_1.Control_1.Height ) )
      MENUITEM 'Get Font Name' ACTION MsgInfo ( Win_1.Control_1.FontName )
      MENUITEM 'Get Font Size' ACTION MsgInfo ( Str ( Win_1.Control_1.FontSize ) )
      SEPARATOR
      MENUITEM 'Get Value' ACTION MsgInfo ( GetDate ( Win_1.Control_1.Value ) )
		END POPUP
    DEFINE POPUP 'Test 2'
      MENUITEM 'Set Row' ACTION Win_1.Control_2.Row := Val(InputBox('Enter Row',''))
      MENUITEM 'Set Col' ACTION Win_1.Control_2.Col := Val(InputBox('Enter Col',''))
      MENUITEM 'Set Width' ACTION Win_1.Control_2.Width := Val(InputBox('Enter Width',''))
      MENUITEM 'Set Height' ACTION Win_1.Control_2.Height := Val(InputBox('Enter Height',''))
      SEPARATOR
      MENUITEM 'Get Row' ACTION MsgInfo ( Str ( Win_1.Control_2.Row ) )
      MENUITEM 'Get Col' ACTION MsgInfo ( Str ( Win_1.Control_2.Col ) )
      MENUITEM 'Get Width' ACTION MsgInfo ( Str ( Win_1.Control_2.Width ) )
      MENUITEM 'Get Height' ACTION MsgInfo ( Str ( Win_1.Control_2.Height ) )
      MENUITEM 'Get Font Name' ACTION MsgInfo ( Win_1.Control_2.FontName )
      MENUITEM 'Get Font Size' ACTION MsgInfo ( Str ( Win_1.Control_2.FontSize ) )
      SEPARATOR
      MENUITEM 'Get Value' ACTION MsgInfo ( GetDate ( Win_1.Control_2.Value ) )
    END POPUP
	END MENU

        @ 10,10 MONTHCALENDAR CONTROL_1 ; 
            OF Win_1 ; 
            FONT 'Arial' ; 
            SIZE 8

        @ 200,10 MONTHCALENDAR CONTROL_2 ; 
            OF Win_1 ; 
            WIDTH 320 ;
            HEIGHT 230 ;
            FONT 'Arial' ; 
            SIZE 12

    END WINDOW

    ACTIVATE WINDOW Win_1

RETURN NIL

//***************************************************************************

Static Function GetDate ( dDate )

   Local nDay := Day(dDate)
   Local nMonth := Month(dDate)
   Local nYear := Year(dDate)
   Local cRet := ""

   cRet += "Day: "+StrZero(nDay,2)
   cRet += space(2)
   cRet += "Month: "+StrZero(nMonth,2)
   cRet += space(2)
   cRet += "Year: "+StrZero(nYear,4)

   Return cRet

User avatar
mustafa
Posts: 1032
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Been thanked: 234 times
Contact:

Post by mustafa »

Muy interesante
Gracias por la aportación
Saludos

Very interesting
Thanks for the input
Regards

Mustafa

User avatar
gfilatov
Posts: 779
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Has thanked: 33 times
Been thanked: 450 times
Contact:

Post by gfilatov »

kcarmody wrote:
Fri Sep 18, 2020 10:30 pm
I recently wanted to use a large font size on a MONTHCALENDAR control. It's easy to change the font size, but the width and height of the calendar do not change to accomodate the font size -- the calendar stays the same size regardless of the font size -- and there are no WIDTH or HEIGHT clauses in the MONTHCALENCAR command.
...
Hi Kevin,

Thanks for all your efforts!

FYI The Minigui Ex supports the similar feature since April 2020. 8-)

I've modified your sample definition as below:

Code: Select all

        @ 10,10 MONTHCALENDAR CONTROL_1 ; 
            OF Win_1 ; 
            FONT 'Arial' ; 
            SIZE 8

        @ 200,10 MONTHCALENDAR CONTROL_2 ; 
            OF Win_1 ; 
;//            WIDTH 320 ;
;//            HEIGHT 230 ;
            FONT 'Arial' ; 
            SIZE 12

    END WINDOW

	Win_1.CONTROL_1.BackColor := WHITE
	Win_1.CONTROL_2.BackColor := WHITE

	Win_1.CONTROL_1.Height := ( Win_1.CONTROL_1.Height ) + 2 * GetBorderHeight()
	Win_1.CONTROL_2.Height := 220
	Win_1.CONTROL_2.Width := 232

    ACTIVATE WINDOW Win_1
and the result was showed on the following screenshot. :arrow:
capture.png
capture.png (25.34 KiB) Viewed 1197 times
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein

User avatar
kcarmody
Posts: 152
Joined: Tue Oct 07, 2014 11:13 am
Has thanked: 8 times
Been thanked: 45 times
Contact:

Post by kcarmody »

Code: Select all

        @ 200,10 MONTHCALENDAR CONTROL_2 ; 
            OF Win_1 ; 
;//            WIDTH 320 ;
;//            HEIGHT 230 ;
            FONT 'Arial' ; 
            SIZE 12
Here's what the same code looks like in HMG.

demo.png
demo.png (46.86 KiB) Viewed 1159 times
gfilatov wrote:
Sat Sep 19, 2020 9:30 am
FYI The Minigui Ex supports the similar feature since April 2020. 8-)
Ah, but that's MiniGui, not HMG. MiniGui has several good features that HMG does not. But I stopped using MiniGui several years ago. It does not support Unicode, and almost everything I do now involves Unicode.

In my opinion, a development system that does not support Unicode is very limited in this age.

User avatar
AUGE_OHR
Posts: 1149
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany
Has thanked: 213 times
Been thanked: 310 times

Post by AUGE_OHR »

hi,

does HMG DatePicker / MonthCalendar support "Bold Days" :?:
it is to show e.g. Xmas with Bold Font
Date_Bold.jpg
Date_Bold.jpg (165.63 KiB) Viewed 1139 times
have fun
Jimmy

User avatar
kcarmody
Posts: 152
Joined: Tue Oct 07, 2014 11:13 am
Has thanked: 8 times
Been thanked: 45 times
Contact:

Post by kcarmody »

AUGE_OHR wrote:
Sat Sep 19, 2020 8:55 pm
does HMG DatePicker / MonthCalendar support "Bold Days" :?:
it is to show e.g. Xmas with Bold Font
I was looking for that too, but I did not see any support for bold days in HMG MonthCalendar. It might not be very hard to add this feature to MonthCalendar.

DatePicker, on the other hand, seems to be much harder to modify. Right now I don't see how to modify HMG DatePicker so that you can change the font name or font size in the calendar. (HMG now supports changing the font name and size in the base line of the control, but not in the calendar.) Bold days in the DatePicker calendar would probably be even harder.

User avatar
AUGE_OHR
Posts: 1149
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany
Has thanked: 213 times
Been thanked: 310 times

Post by AUGE_OHR »

hi
kcarmody wrote:
Sat Sep 19, 2020 10:55 pm
I was looking for that too, but I did not see any support for bold days in HMG. It might not be very hard to add this feature.
this i have in my native Control for Xbase++ using Ot4xb

Code: Select all

METHOD DXE_MonthPick:Create(
   ...
   IF ::BoldDays = .T.
      ::dwLvStyle := nOr(::dwLvStyle,MCS_DAYSTATE)
   ENDIF

   // Notify for BOLDdays
   ::SetLvNotifyCB( MCN_GETDAYSTATE   ,{|xbp,code,lp,st| ::OnGetDayState(lp) } ) 
   ::UpdateDayState()
it need set Style MCS_DAYSTATE and get Notify Event MCN_GETDAYSTATE to react on

Code: Select all

METHOD DXE_MonthPick:OnGetDayState(lp) 
LOCAL ds := NMDAYSTATE():New()                   // use NMDAYSTATE Structure
LOCAL ts  := FileTime64():New()                  // Filetime
LOCAL ym1,sh,d,d1,d2,n,nn,p

   ds:_link_(lp,.F.)                                // read/write access

   p := ds:prgDayState // copy the pointer to local just for fast access
   @kernel32:SystemTimeToFileTime(ds:stStart,ts)    // set Datetime
   d1  := ts:dDate                                  // 1st Day
   ym1 := (ts:Year() * 12) + ts:Month()             // Year+Month
   ts:AddMonths( ds:cDayState )                     // ???
   d2 := ts:dDate - 1                               // Day before
   DEFAULT ::aBoldDays := Array(0)                  // if EMPTY(::aBoldDays)
   nn := LEN( ::aBoldDays )                         // LEN() Array
   @ot4xb:_bset(p,0, 4 *  ds:cDayState )            // reset existing

   FOR n := 1 to nn
      d := ::aBoldDays[n]                           // work Day
      IF d >= d1 .and. d <= d2                      // does it match
         // calculation
         sh := (((Year(d)* 12) + Month(d)) - ym1) * 4
         //
         PokeDWord(p,sh,nOr( PeekDWord(p,sh) , nLShift(1,Day(d)-1)))
      ENDIF
   NEXT
RETURN 1             
to create Array of BoldDays

Code: Select all

oDPick:aBoldDays     := Holiday( YEAR( DATE() ) )

FUNCTION Holiday(nYear)
LOCAL i
LOCAL aRet := {}
LOCAL dDate

   // variable Days, depend on Eastern
   dDate := Feiertag(nYear,1) ; AADD(aRet,dDate) // Ostersonntag
   dDate++                    ; AADD(aRet,dDate) // Ostermontag
   dDate := Feiertag(nYear,2) ; AADD(aRet,dDate) // Karfreitag
*  dDate := Feiertag(nYear,3) ; AADD(aRet,dDate) // Rosenmontag
   dDate := Feiertag(nYear,4) ; AADD(aRet,dDate) // Himmelfahrt
   dDate := Feiertag(nYear,5) ; AADD(aRet,dDate) // Pfingsten
   dDate++                    ; AADD(aRet,dDate) // Pfingstmontag
   dDate := Feiertag(nYear,6) ; AADD(aRet,dDate) // Fronleichnam
*  dDate := Feiertag(nYear,7) ; AADD(aRet,dDate) // Muttertag
*  dDate := Feiertag(nYear,8) ; AADD(aRet,dDate) // Buб- und Bettag

   // fixed Holidays ( GERMAN )
   AADD(aRet,CTOD("01.01."+STRZERO(nYear,4)) ) // Neujahrstag
   AADD(aRet,CTOD("06.01."+STRZERO(nYear,4)) ) // Heilige Drei Könige
   AADD(aRet,CTOD("01.05."+STRZERO(nYear,4)) ) // Tag der Arbeit
   AADD(aRet,CTOD("15.08."+STRZERO(nYear,4)) ) // Maria Himmelfahrt
   AADD(aRet,CTOD("03.10."+STRZERO(nYear,4)) ) // Tag der Deutschen Einheit
   AADD(aRet,CTOD("31.10."+STRZERO(nYear,4)) ) // Reformationstag
   AADD(aRet,CTOD("01.11."+STRZERO(nYear,4)) ) // Allerheiligen
   AADD(aRet,CTOD("25.12."+STRZERO(nYear,4)) ) // Weihnachtstag
   AADD(aRet,CTOD("26.12."+STRZERO(nYear,4)) ) // 2. Weihnachtsfeiertag
   AADD(aRet,CTOD("01.01."+STRZERO(nYear+1,4)) )
RETURN ASORT(aRet)
set BoldDays using MCM_SETDAYSTATE

Code: Select all

METHOD DXE_MonthPick:UpdateDayState() 
LOCAL buffer
local rg      := ChrR(0,32) // buffer for the SYSTEMTIME range
// how many marked
LOCAL nCount  := @user32:SendMessageA(::hDPick, MCM_GETMONTHRANGE, GMR_DAYSTATE, @rg)
// "read" actual Year+Month into vaiable ?
LOCAL ym1     := (PeekWord(rg,0) * 12) + PeekWord(rg,2)
LOCAL ts      := FileTime64():New()              // Filetime
LOCAL sh,d,d1,d2,n,nn,p

   IF nCount < 1 
      return NIL 
   end

   @kernel32:SystemTimeToFileTime(rg,ts)            // set Datetime
   d1  := ts:dDate                                  // 1st Day
   ts:AddMonths( nCount )                           // ???
   d2 := ts:dDate - 1                               // Day before
   DEFAULT ::aBoldDays := Array(0)                  // if EMPTY(::aBoldDays)
   nn := LEN( ::aBoldDays )                         // LEN() Array
   buffer := ChrR(0, 4 * nCount)                    // each 4 byte / bit ?

   FOR n := 1 to nn
      d := ::aBoldDays[n]                           // work Day
      IF d >= d1 .and. d <= d2                      // does it match
         // calculation
         sh := (((Year(d)* 12) + Month(d)) - ym1) * 4
         //
         PokeDWord(@buffer,sh,nOr( PeekDWord(buffer,sh),nLShift(1,Day(d)-1)))
      ENDIF
   NEXT

   // now we can set MCM_SETDAYSTATE
   @user32:SendMessageA(::hDPick, MCM_SETDAYSTATE, nCount, buffer)

RETURN NIL                                       // just NIL
my Problem is to find out Equivalent to PokeDWord() / PeekWord() in harbour to translate that Code to HMG
have fun
Jimmy

User avatar
bpd2000
Posts: 1188
Joined: Sat Sep 10, 2011 4:07 am
Location: India
Has thanked: 277 times
Been thanked: 158 times

Post by bpd2000 »

kcarmody wrote:
Sat Sep 19, 2020 5:36 pm

Code: Select all

        @ 200,10 MONTHCALENDAR CONTROL_2 ; 
            OF Win_1 ; 
;//            WIDTH 320 ;
;//            HEIGHT 230 ;
            FONT 'Arial' ; 
            SIZE 12
Here's what the same code looks like in HMG.
I request you to update source at
https://github.com/HMG-Official/HMG
BPD
Convert Dream into Reality through HMG

User avatar
kcarmody
Posts: 152
Joined: Tue Oct 07, 2014 11:13 am
Has thanked: 8 times
Been thanked: 45 times
Contact:

Post by kcarmody »

bpd2000 wrote:
Sun Sep 20, 2020 9:13 am
I request you to update source at
https://github.com/HMG-Official/HMG
How do I do that? There are no instructions there that I can see. I hardly know anything about GitHub.

User avatar
mustafa
Posts: 1032
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Been thanked: 234 times
Contact:

Post by mustafa »

Hello friends:
I found a 2009 Sample
https://www.hmgforum.com/viewtopic.php? ... MBER#p7242

Try adding a calendar to my Sample ==> Marcos Antonio Gambeta routine

Code: Select all

                    
*---------------------- Color Calendario ------------------------*
*--------- Rutina cedida  Por Marcos Antonio Gambeta ------------*
#define MCM_FIRST         0x1000
#define MCM_SETCOLOR      (MCM_FIRST + 10)

#define MCSC_BACKGROUND     0   // cor de fundo (entre meses)
#define MCSC_TEXT           1   // cor do texto (datas)
#define MCSC_TITLEBK        2   // cor de fundo do título
#define MCSC_TITLETEXT      3   // cor de frente do título
#define MCSC_MONTHBK        4   // cor de fundo do mês
#define MCSC_TRAILINGTEXT   5   // cor dos dias que antecem e procedem o mês

// constantes de colores    --- color constants

#define COLOR_YELLOW        RGB(255,255,0)
#define COLOR_PINK          RGB(255,128,192)
#define COLOR_RED           RGB(255,0,0)
#define COLOR_FUCHSIA       RGB(255,0,255)
#define COLOR_BROWN         RGB(128,64,64)
#define COLOR_ORANGE        RGB(255,128,64)
#define COLOR_GREEN         RGB(0,255,0)
#define COLOR_PURPLE        RGB(128,0,128)
#define COLOR_BLACK         RGB(0,0,0)
#define COLOR_WHITE         RGB(255,255,255)
#define COLOR_GRAY          RGB(128,128,128)
#define COLOR_BLUE          RGB(0,0,255)
*-----------------------------------------------------------------*


    @ 149,695 MONTHCALENDAR Date_1;
                    FONT "Times NEW Roman" SIZE 12;
                    TOOLTIP "Choose Date ..."


Color worked with the Gambeta routine, in the operating system
Win Xp, but today I compiled again fixing some errors in the
Source Code of Remember.zip and in Win 10 to 64 bits the calendar comes out
in black and white

PS: This routine I do not know if it could be retouched for Color or is a problem I think of Win-10
In 2013 I think I no longer had the Xp on my computer
https://www.hmgforum.com/viewtopic.php? ... R&start=10

Excuse me, I don't speak English ==> Google Traductor
Saludos / Regards
Mustafa
Attachments
Screenshot.jpg
Screenshot.jpg (83.52 KiB) Viewed 992 times

Post Reply