Page 1 of 1

Create a simple Gui

Posted: 25 May 2020, 17:07
by Loop
Hi,
How can I create such a GUI, see Attachment
center.jpg
center.jpg (4.61 KiB) Viewed 384 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

Re: Create a simple Gui  Topic is solved

Posted: 25 May 2020, 17:58
by iPhilip
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

Re: Create a simple Gui

Posted: 25 May 2020, 23:04
by BNOLI

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

Re: Create a simple Gui

Posted: 26 May 2020, 01:15
by Loop
@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

Re: Create a simple Gui

Posted: 26 May 2020, 01:19
by BNOLI
GuiWidth ... when referenced in a GuiSize subroutine :!:

Re: Create a simple Gui

Posted: 26 May 2020, 03:35
by Loop
ahh... Thanks

Re: Create a simple Gui

Posted: 27 May 2020, 14:54
by garry
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
;==============================================