Window and gadgets building and SystemMetrics constants
Window and gadgets building and SystemMetrics constants
Hello,
Does anyone know where I could find docs that details how windows and gadgets are graphically built in relation to the SystemMetrics constants?
I've spend time to find this kind of informations without results.
Thanks.
Does anyone know where I could find docs that details how windows and gadgets are graphically built in relation to the SystemMetrics constants?
I've spend time to find this kind of informations without results.
Thanks.
If my English syntax and lexicon are incorrect, please bear with Google translate and DeepL. They rarely agree with each other!
Except on this sentence...
Except on this sentence...
Re: Window and gadgets building and SystemMetrics constants
Not sure what you mean, but maybe this? -> https://www.purebasic.fr/blog/?p=336
It explains what the gadgets are behind the scenes on each OS.
It explains what the gadgets are behind the scenes on each OS.
Re: Window and gadgets building and SystemMetrics constants
Hi BarryG,BarryG wrote: Not sure what you mean, but maybe this? -> https://www.purebasic.fr/blog/?p=336
Thanks for your reply but it's not really what I'm searching.
It's something like that for windows and gadgets:

I've tried many times to understand how they are built but, for example, for a window or gadget I've created, when I add up the various values retrieved via the constants, I can't find the global values defined programmatically. I'm sure there are other “constants” I'm not taking into account...
If my English syntax and lexicon are incorrect, please bear with Google translate and DeepL. They rarely agree with each other!
Except on this sentence...
Except on this sentence...
Re: Window and gadgets building and SystemMetrics constants
So are you asking what the values are for each "SM_*" constant?
Re: Window and gadgets building and SystemMetrics constants
Not at all! This, this isn't a problem.BarryG wrote: So are you asking what the values are for each "SM_*" constant?
It's how Windows graphically builds a window and gadgets.
E.g for width window, it uses two outer borders (left and right, i.e. 2 SM_CXBORDER), two inner margins ? (2 SM_CX????), etc, etc.
If my English syntax and lexicon are incorrect, please bear with Google translate and DeepL. They rarely agree with each other!
Except on this sentence...
Except on this sentence...
Re: Window and gadgets building and SystemMetrics constants
Oh, I see. Sorry for misunderstanding. 

Re: Window and gadgets building and SystemMetrics constants
It's ... complicated. There's no single "windows are drawn here" location where everything is worked out monolithically. In fact there's no distinction between a window and a gadget. Everything is a "window", it's just that not every window has identical features or behaviours.
More specifically everything is a class object which contains code that actions messages from and generates notifications back to the operating system or host application. This includes the code which dictates how the control is drawn.
If you want to begin to understand how it's put together you could start here:
https://learn.microsoft.com/en-us/windo ... plications
But I can tell you it's not going to answer the question that you posed above because - it doesn't work like that! The SM_* constants are only values that are used as arguments to the GetSystemMetrics function. The values returned by that function aren't constants and will depend on the specific configuration of a specific target machine at a specific runtime.
What are you trying to achieve? If you tell us a bit more about the problem you are trying to solve or what you are trying to accomplish then we might be able to give you a more directly helpful answer.
Re: Window and gadgets building and SystemMetrics constants
Thanks for your reply, Spikey
Gadgets and windows are just controls...
I've no specific need. But, by the past, I needed to design windows with gadgets and to know precisely (to the pixel) for example scrollbars widths and heights to correctly size listicons and others gadgets using them to fit perfectly in windows. But, as I've said, the retrieve values using GetSystemMetrics didn't correpond to what I had in screen (with a print screen analysis). So I therefore supposed that other graphic elements (single lines, double lines, 3D lines, etc???) might also have to be drawn.
That's why I wanted to know if there was a doc describing exactly how the controls were graphically drawn and what SM_ elements made them up.
I also know that it could be different depending on Windows version, each with its own style...
Thanks for the link. (My English skills will be severely tested
)

I know thatspikey wrote: In fact there's no distinction between a window and a gadget.


I've no specific need. But, by the past, I needed to design windows with gadgets and to know precisely (to the pixel) for example scrollbars widths and heights to correctly size listicons and others gadgets using them to fit perfectly in windows. But, as I've said, the retrieve values using GetSystemMetrics didn't correpond to what I had in screen (with a print screen analysis). So I therefore supposed that other graphic elements (single lines, double lines, 3D lines, etc???) might also have to be drawn.
That's why I wanted to know if there was a doc describing exactly how the controls were graphically drawn and what SM_ elements made them up.
I also know that it could be different depending on Windows version, each with its own style...
Thanks for the link. (My English skills will be severely tested

If my English syntax and lexicon are incorrect, please bear with Google translate and DeepL. They rarely agree with each other!
Except on this sentence...
Except on this sentence...
Re: Window and gadgets building and SystemMetrics constants
If my English syntax and lexicon are incorrect, please bear with Google translate and DeepL. They rarely agree with each other!
Except on this sentence...
Except on this sentence...
Re: Window and gadgets building and SystemMetrics constants
I do this by using GetSystemMetrics_() on my windows, and so my listicons are pixel-perfect for every window. Sometimes you might need to check if a border is present and so on, but it's not too hard. Got an example snippet that shows how you want to perfectly align everything?boddhi wrote: Fri Jul 26, 2024 11:19 pm[need to] know precisely (to the pixel) for example scrollbars widths and heights to correctly size listicons and others gadgets using them to fit perfectly in windows
BTW, I've been using these in the startup code of my apps without any issues since forever:
Code: Select all
; Border sizes (for ImageGadgets, etc).
Global borderx=GetSystemMetrics_(#SM_CXDLGFRAME)
Global bordery=GetSystemMetrics_(#SM_CYDLGFRAME)
; Scrollbar width and height of ListIconGadgets.
Global scrollwidth=GetSystemMetrics_(#SM_CXVSCROLL)+GetSystemMetrics_(#SM_CXDRAG)
Global scrollheight=GetSystemMetrics_(#SM_CXHSCROLL)+GetSystemMetrics_(#SM_CYDRAG)
Re: Window and gadgets building and SystemMetrics constants
Thanks for the tipBarryG wrote: BTW, I've been using these in the startup code of my apps without any issues since forever:

If my English syntax and lexicon are incorrect, please bear with Google translate and DeepL. They rarely agree with each other!
Except on this sentence...
Except on this sentence...