topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday March 19, 2024, 12:02 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: T-Clock 2010 (download)  (Read 1005641 times)

Miaz

  • Participant
  • Joined in 2010
  • *
  • default avatar
  • Posts: 8
    • View Profile
    • Donate to Member
Re: T-Clock 2010 (beta - download)
« Reply #125 on: June 07, 2010, 05:14 AM »
Okay, Added Display (ISO) Week Numbers on Calendar Option, Close Calendar on Lose Focus Option, Calendar Dialog now dynamically resizes at runtime if/as needed (toggle Week Numbers to see), and Added Miscellaneous Tab to Properties Dialog to Adjust Above.

So, Let me know what Ya think.

Perfect!!!
Thank you - this is absolutely what I need.
Week number is correct - Wm for Germany will be chosen automatically.
Great job!

Stoic Joker

  • Moderator
  • Joined in 2008
  • *****
  • Posts: 6,646
    • View Profile
    • Donate to Member
Re: T-Clock 2010 (beta - download)
« Reply #126 on: June 07, 2010, 06:54 AM »
The 7.5 download includes a copy of 7.3.
:huh: - crap - fixed.

Also in the first post it says known issues none - but should it not mention my problem with the properties dialog appearing off screen when DPI is set to more than 100% and the taskbar is on the right?
Keyword: rush job. (fixed)

Some more information about it.
My screen is set to 2560x1600 (widescreen)
Where the dialog appears depends on the width of the taskbar - if it is minimum width then the dialog isn't visable, if it is very very wide then some of the dialog appears to the right of the taksbar, if it is set so that 10 notification icons fill one line then the left border and a very small part of the dialog appear under the taksbar.

I'm still kind of circling that one, because I'm not real sure how to attack it (don't give up on me just yet).

Miaz

  • Participant
  • Joined in 2010
  • *
  • default avatar
  • Posts: 8
    • View Profile
    • Donate to Member
Re: T-Clock 2010 (beta - download)
« Reply #127 on: June 07, 2010, 09:22 AM »
Hi,
In case you are looking for some nice and helpful options to include, here are some proposals:
- modify date stamps of files and folders (created / last modified / last access)
- copy names and/or path of files/folders to clipboard
Is this possible, anyhow?
I'm looking forward for every new modification  :Thmbsup:

Stoic Joker

  • Moderator
  • Joined in 2008
  • *****
  • Posts: 6,646
    • View Profile
    • Donate to Member
Re: T-Clock 2010 (beta - download)
« Reply #128 on: June 07, 2010, 10:09 AM »
Hi,
In case you are looking for some nice and helpful options to include, here are some proposals:
- modify date stamps of files and folders (created / last modified / last access)
Unfortunately that is outside the scope of the project - It's a clock.

I do however have another program that does (exactly) that, which I may consider releasing at a later date.

- copy names and/or path of files/folders to clipboard
Is this possible, anyhow?
I'm looking forward for every new modification  :Thmbsup:
This unfortunately would also be outside the (clock) scope of the project. However if you're using Windows 7, hold the Shift key while right clicking and Copy as Path will do what you're looking for.

Miaz

  • Participant
  • Joined in 2010
  • *
  • default avatar
  • Posts: 8
    • View Profile
    • Donate to Member
Re: T-Clock 2010 (beta - download)
« Reply #129 on: June 08, 2010, 12:50 AM »
Hi,
In case you are looking for some nice and helpful options to include, here are some proposals:
- modify date stamps of files and folders (created / last modified / last access)
Unfortunately that is outside the scope of the project - It's a clock.

I do however have another program that does (exactly) that, which I may consider releasing at a later date.

- copy names and/or path of files/folders to clipboard
Is this possible, anyhow?
I'm looking forward for every new modification  :Thmbsup:
This unfortunately would also be outside the (clock) scope of the project. However if you're using Windows 7, hold the Shift key while right clicking and Copy as Path will do what you're looking for.

No problem - it was only a thought.
I really appreciate the current options of your program - and thanks again for the addition of the weeks.
BTY: The program I used for the mentioned points was DMEXMenu ShellExtension 3.19.
        But I don't know, whether it's running in Windows 7 or not.
EDIT: I've just seen a thread in DonationCoder regarding DMEX. I will test later.
EDIT2: It's something different. It's a bar - I only had a simple shell extension.
Edit 3: I've tested and I'm surprised: the very old shell extension also works in Windows 7  :)
          So, forget my postings.

Edit 4: Nevertheless I still have another proposal for calendar: Is it possible to include separate switches for Month and Year? By switching Month by Month it takes very long e.g. to go forward/reverse several Years.
example:   " < >  June 2010  < >"    
I don't know if it's possible to automatically switch year at "Month-Switch" January<>December.
« Last Edit: June 08, 2010, 08:23 AM by Miaz »

Stoic Joker

  • Moderator
  • Joined in 2008
  • *****
  • Posts: 6,646
    • View Profile
    • Donate to Member
Re: T-Clock 2010 (beta - download)
« Reply #130 on: June 08, 2010, 10:27 AM »
t 4: Nevertheless I still have another proposal for calendar: Is it possible to include separate switches for Month and Year? By switching Month by Month it takes very long e.g. to go forward/reverse several Years.
example:   " < >  June 2010  < >"   
I don't know if it's possible to automatically switch year at "Month-Switch" January<>December. [/color]

Um... (I could be missing something here, but...)

Using the Windows Calendar Control arrows are only for last/next month navigations. if you want June 1975 on Win7:
Click year 3 times (the control "zooms" out to decade view)
Click the decade you want (it zooms in to year selection)
Click the year you want (it zooms in to month selection)
Click the month you want (it shows the usual month view)
done.

On XP:
Click year and scroll to year wanted (1975)
Click month and select month wanted.
done.

I'm not sure what I can add to that. (Unless I'm missing part of the question - which has happened before...)

Miaz

  • Participant
  • Joined in 2010
  • *
  • default avatar
  • Posts: 8
    • View Profile
    • Donate to Member
Re: T-Clock 2010 (beta - download)
« Reply #131 on: June 08, 2010, 12:27 PM »
Well ...  now I am at home and have tested all the things on my private PC with Windows 7.
Thank you for the lesson - everything is working as you have explained.
I've been using Windows 7 since middle of May - and I see:  still a lot to learn!

So, I think I'll be quiet in the future and will let the specialists work  :-[

Regards
Miaz

Stoic Joker

  • Moderator
  • Joined in 2008
  • *****
  • Posts: 6,646
    • View Profile
    • Donate to Member
Re: T-Clock 2010 (beta - download)
« Reply #132 on: June 08, 2010, 06:49 PM »
So, I think I'll be quiet in the future and will let the specialists work

According to a popular version of history...the last guy on earth that claimed to be perfect got crucified for his efforts... :)

Ideas are always welcome.

Stoic Joker

  • Moderator
  • Joined in 2008
  • *****
  • Posts: 6,646
    • View Profile
    • Donate to Member
Re: T-Clock 2010 (beta - download)
« Reply #133 on: June 08, 2010, 07:05 PM »
@sagji - Okay, I'm trying to workout an attack strategy on this DPI issue. I think I may have come up with an angle on it but I have one question. When you are at 2560x1600 with 144DPI does the size 8 font appear to be scaling properly??

I ask because of an old font scaling bugg that caused any size smaller than 9 to be disproportionately tiny. I'm thinking that a similar (calculations mod)  fix may work for your (off) screen position issue. But my hypothesis is dependent on the size 8 font being correctly proportioned when used in your configuration.

Also (side note) is the positioning better or worse when you push the DPI to (i believe the max) 192?

sagji

  • Participant
  • Joined in 2010
  • *
  • default avatar
  • Posts: 25
    • View Profile
    • Donate to Member
Re: T-Clock 2010 (beta - download)
« Reply #134 on: June 10, 2010, 05:23 AM »
I think the 8 point font looks OK.

With my curent setting normally the dialog appears with just the left most part visible. At 200% it doesn't appear at all. 300% is the same. At 125% it appears entirely to the left of the task bar. When I go back to 150% it also appears to the left of the task bar. If I reboot then it goes back to appearing mostly off screen.

<ADDED>
When it is partly off screen it is only off the right side - the bottom edge is in the correct place.

It might be an idea to log every step in calculating its position - as that might let us see where it is going wrong.
Or if you provide a debug version I could step through it and see if I can see anything.
« Last Edit: June 10, 2010, 05:29 AM by sagji »

haydut

  • Participant
  • Joined in 2006
  • *
  • default avatar
  • Posts: 4
    • View Profile
    • Donate to Member
Re: T-Clock 2010 (beta - download)
« Reply #135 on: June 12, 2010, 03:17 AM »
Are there any plans for some sort of popup dialogue for alarms? I have no sound on my computers, so the alarm as it stands is no use to me. It'd be nice not to have to use another program.

I notice, on my computer at least, that the time and date seems to only use the top half of the taskbar, and if I increase font size, the bottom of the time and date disappears. I seem to remember I had this problem with TclockEX in Vista. I am using Win 7 Ultimate x64 now.

Stoic Joker

  • Moderator
  • Joined in 2008
  • *****
  • Posts: 6,646
    • View Profile
    • Donate to Member
Re: T-Clock 2010 (beta - download)
« Reply #136 on: June 12, 2010, 09:01 AM »
Are there any plans for some sort of popup dialogue for alarms? I have no sound on my computers, so the alarm as it stands is no use to me. It'd be nice not to have to use another program.
That's what the blink option is for, it flashes the clock face when time is up. However if that's not enough of an attention getter, I could consider a system modal message box popup that bounces a bit. (Okay the bouncing may be a bit much, but I was just thinking that Jack Russel Terriers are impossible to ignore...:)). Would that work for you?

I notice, on my computer at least, that the time and date seems to only use the top half of the taskbar, and if I increase font size, the bottom of the time and date disappears. I seem to remember I had this problem with TclockEX in Vista. I am using Win 7 Ultimate x64 now.
Clock Size & Text Position on the Clock Text Tab are for resizing/moving the clock's position in the taskbar. Al-tho admittedly it's a bit flaky at times. Try toggling the font size up or down (hit apply) and then back where you wanted it (hit apply) if the positioning adjustments don't seem to be "taking" properly. This is an old bugg that's on my To-Kill list that I just haven't gotten to yet.



I think the 8 point font looks OK.

Perfect, something that actually works... :)

With my current setting normally the dialog appears with just the left most part visible. At 200% it doesn't appear at all. 300% is the same. At 125% it appears entirely to the left of the task bar. When I go back to 150% it also appears to the left of the task bar. If I reboot then it goes back to appearing mostly off screen.

I haven't gone quite that high, but I have been able to duplicate some of the behavior. I created a Vista Virtual PC for testing and both it and the XP VPC work fine with the original code, however ... The research I've done points at there being some behavioral changes made it Win 7 so if I don't get any other reports from people running high DPI on Win 2k/XP/Vista (Hint...!) I'll have to add a version check to any fix we can concoct.

My first batch of tests with factoring the DPI into the positioning code did manage to make the issue worse (e.g. reproducible on XP & Vista) ... So that's a good sign that I'm on the right track. I just need to figure out which screen measurement to factor in to pin the thing in the right place. So far I'm pretty sure this one is wrong:
Code: C++ [Select]
  1. iW = GetSystemMetrics(SM_CXSCREEN);  // Desktop Width
  2.   iH = GetSystemMetrics(SM_CYSCREEN); // Desktop Height
  3.  
  4. /////////////////////////////////////////////////////////////////////////////////////////////////////
  5.   hdc = GetDC(NULL);
  6.        
  7.   wscreen = MulDiv(iW, GetDeviceCaps(hdc, LOGPIXELSY), 96);
  8.   hscreen = MulDiv(iH, GetDeviceCaps(hdc, LOGPIXELSY), 96);
  9.        
  10.   ReleaseDC(NULL, hdc);

<ADDED>
When it is partly off screen it is only off the right side - the bottom edge is in the correct place.

I've noticed that behavior, and regardless of taskbar size/position too. Damn Strange it Are!

It might be an idea to log every step in calculating its position - as that might let us see where it is going wrong.
Or if you provide a debug version I could step through it and see if I can see anything.
I'm reasonably certain that the answer lies in feeding the right info into the MulDiv(...) function. as that's the only step where the DPI is handled. The rest is just subtracting the dialog & gap sizes from the X & Y before tossing it to that point via MoveWindow(...)
« Last Edit: June 12, 2010, 10:35 AM by Stoic Joker »

haydut

  • Participant
  • Joined in 2006
  • *
  • default avatar
  • Posts: 4
    • View Profile
    • Donate to Member
Re: T-Clock 2010 (beta - download)
« Reply #137 on: June 12, 2010, 10:12 AM »
Are there any plans for some sort of popup dialogue for alarms? I have no sound on my computers, so the alarm as it stands is no use to me. It'd be nice not to have to use another program.
That's what the blink option is for, it flashes the clock face when time is up. However if that's not enough of an attention getter, I could consider a system modal message box popup that bounces a bit. (Okay the bouncing may be a bit much, but I was just thinking that Jack Russel Terriers are impossible to ignore...:)). Would that work for you?

I was thinking more along the lines of being able to add a line or three of text that would pop up with each alarm, but I realise that may be beyond the scope of the T-Clock. As it happens, I just discovered "Stickies", another very useful little freeware program, which allows me to do what I need. Coincidentally, there's a setting in that program for the alarm to bounce.  :)

I notice, on my computer at least, that the time and date seems to only use the top half of the taskbar, and if I increase font size, the bottom of the time and date disappears. I seem to remember I had this problem with TclockEX in Vista. I am using Win 7 Ultimate x64 now.
Clock Size & Text Position on the Clock Text Tab are for resizing/moving the clock's position in the taskbar.

Thanks! That's what I was missing. I guess I was more, ahem, tired than I thought last night. :beerchug:

Stoic Joker

  • Moderator
  • Joined in 2008
  • *****
  • Posts: 6,646
    • View Profile
    • Donate to Member
Re: T-Clock 2010 (beta - download)
« Reply #138 on: June 12, 2010, 10:34 AM »
Are there any plans for some sort of popup dialogue for alarms? I have no sound on my computers, so the alarm as it stands is no use to me. It'd be nice not to have to use another program.
That's what the blink option is for, it flashes the clock face when time is up. However if that's not enough of an attention getter, I could consider a system modal message box popup that bounces a bit. (Okay the bouncing may be a bit much, but I was just thinking that Jack Russel Terriers are impossible to ignore...:)). Would that work for you?

I was thinking more along the lines of being able to add a line or three of text that would pop up with each alarm, but I realise that may be beyond the scope of the T-Clock. As it happens, I just discovered "Stickies", another very useful little freeware program, which allows me to do what I need. Coincidentally, there's a setting in that program for the alarm to bounce.  :)

I must say the prospect is interesting ... Can you expand on that feature description a bit? And/or toss me a link to this Stickies program?
« Last Edit: June 12, 2010, 10:37 AM by Stoic Joker »

Jibz

  • Developer
  • Joined in 2005
  • ***
  • Posts: 1,187
    • View Profile
    • Donate to Member
Re: T-Clock 2010 (beta - download)
« Reply #139 on: June 12, 2010, 01:38 PM »
Something a little like ReminderFox or DS Clock would be awesome. A pop-up that shows upcoming events.




haydut

  • Participant
  • Joined in 2006
  • *
  • default avatar
  • Posts: 4
    • View Profile
    • Donate to Member
Re: T-Clock 2010 (beta - download)
« Reply #140 on: June 12, 2010, 04:25 PM »
Jibz obviously knows what I mean, although I wasn't thinking of a birthday type of reminder, though it would be able to be used for such a thing. I suppose it ought to be called a reminder rather than an alarm, though it would work as both. When the alarm is activated, a dialogue pops up with some text that is input when the alarm/reminder is created. For example, I have to take a number of tablets each day, so each reminder could tell me which tablet I need to take. I used to use Atomic Alarm Clock, which is ideal, but doesn't work in Win x64.

Stickies is at http://www.zhornsoftware.co.uk/  I really feel I should put a good word in for the author as I am now using two of his freeware programs, the other being Zbar which allows a taskbar on a 2nd monitor.

Stoic Joker

  • Moderator
  • Joined in 2008
  • *****
  • Posts: 6,646
    • View Profile
    • Donate to Member
Re: T-Clock 2010 (beta - download)
« Reply #141 on: June 12, 2010, 05:51 PM »
Jibz obviously knows what I mean, although I wasn't thinking of a birthday type of reminder, though it would be able to be used for such a thing. I suppose it ought to be called a reminder rather than an alarm, though it would work as both.
Understood, however if I'm to add that type functionality as a target without modifying the project's (It's a clock) scope...we'll have to persist in calling it an alarm... ;)

When the alarm is activated, a dialogue pops up with some text that is input when the alarm/reminder is created. For example, I have to take a number of tablets each day, so each reminder could tell me which tablet I need to take. I used to use Atomic Alarm Clock, which is ideal, but doesn't work in Win x64.
Hm... Okay, small window, string of text, and a Jack Russel bounce function (honestly my only interest in this is the silly bouncing window) ...That sounds do-able.

First I gotta get the high DPI Dialog Position bugg figured out. but I'll toss this on the To-Do pile.


...Started with Bouncing Window, and my Mind Went Here:
FarSide.jpg

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: T-Clock 2010 (beta - download)
« Reply #142 on: June 12, 2010, 05:54 PM »
hahahahahaha

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: T-Clock 2010 (beta - download)
« Reply #143 on: June 12, 2010, 08:25 PM »
LOL...and why am I trying to figure out which Far Side it is that I can almost see beneath...

haydut

  • Participant
  • Joined in 2006
  • *
  • default avatar
  • Posts: 4
    • View Profile
    • Donate to Member
Re: T-Clock 2010 (beta - download)
« Reply #144 on: June 13, 2010, 07:20 AM »
Heh, now I am going to have to turn the house upside down to find all my forgotten Larson books.  ;D

sagji

  • Participant
  • Joined in 2010
  • *
  • default avatar
  • Posts: 25
    • View Profile
    • Donate to Member
Re: T-Clock 2010 (beta - download)
« Reply #145 on: June 13, 2010, 07:45 AM »
With my current setting normally the dialog appears with just the left most part visible. At 200% it doesn't appear at all. 300% is the same. At 125% it appears entirely to the left of the task bar. When I go back to 150% it also appears to the left of the task bar. If I reboot then it goes back to appearing mostly off screen.

I haven't gone quite that high, but I have been able to duplicate some of the behavior. I created a Vista Virtual PC for testing and both it and the XP VPC work fine with the original code, however ... The research I've done points at there being some behavioral changes made it Win 7 so if I don't get any other reports from people running high DPI on Win 2k/XP/Vista (Hint...!) I'll have to add a version check to any fix we can concoct.

My first batch of tests with factoring the DPI into the positioning code did manage to make the issue worse (e.g. reproducible on XP & Vista) ... So that's a good sign that I'm on the right track. I just need to figure out which screen measurement to factor in to pin the thing in the right place. So far I'm pretty sure this one is wrong:
Code: C++ [Select]
  1. iW = GetSystemMetrics(SM_CXSCREEN); // Desktop Width
  2.   iH = GetSystemMetrics(SM_CYSCREEN); // Desktop Height
  3.  
  4. /////////////////////////////////////////////////////////////////////////////////////////////////////
  5.   hdc = GetDC(NULL);
  6.        
  7.   wscreen = MulDiv(iW, GetDeviceCaps(hdc, LOGPIXELSY), 96);
  8.   hscreen = MulDiv(iH, GetDeviceCaps(hdc, LOGPIXELSY), 96);
  9.        
  10.   ReleaseDC(NULL, hdc);
Should wscreen not use LOGPIXELSX?
<ADDED>
When it is partly off screen it is only off the right side - the bottom edge is in the correct place.

I've noticed that behavior, and regardless of taskbar size/position too. Damn Strange it Are!

It might be an idea to log every step in calculating its position - as that might let us see where it is going wrong.
Or if you provide a debug version I could step through it and see if I can see anything.
I'm reasonably certain that the answer lies in feeding the right info into the MulDiv(...) function. as that's the only step where the DPI is handled.
But is it the only place where the DPI should be handled? What if some of the other values are already scaled?
The rest is just subtracting the dialog & gap sizes from the X & Y before tossing it to that point via MoveWindow(...)

I did some investigation using the windowspy tool that is part of AutoHotKey and looked at the values for both the taskbar and T-Clock's property window.

With the taskbar set so wide the left edge of the property window's border appears at the left edge. I see the following values.
T-Clock { left: 1035; top: 606; width: 491; height: 440; }
Taskbar { left: 1547; top: 0; width: 1013; height: 1600; }

The two lefts should be the same, and top+height should be close - but they are out by a factor of ~1.5, so it looks like T-Clock has font scaling applied to its coordinate space while the taskbar has the native coordinate space.

Setting the taskbar width so that the border only just appears on-screen I get:
T-Clock { left: 1709; top: 606; width: 491; height: 440; }
Taskbar { left: 2221; top: 0; width: 339; height: 1600; }

Doing some crunching of the number I find
T-Clock.left === 2560 - Taskbar.width - T-Clock.width - 21

Which is correct - but is in native coordinates not font scaled.

So it looks like you are calculating top in font scaled coords, and left in native, and then applying them in a font scaled context.
« Last Edit: June 13, 2010, 07:47 AM by sagji »

sagji

  • Participant
  • Joined in 2010
  • *
  • default avatar
  • Posts: 25
    • View Profile
    • Donate to Member
Re: T-Clock 2010 (beta - download)
« Reply #146 on: June 13, 2010, 07:51 AM »
Heh, now I am going to have to turn the house upside down to find all my forgotten Larson books.  ;D

Which puts into my mind a Larsoneqsue picture of a house resting on its roof, and the caption
"He turned the house upside down looking of it."

daddydave

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 867
  • test
    • View Profile
    • Donate to Member
Re: T-Clock 2010 (beta - download)
« Reply #147 on: June 13, 2010, 07:58 AM »
The first thing I think of when I think of Gary Larson is the cartoon where a guy and a kangaroo are at a bar, and the guy is saying something like, "Well, you may be a kangaroo, but I know a few things about marsupials myself!" So true-to-life!

Stoic Joker

  • Moderator
  • Joined in 2008
  • *****
  • Posts: 6,646
    • View Profile
    • Donate to Member
Re: T-Clock 2010 (beta - download)
« Reply #148 on: June 13, 2010, 09:36 AM »
I did some investigation using the windowspy tool that is part of AutoHotKey and looked at the values for both the taskbar and T-Clock's property window.

With the taskbar set so wide the left edge of the property window's border appears at the left edge. I see the following values.
T-Clock { left: 1035; top: 606; width: 491; height: 440; }
Taskbar { left: 1547; top: 0; width: 1013; height: 1600; }

The two lefts should be the same, and top+height should be close - but they are out by a factor of ~1.5, so it looks like T-Clock has font scaling applied to its coordinate space while the taskbar has the native coordinate space.

Setting the taskbar width so that the border only just appears on-screen I get:
T-Clock { left: 1709; top: 606; width: 491; height: 440; }
Taskbar { left: 2221; top: 0; width: 339; height: 1600; }

Doing some crunching of the number I find
T-Clock.left === 2560 - Taskbar.width - T-Clock.width - 21

Which is correct - but is in native coordinates not font scaled.

So it looks like you are calculating top in font scaled coords, and left in native, and then applying them in a font scaled context.

Thanks for the analysis, but... I'm afraid I was a bit unclear earlier. The code snippet I posted before is not in the build you are using/have. It was only posted as an example of the solution I am working on (Which makes you analysis flawed - which is my fault). The complete function code for the build you have is:
Code: C++ [Select]
  1. //================================================================================================
  2. //------------------------------+++--> Adjust the Window Position Based on Taskbar Size & Location:
  3. void SetMyDialgPos(HWND hwnd) { //----------------------------------------------------------+++-->
  4.         int wscreen, hscreen, wProp, hProp;
  5.         int wTray, hTray, x, y;
  6.         RECT rc, rcTray;
  7.         HWND hwndTray;
  8.  
  9.   GetWindowRect(hwnd, &rc); // Properties Dialog Dimensions
  10.   wProp = rc.right - rc.left;  //----------+++--> Width
  11.   hProp = rc.bottom - rc.top; //----------+++--> Height
  12.        
  13.   wscreen = GetSystemMetrics(SM_CXSCREEN);  // Desktop Width
  14.   hscreen = GetSystemMetrics(SM_CYSCREEN); // Desktop Height
  15.        
  16.   hwndTray = FindWindow("Shell_TrayWnd", NULL);
  17.   if(hwndTray == NULL) return;
  18.  
  19.   GetWindowRect(hwndTray, &rcTray);
  20.   wTray = rcTray.right - rcTray.left;
  21.   hTray = rcTray.bottom - rcTray.top;
  22.  
  23.   if(wTray > hTray) { // IF Width is Greater Than Height, Taskbar is
  24.           x = wscreen - wProp - 21; // at Either Top or Bottom of Screen
  25.           if(rcTray.top < hscreen / 2)
  26.                   y = rcTray.bottom + 21; // Taskbar is on Top of Screen
  27.           else // ELSE Taskbar is Where it Belongs! (^^^Mac Fag?^^^)
  28.                   y = rcTray.top - hProp - 21;
  29.           if(y < 0) y = 0;
  30.   }else{ //---+++--> ELSE Taskbar is on Left or Right Side of Screen
  31.           y = hscreen - hProp - 21; // Down is a Fixed Position
  32.           if(rcTray.left < wscreen / 2)
  33.                   x = rcTray.right + 21; //--+++--> Taskbar is on Left Side of Screen
  34.           else
  35.                   x = rcTray.left - wProp - 21; // Taskbar is on Right Side of Screen
  36.           if(x < 0) x = 0;
  37.   }
  38.  
  39.   MoveWindow(hwnd, x, y, wProp, hProp, FALSE);
  40. }

I have no idea where the experimental code will put the dialog at high DPI so I don't want to make it too accessible (e.g. make it the primary first post download). But if you are willing to give it a try Here is the compiled test version you thought you were testing earlier.
[Download removed to save space and avoid confusion - SJ]

Sorry about the confusion.
« Last Edit: June 15, 2010, 07:21 PM by Stoic Joker »

sagji

  • Participant
  • Joined in 2010
  • *
  • default avatar
  • Posts: 25
    • View Profile
    • Donate to Member
Re: T-Clock 2010 (beta - download)
« Reply #149 on: June 13, 2010, 07:07 PM »
I did some investigation using the windowspy tool that is part of AutoHotKey and looked at the values for both the taskbar and T-Clock's property window.

With the taskbar set so wide the left edge of the property window's border appears at the left edge. I see the following values.
T-Clock { left: 1035; top: 606; width: 491; height: 440; }
Taskbar { left: 1547; top: 0; width: 1013; height: 1600; }

The two lefts should be the same, and top+height should be close - but they are out by a factor of ~1.5, so it looks like T-Clock has font scaling applied to its coordinate space while the taskbar has the native coordinate space.

Setting the taskbar width so that the border only just appears on-screen I get:
T-Clock { left: 1709; top: 606; width: 491; height: 440; }
Taskbar { left: 2221; top: 0; width: 339; height: 1600; }

Doing some crunching of the number I find
T-Clock.left === 2560 - Taskbar.width - T-Clock.width - 21

Which is correct - but is in native coordinates not font scaled.

So it looks like you are calculating top in font scaled coords, and left in native, and then applying them in a font scaled context.

Thanks for the analysis, but... I'm afraid I was a bit unclear earlier. The code snippet I posted before is not in the build you are using/have. It was only posted as an example of the solution I am working on (Which makes you analysis flawed - which is my fault).
I didn't use the code sample at any point in my analysis, and the code sample below matches what I deduced including the magic number of 21.
The complete function code for the build you have is:
Code: C++ [Select]
  1. //================================================================================================
  2. //------------------------------+++--> Adjust the Window Position Based on Taskbar Size & Location:
  3. void SetMyDialgPos(HWND hwnd) { //----------------------------------------------------------+++-->
  4.         int wscreen, hscreen, wProp, hProp;
  5.         int wTray, hTray, x, y;
  6.         RECT rc, rcTray;
  7.         HWND hwndTray;
  8.  
  9.   GetWindowRect(hwnd, &rc); // Properties Dialog Dimensions
  10.   wProp = rc.right - rc.left;  //----------+++--> Width
  11.   hProp = rc.bottom - rc.top; //----------+++--> Height
  12.        
  13.   wscreen = GetSystemMetrics(SM_CXSCREEN);  // Desktop Width
  14.   hscreen = GetSystemMetrics(SM_CYSCREEN); // Desktop Height
  15.        
  16.   hwndTray = FindWindow("Shell_TrayWnd", NULL);
  17.   if(hwndTray == NULL) return;
  18.  
  19.   GetWindowRect(hwndTray, &rcTray);
  20.   wTray = rcTray.right - rcTray.left;
  21.   hTray = rcTray.bottom - rcTray.top;
  22.  
  23.   if(wTray > hTray) { // IF Width is Greater Than Height, Taskbar is
  24.           x = wscreen - wProp - 21; // at Either Top or Bottom of Screen
  25.           if(rcTray.top < hscreen / 2)
  26.                   y = rcTray.bottom + 21; // Taskbar is on Top of Screen
  27.           else // ELSE Taskbar is Where it Belongs! (^^^Mac Fag?^^^)
  28.                   y = rcTray.top - hProp - 21;
  29.           if(y < 0) y = 0;
  30.   }else{ //---+++--> ELSE Taskbar is on Left or Right Side of Screen
  31.           y = hscreen - hProp - 21; // Down is a Fixed Position
  32.           if(rcTray.left < wscreen / 2)
  33.                   x = rcTray.right + 21; //--+++--> Taskbar is on Left Side of Screen
  34.           else
  35.                   x = rcTray.left - wProp - 21; // Taskbar is on Right Side of Screen
  36.           if(x < 0) x = 0;
  37.   }
  38.  
  39.   MoveWindow(hwnd, x, y, wProp, hProp, FALSE);
  40. }

This was very helpfull - I was able to identify why the window doesn't go off the bottom of the screen, and confirm my theory with a little experiment.

This function only changes the position on one axis - the other remains unchanged.
This function contains no DPI scaling, and the values you are working from and all native, however when you set the window's position that appears to be font scaled by the system.

As an experiment I set the taskbat to bottom and made it tall, and opened the properties - it then appeared near the right edge but positioned so the top was near the top of the taskbar.

I have no idea where the experimental code will put the dialog at high DPI so I don't want to make it too accessible (e.g. make it the primary first post download). But if you are willing to give it a try Here is the compiled test version you thought you were testing earlier. (see attachment in previous post)
Sorry about the confusion.
The special version places it in the same position as the normal one.

Code Review Comment
The way you check for Horiz/Verti taskbar isn't robust - it works but eventually on some system it will go wrong, and then you will have a very hard to find bug.

Given you split it into 4 positions any way the could should be
Code: C++ [Select]
  1. if (rcTray.top > 0) {
  2.     // tray at bottom
  3.     ...
  4. } else if (rcTray.left > 0) {
  5.     // tray at right
  6.     ...
  7. } else if (rcTray.bottom < hscreen) {
  8.     // tray at top
  9.     ...
  10. } else if (rcTray.right < wscreen) {
  11.     // tray at left
  12.     ...
  13. } else {
  14.     // error - tray is fullscreen
  15.     return;
  16. }