Windows 8 Gui MonthCal

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
PuzzledGreatly
Posts: 1303
Joined: 29 Sep 2013, 22:18

Windows 8 Gui MonthCal

08 Oct 2013, 18:46

On Windows 7 if I set the font size before adding a Calendar the size of the calendar matches the font. This doesn't seem to be the case with Windows 8. My Calendar is turning up at the default font size which is tiny. Can anyone confirm this problem. Is there a solution? It doesn't seem easy to get an AHK GUI to show up at the same relative size on different computers. Thanks.
User avatar
joedf
Posts: 9000
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Windows 8 Gui MonthCal

08 Oct 2013, 23:20

hmm, i dont know.. i dont use win8, but some code or screenshots.. would be nice & helpful ;)
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
PuzzledGreatly
Posts: 1303
Joined: 29 Sep 2013, 22:18

Re: Windows 8 Gui MonthCal

09 Oct 2013, 00:12

Thanks for the reply, I forgot I can post images to this forum. Here's some code for the GUI, followed by a rough screenshot showing the difference between Windows 7 (left) and Windows 8 (right:

Code: Select all

Gui, 2:-Caption ToolWindow
Gui, 2:margin, 25,25
Gui, 2:Color, 20A2DA
Gui, 2:font, s20 bold, Humnst777 BlkCn BT Black ; Gui, 1:font, s19 bold c141E78, Humnst777 BlkCn BT Black

Gui, 2:Add, Picture, x0 y0 w630 h390, pics\cBord2.png
Gui, 2:Add, MonthCal, x25 y25 vDate
Gui, 2:font, s20 bold, Humnst777 BlkCn BT Black

Gui, 2:margin, 0,0
Gui, 2:add, text, x+25, Minutes:
Gui, 2:font, s45 bold, Humnst777 BlkCn BT Black ; Gui, 1:font, s19 bold c141E78, Humnst777 BlkCn BT Black
Gui, 2:add, edit, y+5 w125 vMinutes +Number +Right

Gui, 2:font, s20 bold, Humnst777 BlkCn BT Black
Gui, 2:add, text, y+15, Calories:

Gui, 2:font, s45 bold, Humnst777 BlkCn BT Black ; Gui, 1:font, s19 bold c141E78, Humnst777 BlkCn BT Black
Gui, 2:add, edit, y+5 w125 vCalories +Number +Right

Gui, 2:font, s25 bold, Humnst777 BlkCn BT Black ; Gui, 1:font, s19 bold c141E78, Humnst777 BlkCn BT Black
Gui, 2:add, Button, y+15 w125 gTime, OK
Gui, 2:font, s16 bold cWhite, Humnst777 BlkCn BT Black ; Gui, 1:font, s19 bold c141E78, Humnst777 BlkCn BT Black
Gui, 2:margin, 25,25
AHK_calendar.png
AHK_calendar.png (16.44 KiB) Viewed 4102 times
jpginc
Posts: 124
Joined: 29 Sep 2013, 22:35

Re: Windows 8 Gui MonthCal

09 Oct 2013, 06:04

I'm using windows 7 pro and the font isn't being applied to the calendar (ie looks like the picture on the right).
User avatar
PuzzledGreatly
Posts: 1303
Joined: 29 Sep 2013, 22:18

Re: Windows 8 Gui MonthCal

09 Oct 2013, 17:25

Perhaps it has something to do with the theme? I'm using Windows Classic on my Windows 7 and I don't know what on Windows 8 but not Windows Classic. Are you using an Aero theme? How to set the size for a MonthCal control so that the size can be set regardless of which PC is being used?
just me
Posts: 9576
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Windows 8 Gui MonthCal

10 Oct 2013, 00:12

Interestingly, MS added the MCM_SIZERECTTOMIN message with Win Vista. It seems to calculate the width and height needed to show one month in a non-themed MonthCal control using the specified font. At least it's somewhat working on Win 7 x64 for me:

Code: Select all

#NoEnv
; ======================================================================================================================
; Win Vista+
; Calculate the size of a non-themed MonthCal using a specified font
; MCM_SIZERECTTOMIN = 0x101D -> http://msdn.microsoft.com/en-us/library/bb761020(v=vs.85).aspx
Gui, MC:font, s20 bold, Arial
Gui, MC:Add, MonthCal, x25 y25 w-2 vDate -Theme hwndHMC
VarSetCapacity(RECT, 16, 0)
SendMessage, 0x101D, 0, &RECT, , ahk_id %HMC% ; MCM_SIZERECTTOMIN
MCWidth := NumGet(RECT, 8, "Int")
MCHeight := NumGet(RECT, 12, "Int")
Gui, MC:Destroy
; ======================================================================================================================
Gui, 2:-Caption ToolWindow
Gui, 2:margin, 25,25
Gui, 2:Color, 20A2DA
Gui, 2:font, s20 bold, Arial 

Gui, 2:Add, Picture, x0 y0 w630 h390, pics\cBord2.png
Gui, 2:Add, MonthCal, x25 y25 w%MCWidth% h%MCHeight% vDate -Theme
Gui, 2:font, s20 bold, Arial

Gui, 2:margin, 0,0
Gui, 2:add, text, x+25, Minutes:
Gui, 2:font, s45 bold, Arial 
Gui, 2:add, edit, y+5 w125 vMinutes +Number +Right

Gui, 2:font, s20 bold, Arial
Gui, 2:add, text, y+15, Calories:

Gui, 2:font, s45 bold, Arial
Gui, 2:add, edit, y+5 w125 vCalories +Number +Right

Gui, 2:font, s25 bold, Arial
Gui, 2:add, Button, y+15 w125 gTime, OK
Gui, 2:font, s16 bold cWhite, Arial
Gui, 2:margin, 25,25
Gui, 2:Show
Return

Esc::
Time:
ExitApp

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: DecimalTurn, Google [Bot], macromint, peter_ahk and 350 guests