Alignment codes help?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
RDC
Posts: 112
Joined: 29 Jan 2023, 10:22

Alignment codes help?

11 Apr 2023, 13:31

I found a nice little script-let by jNizM from an old 2014 forum thread that I'm hoping someone may be able to help with. (viewtopic.php?t=5151)
The script very effectively shows alignment strategy. What I cannot find through site search or Google is where these codes are derived from. I was hoping to be able to add the bottom row.
Advanced thanks to anyone who knows!

image.png
image.png (3.65 KiB) Viewed 492 times

Code: Select all

Gui, Margin, 5, 5

Gui, Add, Text, xm ym w100 h22 0x0000 0x00800000, % "0x0000" 	 ; Top Left
Gui, Add, Text, xm y+5 w100 h22 0x0001 0x00800000, % "0x0001" 	 ; Top Center
Gui, Add, Text, xm y+5 w100 h22 0x0002 0x00800000, % "0x0002" 	 ; Top Right
Gui, Add, Text, xm y+5 w100 h22 0x0200 0x00800000, % "0x0200" 	 ; Center Left
Gui, Add, Text, xm y+5 w100 h22 0x0201 0x00800000, % "0x0201" 	 ; Center Center
Gui, Add, Text, xm y+5 w100 h22 0x0202 0x00800000, % "0x0202" 	 ; Center Right

Gui, Show, AutoSize
return

GuiEscape:
GuiClose:
ExitApp
ntepa
Posts: 434
Joined: 19 Oct 2022, 20:52

Re: Alignment codes help?

11 Apr 2023, 15:35

Static Control Styles: https://learn.microsoft.com/en-us/windows/win32/controls/static-control-styles
You can look up constants and their values here: https://www.magnumdb.com/search?q=SS_*

Code: Select all

WS_BORDER := 0x00800000
SS_LEFT := 0x0000
SS_CENTER := 0x0001
SS_RIGHT := 0x0002
SS_CENTERIMAGE := 0x0200
CenterLeft := SS_CENTERIMAGE|SS_LEFT
CenterCenter := SS_CENTERIMAGE|SS_CENTER
CenterRight := SS_CENTERIMAGE|SS_RIGHT

Gui, Margin, 5, 5

Gui, Add, Text, % "xm ym w100 h22 " SS_LEFT " " WS_BORDER, % "0x0000"       ; Top Left
Gui, Add, Text, % "xm y+5 w100 h22 " SS_CENTER " " WS_BORDER, % "0x0001"    ; Top Center
Gui, Add, Text, % "xm y+5 w100 h22 " SS_RIGHT " " WS_BORDER, % "0x0002"     ; Top Right
Gui, Add, Text, % "xm y+5 w100 h22 " CenterLeft " " WS_BORDER, % "0x0200"   ; Center Left
Gui, Add, Text, % "xm y+5 w100 h22 " CenterCenter " " WS_BORDER, % "0x0201" ; Center Center
Gui, Add, Text, % "xm y+5 w100 h22 " CenterRight " " WS_BORDER, % "0x0202"  ; Center Right

Gui, Show, AutoSize
return

GuiEscape:
GuiClose:
ExitApp
User avatar
RDC
Posts: 112
Joined: 29 Jan 2023, 10:22

Re: Alignment codes help?

11 Apr 2023, 21:21

Thank you. Tested your version and it comes out a little tighter and more compact...looks nice. Unfortunately what I am trying to determine is...
; Bottom Left
; Bottom Center
; Bottom Right

...to add on to the rest. I worded my request badly and should have been more clear, sorry!
ntepa
Posts: 434
Joined: 19 Oct 2022, 20:52

Re: Alignment codes help?

11 Apr 2023, 22:44

I didn't change anything from the original script besides defining the constants. Both guis are visually the same.
The original script doesn't have align to bottom because there's no SS_ style for that.
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: Alignment codes help?

13 Apr 2023, 11:29

RDC wrote:
11 Apr 2023, 21:21
Thank you. Tested your version and it comes out a little tighter and more compact...looks nice. Unfortunately what I am trying to determine is...
; Bottom Left
; Bottom Center
; Bottom Right

...to add on to the rest. I worded my request badly and should have been more clear, sorry!
no. just remove the option height (h)
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Rohwedder and 88 guests