a GUI , use x,y,w,h x-position y-position w-width h-height
Example-1
Code: Select all
;- use F7 to show DATA_VALIDADE / GUI only like msgbox
#persistent
~$F7::
Gui,1: +AlwaysOnTop -DPIScale -Theme -caption
Gui,1:Color,Black,Black ; GUI black / EDIT is BLACK
Gui,1:Font,CYellow s12,Lucida Console ; set FONT , SIZE=12 , EDIT-TEXT is Yellow
;-------
A:= A_YYYY . A_MM . A_DD ;- today
B:= (A_YYYY - 2000) * A_MM * A_DD * 3
;Gui,1:add,Text, x10 y10 cWhite,DATA_ATUAL= ;- text white
;Gui,1:add,Edit, x270 y10 w180 h40 right readonly vA1 , %a% ;- today
Gui,1:add,Text, x10 y60 cWhite,DATA_VALIDADE=
Gui,1:add,Edit, x270 y60 w180 h40 right readonly vB1 , %b%
Gui,1:add,Text,vT1,
Gui,1:Add, Button, x20 y110 w250 h37 gOK1,OK
Gui,1:Show,x1 y1 w500 h160 ,TEST ;- GUI position and size
GuiControl,1: Focus,T1 ;- set focus to the first field
Return
;-------------
OK1:
Guiclose:
Gui,1: destroy
return
esc::exitapp
;-------------
Example-2
Code: Select all
;- use F7 to show DATA_VALIDADE
#persistent
~$F7::
Gui,1: +AlwaysOnTop -DPIScale -Theme
Gui,1:Color,Black,Black ; GUI black / EDIT is BLACK
Gui,1:Font,CYellow s12,Lucida Console ; set FONT , SIZE=12 , EDIT-TEXT is Yellow
;-------
A:= A_YYYY . A_MM . A_DD ;- today
B:= (A_YYYY - 2000) * A_MM * A_DD * 3
Gui,1:add,Text, x10 y10 cWhite,DATA_ATUAL= ;- text white
Gui,1:add,Edit, x270 y10 w180 h40 right readonly vA1 , %a% ;- today
;Gui,1:add,Text, x10 y60 cWhite,DATA_VALIDADE=
;Gui,1:add,Edit, x270 y60 w180 h40 right readonly vB1 , %b%
Gui,add,Text,vT1,
Gui,1:Add, Button, x20 y110 w250 h37 gOK1,DATA_VALIDADE
Gui,1:Show,x1 y1 w500 h160 ,TEST ;- GUI position and size
GuiControl, Focus,T1 ;- set focus to the first field
Return
;-------------
Guiclose:
exitapp
esc::exitapp
;-------------
OK1:
Gui,1:submit,nohide
;msgbox, 262208,DATA_VALIDADE,%B%,
Gui,2: +AlwaysOnTop -DPIScale -Theme
Gui,2:Color,Black,Black ; GUI black / EDIT is BLACK
Gui,2:Font,CYellow s12,Lucida Console ; set FONT , SIZE=12 , EDIT-TEXT is Yellow
Gui,2:add,Text, x10 y10 cWhite,DATA_VALIDADE=
Gui,2:add,Edit, x270 y10 w180 h40 right readonly vB1 , %b%
Gui,2:add,Text,vT2,
Gui,2:Add, Button, x20 y80 w250 h37 gOK2,OK
Gui,2:Show,x700 y400 w500 h130 ,TEST2 ;- GUI position and size
GuiControl,2: Focus,T2 ;- set focus to the first field
return
OK2:
Gui,1: destroy
Gui,2: destroy
return
;=============
Example-3
Code: Select all
#warn
#noenv
name1:="MATHE-TEST"
setworkingdir,%a_scriptdir%
Gui,1: -dpiscale
Gui,1:default
Gui,1: +AlwaysOnTop -DPIScale -Theme
;Gui,1:Color,C8D0D4,Black ;-GUI gray / EDIT is BLACK
;Gui,1:Color,762e1c,Black ; GUI bordeaux/ EDIT is BLACK
Gui,1:Color,Black,Black ; GUI black / EDIT is BLACK
Gui,1:Font,CYellow s12,Lucida Console ; set FONT , SIZE=12 , EDIT-TEXT is Yellow
;-------
A:= A_YYYY . A_MM . A_DD ;- today
;B:= (A_YYYY - 2000) * A_MM * A_DD * 3
Gui,1:add,Text, x10 y10 cWhite,DATA_ATUAL= ;- text white
Gui,1:add,Edit, x270 y10 w180 h40 right vA1 , %a% ;- today ( can overwrite )
;Gui,1:add,Text, x10 y70 cWhite,DATA_VALIDADE=
;Gui,1:add,Edit, x270 y70 w180 h40 right readonly vB1 , %b%
Gui,1:add,Text, x10 y130 cRED,RESULT=
Gui,1:add,Edit, x270 y130 w180 h40 right vResult readonly cWhite,
;Gui,1: Add, Button, x20 y350 w250 h37 gCALC,CALCULATE
;- or color button
Gui,1: Add, Progress, x20 y350 w250 h37 Disabled Background87CEEB
;Gui,1: Add, Progress, x20 y350 w250 h37 Disabled BackgroundGRAY ;- button color GRAY
Gui,1: Add, Text, xp yp wp hp BackgroundTrans 0x201 cBlack vText +Border gCALC,CALCULATE
;--
Gui,1: Add, Button, x300 y350 w150 h37 gClear,CLEAR
;--------
Gui,1:Show,x1 y1 w800 h420 ,%name1% ;- GUI position and size
GuiControl, Focus,A1 ;- set focus to the first field
send,{end}
Return
;-------------
Guiclose:
exitapp
;-------------
CALC:
Gui,1:submit,nohide
;- 20201217 calculate dependig year in edit A1 ----------
stringmid,year ,a1,1,4 ;- 2020
stringmid,month,a1,5,2 ;- 12
stringmid,day ,a1,7,2 ;- 17
DATA_VALIDADE:= (year - 2000) * month * day * 3
Guicontrol,1:,Result,%DATA_VALIDADE%
msgbox, 262208,RESULT ,%DATA_VALIDADE%,2 ;- msgbox alwaysontop for 2 seconds ( not needed )
return
;-------------
CLEAR:
;Guicontrol,1:,A1
;Guicontrol,1:,B1
Guicontrol,1:,Result, ;- clear only result
GuiControl, Focus,A1 ;- set focus to the first field
send,{end}
return
;=====================================================