Create a simple Gui Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
Loop
Posts: 48
Joined: 07 Jan 2019, 14:51

Create a simple Gui

25 May 2020, 17:07

Hi,
How can I create such a GUI, see Attachment
center.jpg
center.jpg (4.61 KiB) Viewed 389 times
Get the following error message:
Line Text: x+ % "w" A_GuiWidth / 3
Error: This parameter contains a variable name missing its ending percent sign.


my code:

Code: Select all

Gui, -Caption
Gui, Font, s12 cBlack,  Verdana
Gui, Color , White
Gui, Add, Text, % "w" A_GuiWidth / 3, one third
Gui, Add, Text, x+ % "w" A_GuiWidth / 3, two third
Gui, Add, Text, x+ % "w" A_GuiWidth / 3 , third third
Gui, Font, s12 cBlack W1000,  Verdana
Gui, Add, Text, y+ +Center, This  my Center
Gui, Show, W%A_ScreenWidth% H100 X0 Y0
return

GuiEscape:
GuiClose:
ExitApp
Thx
iPhilip
Posts: 461
Joined: 02 Oct 2013, 12:21

Re: Create a simple Gui  Topic is solved

25 May 2020, 17:58

Hi Loop,

Would you let me know if this works for you?

Code: Select all

#NoEnv
Gui, -Caption -DPIScale 
Gui, Font, s12 cBlack,  Verdana
Gui, Color , White
Gui, Add, Text, x0 y0 w%A_ScreenWidth%, one third
Gui, Add, Text, x0 y0 w%A_ScreenWidth% Center BackgroundTrans, two thirds
Gui, Add, Text, x0 y0 w%A_ScreenWidth% Right BackgroundTrans, three thirds
Gui, Font, s12 cBlack W1000,  Verdana
Gui, Add, Text, x0 y75 w%A_ScreenWidth% Center, Center
Gui, Show, X0 Y0 H100
return

GuiEscape:
ExitApp
Windows 10 Pro (64 bit) - AutoHotkey v1.1+ (Unicode 32-bit)
BNOLI
Posts: 548
Joined: 23 Mar 2020, 03:55

Re: Create a simple Gui

25 May 2020, 23:04

Code: Select all

x+ % "w" A_GuiWidth / 3  ; Error: This parameter contains a variable name missing its ending percent sign (bc the line starts in "legacy style" a single % is invalid, so throws an error.)
% "x+" A_GuiWidth / 3    ; Here you use the percent sign to declare a "forced expression", therefore the following parameters have to be written "expression style"

Code: Select all

Gui,-Caption

Gui, Font, s12 cBlack,  Verdana
Gui, Color , White
Gui, Add, Text,% "x0 w" A_ScreenWidth/3 " left"								, 1st 
Gui, Add, Text,% "xp+" A_Screenwidth/3  " w" A_ScreenWidth/3 " yp center"	, 2nd 
Gui, Add, Text,% "xp+" A_Screenwidth/3  " w" A_ScreenWidth/3 " yp right"	, 3rd 	

Gui, Font, s12 cBlack w1000,  Verdana
Gui, Add, Text,% "x0 w" A_ScreenWidth " center	yp+40"	, |
Gui, Show,	% "w" A_ScreenWidth " h100 y0 x0"
Return
Last edited by BNOLI on 26 May 2020, 01:17, edited 1 time in total.
Remember to use [code]CODE[/code]-tags for your multi-line scripts. Stay safe, stay inside, and remember washing your hands for 20 sec !
Loop
Posts: 48
Joined: 07 Jan 2019, 14:51

Re: Create a simple Gui

26 May 2020, 01:15

@iPhilip Works great, thank you.


@BNOLI
I would like to indicate the width:
still get error message, Error: Invalid option

Code: Select all

Gui, Add, Text, % "w" A_GuiWidth / 3, one third
BNOLI
Posts: 548
Joined: 23 Mar 2020, 03:55

Re: Create a simple Gui

26 May 2020, 01:19

GuiWidth ... when referenced in a GuiSize subroutine :!:
Remember to use [code]CODE[/code]-tags for your multi-line scripts. Stay safe, stay inside, and remember washing your hands for 20 sec !
Loop
Posts: 48
Joined: 07 Jan 2019, 14:51

Re: Create a simple Gui

26 May 2020, 03:35

ahh... Thanks
garry
Posts: 2338
Joined: 22 Dec 2013, 12:50

Re: Create a simple Gui

27 May 2020, 14:54

idea , if calculating x-position from more then three, example with 6 EDIT's
EDIT: script shortened

Code: Select all

;- Example : define x-position from 6 Edit's ( screenwidth divided by 6 )
#NoEnv
#Warn
SetWorkingDir, %A_ScriptDir%
Gui,2: -DPIScale
SS_REALSIZECONTROL := 0x40
Gui,2:Font,s14 cWhite,Lucida Console
Gui,2:Color,Black,Black
wa:=A_screenwidth,ha:=A_screenHeight,xx:=100.05,x1:=(wa*0)/xx,y:=(ha*1)/xx,w:=(wa*10)/xx,h:=(ha*3)/xx,wx:=(wa*100)/xx
;-------------
tot:=6                    ;- Total Edit's
spc:=(tot-1)              ;- Total space between
w  :=(wx*8)/xx            ;- Edit  width
spw:=(wx-(tot*w))/spc     ;- Space width
;-------------
loop,%tot%
  {
  if (a_index=1)
    Gui,2: Add,Edit  , x0        y%y% w%w%  h%h%  -vscroll vE%a_index% center,ED%a_index%
  else
    Gui,2: Add,Edit  , x+%spw%   y%y% w%w%  h%h%  -vscroll vE%a_index% center,ED%a_index%
  }
x:=(wa*0)/xx,y:=(ha*0.1)/xx,w:=wa,h:=(ha*96)/xx
Gui,2:show,x%x% y%y% w%w% h%h%,TEST
GuiControl, Focus,E1
send,{end}
return
;----------------------------------------------
2Guiclose:
exitapp
;==============================================

Return to “Ask For Help”

Who is online

Users browsing this forum: 4k3or3et, AHKStudent, Bing [Bot], boiler, davehotkeys, nacken012, rhaos and 43 guests