Creating New GUI's Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
Epialis
Posts: 518
Joined: 02 Aug 2020, 22:44

Creating New GUI's

18 Aug 2020, 16:58

Hey all,

Was wondering if there is a way to declare the size and area of a GUI in one GUI window and have it create a new GUI and open it up. Then save it and have it there to open again instead of creating it again?
A_AhkUser
Posts: 1147
Joined: 06 Mar 2017, 16:18
GitHub: AAhkUser
Location: France

Re: Creating New GUI's  Topic is solved

18 Aug 2020, 17:39

Hi Epialis


This should help you start:

Code: Select all

#NoEnv
#Warn
SendMode Input
SetWorkingDir %A_ScriptDir%
#SingleInstance force

GUI, 2:New

GUI, 1:New
; https://www.autohotkey.com/docs/commands/GuiControls.htm#Edit
editOptions := "Number Limit4" ; https://www.autohotkey.com/docs/commands/GuiControls.htm#Edit_Options
GUI, 1:Add, Edit, Section hwndhandleEdit1 vGUIX %editOptions%,
EM_SETCUEBANNER(handleEdit1, "Center")
GUI, 1:Add, Edit, ys vGUIY  hwndhandleEdit2 %editOptions%,
EM_SETCUEBANNER(handleEdit2, "Center")
GUI, 1:Add, Edit, ys vGUIW %editOptions% wp, 300
GUI, 1:Add, Edit, ys vGUIH %editOptions% wp, 300
GUI, 1:Add, Button, wp glabel Default, &OK
GUI, 1:Show, AutoSize
return

label:
	Gui, Submit, NoHide ; https://www.autohotkey.com/docs/commands/Gui.htm#Submit
	if ((GUIW <= A_ScreenWidth) && (GUIH <= A_ScreenHeight)) {
		Gui, 2:+owner1
		Gui 1:+Disabled
		(GUIX="") && GUIX:="Center"
		(GUIY="") && GUIY:="Center"
		GUI, 2:Show, % "x" GUIX " y" GUIY " w" GUIW " h" GUIH
	}
return

2GUICLose:
2GUIEscape:
	GUI, 1:-Disabled
	GUI, 2:Cancel
return



EM_SETCUEBANNER(handle, string, option := true) ; by jNizM (https://www.autohotkey.com/boards/viewtopic.php?p=338675)
{
	static ECM_FIRST       := 0x1500 
	static EM_SETCUEBANNER := ECM_FIRST + 1
	if (DllCall("user32\SendMessage", "ptr", handle, "uint", EM_SETCUEBANNER, "int", option, "str", string, "int"))
		return true
	return false
}
Hope this helps

A_AhkUser


[EDIT]:
DanRim wrote:
18 Aug 2020, 17:47
@A_AhkUser Seems interesting, thanks for sharing.
Thanks, I'm glad you find it usefull. Cheers
A_AhkUser
Last edited by A_AhkUser on 18 Aug 2020, 17:59, edited 1 time in total.
my scripts
DanRim
Posts: 84
Joined: 20 Jul 2018, 15:16

Re: Creating New GUI's

18 Aug 2020, 17:47

@A_AhkUser Seems interesting, thanks for sharing.
Epialis
Posts: 518
Joined: 02 Aug 2020, 22:44

Re: Creating New GUI's

18 Aug 2020, 18:23

@A_AhkUser

Thank you kindly sir :)

Return to “Ask For Help”

Who is online

Users browsing this forum: anv, DaveT1, JoeWinograd, mikeyww, RayB, TheProdigyC2, TXShooter and 81 guests