Combining Variables Dont Show Up In Gui Using GuiControl

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
roonyrooxcess
Posts: 61
Joined: 20 Nov 2020, 21:29

Combining Variables Dont Show Up In Gui Using GuiControl

06 May 2021, 10:27

Hi,

I'm having problems with combining two variables & displaying them.

They initially show up in the gui but when I alter them using GuiControl, it only displays the 1st variable, not sure why ...

Thanks!

Code: Select all

#SingleInstance, Force
;Create Initial Array
Data := Object()
i:=39
Loop 20
{
	i++
	data[A_Index] := i
}
Value := data[5]
x:=0
number:=0
YAxisInc:=12
StatusInc:=1
NumStatusInc:=1
NotShown := True ;gui has not yet been shown
loop
{
	;Creates Initial Array In Gui As Guide Left Row
	Loop, 20
	{
		x++			;Increments by - to create 40 to 60
		y1:=data[x]
		YAxis:=number += YAxisInc ;Increments by 12 to create a gap of 12 between numbers
		Gui,Add,Text,x160  y%YAxis%, %x% %y1%
	}

	;Create Variables To Show In Gui

	;Outerloop Using OuterInc   Cascades The Entire Initial Array From Array 1 To Array 20, Array 2 to Array 20 etc.,
	;InnerLoopFill Creates An InnerLoop Using OuterInc To Fill In Gaps Created By Cascading The Initial Array
	;If the Entire Initial Array gets displaced From Array 1 to Array 5 The InnerLoopLoop Fills Empty Values In Array 1 to 5 Using Values 1 to 5 From Initial Array
	;Outerloop
	;Outerloop Using OuterInc   Cascades The Entire Initial Array From Array 1 To Array 20, Array 2 to Array 20 etc.,
	OuterInc:=2
	FillPreviousInc:=1

	Loop 20
	{
		StartPointFill:=OuterInc-OuterInc +1
		;InnerLoop
		Datax := Object()
		IncIncrease:=OuterInc
		Loop 20
		{

			;Copies Values From Array data[1] to Datax[2],  data[2] to Datax[3] etc.
			
			xs1:=data[A_Index]

			xs=Apple %xs1%

			data[A_Index]:=xs

			Datax[IncIncrease] := data[A_Index]
			IncIncrease++



			;InnerLoopFill Creates An InnerLoop Using OuterInc To Fill In Gaps Created By Cascading The Initial Array
			;If the Entire Initial Array gets displaced From Array 1 to Array 5 The InnerLoop Fills Empty Values In Array 1 to 5 Using Values 1 to 5 From Initial Array
			
			InnerLoopFill:=0
			Loop %OuterInc%
			{
				InnerLoopFill++
				Datax[InnerLoopFill] := data[InnerLoopFill]
			}

		}


		;Displays Created Cascade In Gui
		x:=0
		number:=0
		YAxisInc:=12
		StatusInc:=1
		NumStatusInc:=1
		First:=!First++
		Loop, 20
		{
			x++			;Increments by - to create 40 to 60
			y1:=Datax[x]
			YAxis:=number += YAxisInc ;Increments by 12 to create a gap of 12 between numbers
			IF NotShown
				Gui,Add,Text,x360 y%YAxis% vY%YAxis%, %x% %y1%
			Else
				GuiControl,,  Y%YAxis%, %x% %y1% 
			Sleep, 200
		}
		If NotShown
			Gui, Show,x1609 y186 w500, XGraph,% NotShown := False
		OuterInc++
	}
}


esc::
{

sleep 100
Send {LControl down}
sleep 100
Send {s}
sleep 100
Send {LControl up}

Reload
}
Return
User avatar
boiler
Posts: 16925
Joined: 21 Dec 2014, 02:44

Re: Combining Variables Dont Show Up In Gui Using GuiControl

06 May 2021, 10:37

Without looking through the details of your script, it sounds like it may be because the width of your control is limiting it. If it's a text control and you didn't specify the width, its width is whatever contains its original contents and doesn't change unless you change it. Try using the w option on that control when you create it, like w200 or whatever would be wide enough to contain the new contents, and see if it then shows both.
roonyrooxcess
Posts: 61
Joined: 20 Nov 2020, 21:29

Re: Combining Variables Dont Show Up In Gui Using GuiControl

06 May 2021, 10:39

Yea, I tried changing the W but it messes up the script even worse ...
User avatar
boiler
Posts: 16925
Joined: 21 Dec 2014, 02:44

Re: Combining Variables Dont Show Up In Gui Using GuiControl

06 May 2021, 10:43

In what way? You need it wide enough to contain that content anyway, right?
User avatar
boiler
Posts: 16925
Joined: 21 Dec 2014, 02:44

Re: Combining Variables Dont Show Up In Gui Using GuiControl

06 May 2021, 10:58

I ran your code and made the Text control wider, and that's definitely the issue. It can contain the new text if you make it wider. It apparently keeps adding text to the control beyond what you expected because you have nested loops or whatever is happening beyond your expectation, but that's not because of the width change. It was happening anyway and you just didn't see it because of the width limitation, so that needs to be fixed anyway.

roonyrooxcess wrote:
06 May 2021, 10:39
Yea, I tried changing the W but it messes up the script even worse ...
No, it's not messing up the script. It's no longer hiding what was already messed up with the script. Now you can see how it's messed up so you can fix it.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 344 guests