[Tool] Gui Prototype Maker

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
Hellbent
Posts: 2102
Joined: 23 Sep 2017, 13:34

[Tool] Gui Prototype Maker

Post by Hellbent » 12 Sep 2021, 14:36

I started working on a new editor for myself the other day. Shortly into the project I decided to take one of the elements of the larger project, repackage it into a functioning tool and then experiment with it a bit to see what I like and don't like and take that info back into the other project.


This tool likely will require you to have basic knowledge about creating guis (adding controls, etc.)


-**************************************************************************************
To start using this.

1.Run the script.
2. Press the 3 buttons at the top in order. (new , add , show)
3. Press the update button (you should see the gui you just made )
4. Press the clipboard button and then paste into a script.
-**************************************************************************************
That is the basics, play around with adding different elements and then pressing update.



Any feedback is wanted.

20210912153337.png
20210912153337.png (42.52 KiB) Viewed 1128 times

Code: Select all

#SingleInstance, Force
#NoEnv
SetBatchLines, -1
Main.Setup()
return
HBMainGuiClose:
	ExitApp

class Main	{
	;Written By: Hellbent
	;Date: Sept 11th , 2021
	SetUp(){
		This.ParamCountList := { 	New: 				{ count: 3 , 	prototype: "GuiHwnd := Gui.New( Options , Name )" 							, Defaults: { Param1: "GuiHwnd" , Param2: "+AlwaysOnTop" } 	} 
								,	Show: 				{ count: 3 , 	prototype: "Gui.Show( Options , Title , Name )" 							, Defaults: { Param1: "AutoSize NA" }	} 
								, 	Hide: 				{ count: 1 , 	prototype: "Gui.Hide( Name )" } 											;No Defaults
								,	Enable: 			{ count: 1 , 	prototype: "Gui.Enable( Name )" } 											;No Defaults
								,	Disable: 			{ count: 1 , 	prototype: "Gui.Disable( Name )" } 											;No Defaults
								,	Destroy: 			{ count: 1 , 	prototype: "Gui.Destroy( Name )" } 											;No Defaults
								,	Get: 				{ count: 4 , 	prototype: "Output := Gui.Get( Control , SubCommand , Name )" 				, Defaults: { Param1: "Output" } 	}
								,	Set: 				{ count: 4 , 	prototype: "Gui.Set( Control , Value , SubCommand , Name )" }				;No Defaults
								,	Margin: 			{ count: 3 , 	prototype: "Gui.Margin( X , Y , Name )" 									, Defaults: { Param1: "10" , Param2: "10" }	} 	
								,	Color: 				{ count: 3 , 	prototype: "Gui.Color( Color1 , Color2 , Name )"  							, Defaults: { Param1: "F0F0F0" , Param2: "FFFFFF" }	} 
								,	WindowPosition: 	{ count: 2 , 	prototype: "WindowPosition := Gui.WindowPosition( HWND )" 					, Defaults: { Param1: "WindowPosition" , Param2: "GuiHwnd" }	}
								,	ControlPosition:	{ count: 3 , 	prototype: "ControlPosition := Gui.ControlPosition( Control , Name )" 		, Defaults: { Param1: "ControlPosition" }	}	
								,	Add: 				{ count: 5 , 	prototype: "ControlName := Gui.Add( Type , Options , Display , Name )" 		, Defaults: { Param1: "ControlName" , Param2: "Button" , Parma3: "xm ym" , Param4: "Button" }	}	
								,	Font: 				{ count: 3 , 	prototype: "Gui.Font( Font , Options , Name )"  							, Defaults: { Param1: "Segoe UI" , Param2: "s8 cBlack q5" } 	}
								,	Options: 			{ count: 2 , 	prototype: "Gui.Options( Options , Name )" 									, Defaults: { Param1: "+Resize" } 	}
								,	Bind: 				{ count: 4 , 	prototype: "Gui.Bind( Control , Method , BoundObject , Name )" }  }			;No Defaults
		This.Controls := {}
		This.Handles := []
		This.GuiName := "Gui1"
		This.Tog := 0
		This.GuiHwnd := Gui.New( "+AlwaysOnTop +Delimiter~ " , "HBMain" )
		Gui.Margin( 10 , 10 , "HBMain" )
		Gui.Color( "F0F0F0" , "" , "HBMain" )
		;New Button
		This.Controls.NewButton := Gui.Add( "Button" , "xm ym w100 r1" , "New Window" , "HBMain" )
		This._Bind( This.Controls.NewButton , "_AddNewWindow" )
		;AddControl Button
		This.Controls.AddControlButton := Gui.Add( "Button" , "x+10 ym w100 r1" , "Add Control" , "HBMain" )
		This._Bind( This.Controls.AddControlButton , "_AddAddControl" )
		;Show Button
		This.Controls.ShowButton := Gui.Add( "Button" , "x+10 ym w100 r1" , "Show Window" , "HBMain" )
		This._Bind( This.Controls.ShowButton , "_AddShowWindow" )
		;Method DDL
		This.Controls.MethodDDL := Gui.Add( "DDL" , "xm  w150 r20" , "New~~Show~Hide~Enable~Disable~Destroy~Get~Set~Margin~Color~WindowPosition~ControlPosition~Add~Font~Options~Bind~" , "HBMain" )
		;Add Button
		This.Controls.AddButton := Gui.Add( "Button" , "x+10 w70 r1" , "Add" , "HBMain" )
		This._Bind( This.Controls.AddButton , "_AddElement" )
		;ElementListBox
		This.Controls.ElementListBox := Gui.Add( "ListBox" , " xm  w250 r25 -E0x200 AltSubmit" ,  , "HBMain" )
		This._Bind( This.Controls.ElementListBox , "_SelectElement" )
		;Lock CheckBox
		This.Controls.LockCheckBox := Gui.Add( "CheckBox" , "x+10 section" , "Unlock" , "HBMain" )
		This._Bind( This.Controls.LockCheckBox , "_ToggleLock" )
		;Delete Button
		This.Controls.RemoveButton := Gui.Add( "Button" , "xs w70 Disabled" , "Remove" , "HBMain" )
		This._Bind( This.Controls.RemoveButton , "_RemoveElement" )
		;Copy Button
		This.Controls.CopyButton := Gui.Add( "Button" , "xs y+5 w70" , "Copy" , "HBMain" )
		This._Bind( This.Controls.CopyButton , "_CopyElement" )
		;Up Button
		This.Controls.UpButton := Gui.Add( "Button" , "xs y+5 w70" , "Up" , "HBMain" )
		This._Bind( This.Controls.UpButton , "_MoveElement" )
		;Down Button
		This.Controls.DownButton := Gui.Add( "Button" , "xs y+5 w70" , "Down" , "HBMain" )
		This._Bind( This.Controls.DownButton , "_MoveElement" )
		;Clipboard Button
		This.Controls.ClipButton := Gui.Add( "Button" , "xs y+5 w70" , "Clipboard" , "HBMain" )
		This._Bind( This.Controls.ClipButton , "_ClipProject" )
		;Update Button
		This.Controls.UpdateButton := Gui.Add( "Button" , "xs y+5 w70" , "Update" , "HBMain" )
		This._Bind( This.Controls.UpdateButton , "_UpdateProject" )
		Gui.Font( "Segoe UI" , "s8 Bold Q5" , "HBMain" )
		;Prototype text line
		This.Controls.PrototypeEdit := Gui.Add( "Edit" , "cPurple xm w330 r1 Center Border ReadOnly " , "" , "HBMain" ) 
		;param1
		This.Controls.Param1Text := Gui.Add( "Text" , "cRed x30 y+20 w70 r1" , "Param1:" , "HBMain" )
		This.Controls.Param1Edit := Gui.Add( "Edit" , "c336699 x+10 yp-2 w200 r1 center" ,, "HBMain" )
		;param2
		This.Controls.Param2Text := Gui.Add( "Text" , "cRed x30 y+10 w70 r1" , "Param2:" , "HBMain" )
		This.Controls.Param2Edit := Gui.Add( "Edit" , "c336699 x+10 yp-2 w200 r1 center" ,, "HBMain" )
		;param3
		This.Controls.Param3Text := Gui.Add( "Text" , "cRed x30 y+10 w70 r1" , "Param3:" , "HBMain" )
		This.Controls.Param3Edit := Gui.Add( "Edit" , "c336699 x+10 yp-2 w200 r1 center" ,, "HBMain" )
		;param4
		This.Controls.Param4Text := Gui.Add( "Text" , "cRed x30 y+10 w70 r1" , "Param4:" , "HBMain" )
		This.Controls.Param4Edit := Gui.Add( "Edit" , "c336699 x+10 yp-2 w200 r1 center" ,, "HBMain" )
		;param5
		This.Controls.Param5Text := Gui.Add( "Text" , "cRed x30 y+10 w70 r1" , "Param5:" , "HBMain" )
		This.Controls.Param5Edit := Gui.Add( "Edit" , "c336699 x+10 yp-2 w200 r1 center" ,, "HBMain" )
		Gui.Show( , "Gui Prototype Maker" , "HBMain" )
		This.Elements := []
		This.ElementActive := ""
		This.ElementCount := 0
		This.ElementList := ""
		This.Clone := 0
	}
	_ClipProject(){
		This.Output := 1
		This.Clip := "`nAutoGui := {} `n"
		This._UpdateProject()
	}
	_AddNewWindow(){
		This.Val := "New"
		This._AddElement()
	}
	_AddAddControl(){
		This.Val := "Add"
		This._AddElement()
	}
	_AddShowWindow(){
		This.Val := "Show"
		This._AddElement( )
	}
	_UpdateProject(){
		Gui.Destroy( This.GUIName )
		Loop, % This.ParamCountList[ This.Elements[ This.ElementActive ].Method ].Count 
			This.Elements[ This.ElementActive ][ "Param" A_Index ] := Gui.Get( This.Controls[ "Param" A_Index "Edit" ] ,, "HBMain" )
		This._UpdateElementListBox()
		This._RunGui()
	}
	_SetDefaults(){
		for k, v in This.ParamCountList[ This.Elements[ This.ElementActive ].Method ].Defaults	
			This.Elements[ This.ElementCount ][k] := v
		This.Elements[ This.ElementCount ][ "Param" This.ParamCountList[ This.Elements[ This.ElementActive ].Method ].Count ] := This.GUIName
	}
	_RunGui(){
		Loop, % This.ElementCount	{
			This._Switch( This.Elements[ A_Index ].Method , This.Elements[ A_Index ] )
		}
		if( This.output ){
			Clipboard := This.Clip
			sleep, 200
			This.Clip := ""
			This.output := 0
		}
	}
	_Switch( Input , obj ){
		local temp , parambackup , ta 
		Switch Input
		{
			case "New":
				if( This.output ){
					This.Clip .= "`nAutoGui." obj.param3 ":= {}`n"
					This.Clip .= "AutoGui." obj.param3 ".Controls := {} `n"
					This.Clip .= "AutoGui." obj.param3 ".Handles := [] `n`n"
					This.Clip .= "Gui, " obj.param3 ":New, "  obj.param2 " +hwndHwnd `n"
					This.Clip .= "AutoGui." obj.param3 ".Hwnd := hwnd `n`n"
				}else{
					temp := obj.Param1
					%Temp% := Gui.New( obj.param2 , obj.param3 )
				}
			case "Show":
				if( This.output ){
					This.Clip .= "Gui, " obj.param3 ":Show, " obj.param1 ", " obj.param2 " `n" 
				}else{
					Gui.Show( obj.param1 , obj.param2 , obj.param3 )
				}
			case "Hide":
				if( This.output ){
					This.Clip .= "Gui, " obj.param1 ":Hide,`n" 
				}else{
					Gui.Hide( obj.param1 )
				}
			case "Enable":
				if( This.output ){
					This.Clip .= "Gui, " obj.param1 ":-Disabled,`n" 
				}else{
					Gui.Enable( obj.param1 )
				}
			case "Disable":
				if( This.output ){
					This.Clip .= "Gui, " obj.param1 ":+Disabled,`n" 
				}else{
					Gui.Disable( obj.param1 )
				}
			case "Destroy":
				if( This.output ){
					This.Clip .= "Gui, " obj.param1 ":Destroy,`n" 
				}else{
					Gui.Destroy( obj.param1 )
				}
			case "Get":
				if( This.output ){
					This.Clip .= "GuiControlGet, " obj.param1 " , " obj.param4 ": " obj.param3 " , " obj.param2 "`n"
				}else{
					temp := obj.Param1
					%Temp% := Gui.Get( obj.param2 , obj.param3 , obj.param4 )
				}
			case "Set":
				if( This.output ){
					This.Clip .= "GuiControl, " obj.param4 ":" obj.param3 " , " obj.param1 " , " obj.param2 "`n"
				}else{
					Gui.Set( obj.param1 , obj.param2 , obj.param3 , obj.param4 )
				}
			case "Margin":
				if( This.output ){
					This.Clip .= "Gui, " obj.param3 ":Margin, " obj.param1 " , " obj.param2 "`n"
				}else{
					Gui.Margin( obj.param1 , obj.param2 , obj.param3 )
				}
			case "Color":
				if( This.output ){
					This.Clip .= "Gui, " obj.param3 ":Color, " obj.param1 " , " obj.param2 "`n"
				}else{
					Gui.Color( obj.param1 , obj.param2 , obj.param3 )
				}
			case "WindowPosition":
				if( This.output ){
					This.Clip .= obj.param1 ":= Gui.WindowPosition( " obj.param2 " )`n"
				}else{
					temp := obj.param1
					%temp% := Gui.WindowPosition( obj.param2 )
				}
			case "ControlPosition":
				if( This.output ){
					This.Clip .= obj.param1 ":= Gui.ControlPosition( " obj.param2 " , " obj.param3 " )`n"
				}else{
					temp := obj.param1
					%temp% := Gui.ControlPosition( obj.param2 , obj.param3 )
				}
			case "Add":
				if( This.output ){
					This.Clip .= ";" obj.param2 "`nGui, " obj.param5 ":Add, " obj.param2 " ," obj.param3 " hwndhwnd , " obj.param4 "`n"
					This.Clip .= "AutoGui." obj.param5 "." obj.param1 " := { Hwnd: hwnd , Value: """ obj.param4 """ }`n"
					This.Clip .= "AutoGui." obj.param5 ".Handles[hwnd] := """ obj.param1 """`n`n"
				}else{
					temp := obj.param1
					if( instr( obj.param3 , "g" ) ){
						ta := StrSplit( obj.param3 , " " )
						loop, % ta.Length()	{
							if( instr( ta[A_index] , "g" ) != 1 )
								parambackup .= ta[A_Index] " "
						}
					}else{
						parambackup := obj.param3
					}
					
					%temp% := Gui.Add( obj.param2 , parambackup , obj.param4 , obj.param5 )
				}
			case "Font":
				if( This.output ){
					This.Clip .= "Gui, " obj.param3 ":Font, " obj.param2 " , " obj.param1 "`n"
				}else{
					Gui.Font( obj.param1 , obj.param2 , obj.param3 )
				}
			case "Options":
				if( This.output ){
					This.Clip .= "Gui, " obj.param2 ":" obj.param1 "`n"
				}else{
					Gui.Options( obj.param1 , obj.param2 )
				}
			case "Bind":
				ToolTip, Bind Not avaialable in the editor
				sleep, 1000
				ToolTip,
		}
	}
	_MoveElement(){
		local temp 
		MouseGetPos,,,, ctrl , 2
		if( ctrl = This.Controls.UpButton ){
			if( ( This.ElementActive - 1 ) < 1 )
				return
			temp := This.Elements[ This.ElementActive ] 
			This.Elements[ This.ElementActive ] := This.Elements[ This.ElementActive - 1 ] 
			This.Elements[ This.ElementActive - 1 ] := temp
			--This.ElementActive 
		}else{
			if( ( This.ElementActive + 1 ) > This.ElementCount )
				return
			temp := This.Elements[ This.ElementActive ] 
			This.Elements[ This.ElementActive ] := This.Elements[ This.ElementActive + 1 ] 
			This.Elements[ This.ElementActive + 1 ] := temp
			++This.ElementActive 
		}
		This._UpdateElementListBox()
	}
	_CopyElement(){
		This.Clone := 1
		This._AddElement()
	}
	_ToggleLock(){
		Gui.Set( This.Controls.RemoveButton , "" , ( Gui.Get( This.Controls.LockCheckBox , , "HBMain" ) ) ? ( "Enable" ) : ( "Disable" ) , "HBMain" )
	}
	_SelectElement(){
		This._GetEdits()
		This.ElementActive := Gui.Get( This.Controls.ElementListBox , , "HBMain" )
		This._SetEdits()
		This._UpdateElementListBox()
	}
	_Bind( Control , Method , Name := "HBMain" ){
		local fn := This[ Method ].Bind( This )
		Gui.Set( Control , fn , "+g" , Name )
	}
	_RemoveElement(){
		if( !This.ElementCount )
			return
		This.Elements.RemoveAt( This.ElementActive )
		This.ElementCount--
		( This.ElementActive > This.ElementCount ) ? ( This.ElementActive := This.ElementCount )
		This._UpdateElementListBox()
		This._SetEdits()
	}
	_AddElement(){
		This._GetEdits()
		if( This.Clone && !This.Clone := 0 ){
			This.Elements[ This.ElementCount + 1 ] := {}
			for k, v in This.Elements[ This.ElementActive ]
				This.Elements[ This.ElementCount +1 ][k] := v
			This.ElementActive := ++This.ElementCount 
		}else{
			This.ElementActive := ++This.ElementCount
			This.Elements[ This.ElementCount ] := {}
			if(!This.Val){
				This.Elements[ This.ElementCount ].Method := Gui.Get( This.Controls.MethodDDL ,, "HBMain" )
			}else {
				This.Elements[ This.ElementCount ].Method := This.Val
				This.Val := 0
			}
			This._SetDefaults()
		}
		This._UpdateElementListBox()
		This._SetEdits()
	}
	_SetEdits(){
		Loop, % 5	
			Gui.Set( This.Controls[ "Param" A_Index "Edit" ] , "" , "Hide" , "HBMain" )
			, Gui.Set( This.Controls[ "Param" A_Index "Text" ] , "" , "Hide" , "HBMain" )
		Loop, % This.ParamCountList[ This.Elements[ This.ElementActive ].Method ].Count
			Gui.Set( This.Controls[ "Param" A_Index "Edit" ] , "" , "Show" , "HBMain" )
			, Gui.Set( This.Controls[ "Param" A_Index "Text" ] , "" , "Show" , "HBMain" )
		Loop, % This.ParamCountList[ This.Elements[ This.ElementActive ].Method ].Count	
			Gui.Set( This.Controls[ "Param" A_Index "Edit" ] , This.Elements[ This.ElementActive ][ "Param" A_Index ] ,, "HBMain")
		Gui.Set( This.Controls.PrototypeEdit , This.ParamCountList[ This.Elements[ This.ElementActive ].Method ].Prototype , , "HBMain" )
		Gui.Show( "AutoSize" , , "HBMain" )
	}
	_GetEdits(){
		local tn := This.GuiName
		Loop, % This.ParamCountList[ This.Elements[ This.ElementActive ].Method ].Count	
			This.Elements[ This.ElementActive ][ "Param" A_Index ] := Gui.Get( This.Controls[ "Param" A_Index "Edit" ] ,, "HBMain" )
		This.GuiName := This.Elements[ This.ElementActive ][ "Param" This.ParamCountList[ This.Elements[ This.ElementActive ].Method ].Count ]  
		( !This.GuiName ) ? ( This.GuiName := tn )
	}
	_UpdateElementListBox(){
		This._GetElementList()
		Gui.Set( This.Controls.ElementListBox , This.ElementList , , "HBMain" )
		Gui.Set( This.Controls.ElementListBox , This.ElementActive , "Choose" , "HBMain" )
	}
	_GetElementList(){
		This.ElementList := "~"
		Loop, % This.ElementCount	{
			if( This.Elements[ A_Index ].Method = "Add")
				This.ElementList .= This.Elements[ A_Index ].Method "`t" This.Elements[ A_Index ].Param2 "`t`t"  This.Elements[ A_Index ].Param4  "~"
			else if( This.Elements[ A_Index ].Method = "Margin" )
				This.ElementList .= This.Elements[ A_Index ].Method "`t`t`t" This.Elements[ A_Index ].Param1 "`t"  This.Elements[ A_Index ].Param2  "~"
			else if( This.Elements[ A_Index ].Method = "Color" )
				This.ElementList .= This.Elements[ A_Index ].Method "`t`t`t" This.Elements[ A_Index ].Param1 "`t"  This.Elements[ A_Index ].Param2  "~"
			else if( This.Elements[ A_Index ].Method = "New" )
				This.ElementList .= This.Elements[ A_Index ].Method "`t" This.Elements[ A_Index ].Param3 "`t`t"  This.Elements[ A_Index ].Param2  "~"
			else if( This.Elements[ A_Index ].Method = "Font" )
				This.ElementList .= This.Elements[ A_Index ].Method "`t`t" This.Elements[ A_Index ].Param1 "`t`t"  This.Elements[ A_Index ].Param2  "~"
			else if( This.Elements[ A_Index ].Method = "Options" )
				This.ElementList .= This.Elements[ A_Index ].Method "`t`t`t" This.Elements[ A_Index ].Param1  "~"
			else
				This.ElementList .= This.Elements[ A_Index ].Method "~"
		}
	}
}

class Gui	{
	;Written By: Hellbent
	;Date: Sept 9th, 2021
	New( Options := "+AlwaysOnTop" , Name := 1 ){
		local hwnd
		Gui, % Name ":New", % Options " hwndhwnd "
		Gui[Name] := {}
		Gui[Name].ControlCount := 0
		Gui[Name].Handles := []
		Gui[Name].Controls := []
		Gui[Name].Hwnd := hwnd
		Gui[Hwnd] := Gui[Name]
		return hwnd
	}
	Show( Options := "" , Title := "" , Name := 1 ){
		Gui, % Name ":Show", % Options, % Title
	}
	Hide( Name := 1 ){
		Gui, % Name ":Hide"
	}
	Enable( Name := 1 ){
		Gui, % Name ":-Disabled"
	}
	Disable( Name := 1 ){
		Gui, % Name ":+Disabled"
	}
	Destroy( Name := 1 ){
		Gui, % Name ":Destroy"
		Gui[Name] := ""
	}
	Get( Control , SubCommand := "" , Name := 1 ){
		local output
		GuiControlGet, output, % Name ":" SubCommand, % Control
		return output
	}
	Set( Control , Value := "" , SubCommand := "" , Name := 1 ){
		GuiControl, % Name ":" SubCommand , % Control , % Value
	}
	Margin( x := 10 , y := 10 , Name := 1 ){
		Gui, % Name ":Margin", % x , % y
	}
	Color( Color1 := "22262a" , Color2 := "000000" , Name := 1 ){
		Gui, % Name ":Color", % Color1 , % Color2
	}
	WindowPosition( Hwnd ){
		local x , y , w , h
		WinGetPos, x , y , w , h , % "ahk_id " Hwnd
		return { X: x , Y: y , W: w , H: h }
	}
	ControlPosition( Hwnd , Name := 1 ){
		local x , y , w , h , pos
		GuiControlGet, pos , % Name ":pos", % Hwnd
		return { X: x , Y: y , W: w , H: h }
	}
	Add( Type := "Button" , Options := "" , Display := "" , Name := 1 ){
		local hwnd 
		Gui, % Name ":Add", % Type, % Options " hwndhwnd " , % Display
		return Gui[Name].Controls[ ( Gui[Name].Handles[ hwnd ] := ++Gui[Name].ControlCount ) ] := hwnd
	}
	Font( Font , Options := "" , Name := 1 ){
		Gui, % Name ":Font", % Options, % Font
	}
	Options( Options , Name := 1 ){
		Gui, % Name ":" Options
	}
	Bind( Control , Method , BoundObject , Name := 1 ){
		local fn := Func( Method ).Bind( BoundObject )
		GuiControl, % Name ":+g", % Control, % fn
	}
	Helper(){
		Gui.Helper := {}
		Gui.Helper.MethodString := "New||Show|Hide|Enable|Disable|Destroy|Get|Set|Margin|Color|WindowPosition|ControlPosition|Add|Font|Options|Bind|"
		Gui.Helper.MethodList := {}
		Gui.Helper.MethodList.New := "GuiHwnd := Gui.New( options := ""+AlwaysOnTop"" , Name := 1 )"
		Gui.Helper.MethodList.Show := "Gui.Show( Options := """" , Title := "" , Name := 1 )"
		Gui.Helper.MethodList.Hide := "Gui.Hide( Name := 1 )"
		Gui.Helper.MethodList.Enable := "Gui.Enable( Name := 1 )"
		Gui.Helper.MethodList.Disable := "Gui.Disable( Name := 1 )" 
		Gui.Helper.MethodList.Destroy := "Gui.Destroy( Name := 1 )"
		Gui.Helper.MethodList.Get := "Output := Gui.Get( Control , SubCommand := """" , Name := 1 )"
		Gui.Helper.MethodList.Set := "Gui.Set( Control , Value , SubCommand := """" , Name := 1 )"
		Gui.Helper.MethodList.Margin := "Gui.Margin( x := 10 , y := 10 , Name := 1 )"
		Gui.Helper.MethodList.Color := "Gui.Color( Color1 := ""F0F0F0"" , Color2 := ""FFFFFF"" , Name := 1 )"
		Gui.Helper.MethodList.WindowPosition := "Pos := Gui.WindowPosition( GuiHwnd )"
		Gui.Helper.MethodList.ControlPosition := "Pos := Gui.ControlPosition( Control , Name := 1 )"
		Gui.Helper.MethodList.Add := "ControlHwnd := Gui.Add( Type := ""Button"" , Options := """" , Display := """" , Name := 1 )"
		Gui.Helper.MethodList.Font := "Gui.Font( Font := """" , Options := """" , Name := 1 )"
		Gui.Helper.MethodList.Options := "Gui.Options( Options := """" , Name := 1 )"
		Gui.Helper.MethodList.Bind := "Gui.Bind(  Control , Method , BoundObject , Name := 1  )"
		Gui.Destroy( "GuiHelper" )
		Gui.New( "+AlwaysOnTop" , "GuiHelper" , "GuiHelper" )
		Gui.Color( "22262a" , "62768a" , "GuiHelper" )
		Gui.Margin( 10 , 20 , "GuiHelper" )
		Gui.Font( "Segoe UI" , "s10 cWhite Bold Q5"  , Name := "GuiHelper" )
		Gui.Helper.ListBox := Gui.Add( "ListBox" , "xm ym w350 r" Gui.Helper.MethodList.Count() , Gui.Helper.MethodString , "GuiHelper" )
		Gui.Helper.Button := Gui.Add( "Button" , "xm w350 " , "Clipboard Method" , "GuiHelper" )
		Gui.Bind( Gui.Helper.Button , "Gui._HelperClipIt" , "" , "GuiHelper" )
		Gui.Bind( Gui.Helper.ListBox , "Gui._HelperDisplayIt" , "" , "GuiHelper" )
		Gui.Helper.Edit := Gui.Add( "Edit" , "xm w350 r1" , "" , "GuiHelper" )
		Gui.Show( , , "GuiHelper" )
	}
	_HelperClipIt(){
		local selected := Gui.Get( Gui.Helper.ListBox ,, "GuiHelper" ) , cc := Gui.Helper.MethodList
		Clipboard := Gui.Helper.MethodList[selected]
	}
	_HelperDisplayIt(){
		local selected := Gui.Get( Gui.Helper.ListBox ,, "GuiHelper" ) , cc := Gui.Helper.MethodList
		Gui.Set( Gui.Helper.Edit , Gui.Helper.MethodList[selected] , , "GuiHelper" )
	}
}
User avatar
iilabs
Posts: 296
Joined: 07 Jun 2020, 16:57

Re: [Tool] Gui Prototype Maker

Post by iilabs » 25 Jul 2022, 11:34

Very useful. Wish I had this earlier. Lol
Post Reply

Return to “Scripts and Functions (v1)”