Gui, Add, Progress, display nothing.. Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
James9491
Posts: 19
Joined: 18 Feb 2016, 12:10

Gui, Add, Progress, display nothing..

18 Jan 2017, 04:16

Hi,

I programed a script that uses Progress.
l also use two 'panels' built with Gui 1:Add.. and Gui 2:Add

Now, I wanted to make the progress vertical and found out that the only way to do that is by using 'Gui, Add, Progress, Vertical -Smooth w20 h300 cDefault vMyProgress..''

Well, I did a test script that works fine, but when I embed it in my main script, I get no display of that vertical progress bar.

The test script:

Code: Select all

#Persistent
#SingleInstance force
fill:=0
Gui, Add, Progress, Vertical -Smooth w20 h300 cDefault vMyProgress
loop, 11
	{
	GuiControl,, MyProgress, %fill%
	Gui Show
	fill:=fill+10
	sleep,	150
	}
sleep, 5000
I changed at all the places and replaced as follows:

progress, On ==>> Gui, Add, Progress, Vertical -Smooth w20 h300 cDefault vMyProgress

progress, %shrink_Value%,,, Reduction amount: %shrink_Value%`%, ==>> GuiControl,, MyProgress, %shrink_Value%`%

progress, Show ==>> GuiControl, Show, MyProgress

progress, off ==>> GuiControl, Hide, MyProgress or GuiControl, Delete, MyProgress



What is wrong? why it doesn't display? what I am doing wrong?

James
User avatar
jNizM
Posts: 2661
Joined: 30 Sep 2013, 01:33
GitHub: jNizM
Contact:

Re: Gui, Add, Progress, display nothing..

18 Jan 2017, 04:50

It would be better to show us the (a) not working example =)
[AHK] 1.1.32.00 x64 Unicode | [WIN] 10 Pro (Version 2004) x64 | [GitHub] Profile
Donations are appreciated if I could help you
James9491
Posts: 19
Joined: 18 Feb 2016, 12:10

Re: Gui, Add, Progress, display nothing..

18 Jan 2017, 05:14

It is about 3,000 lines code... :o
Ok, I'll do it by showing you the main parts:

This part: Define the function:

Code: Select all

!F3::		;<ALT><F3>> =	trail enable
pause, off
P=-1		;Pause = 1; un_Pause= -1
Suspend, on
toolTip,,,,4					;Clear toolTip!
trail_Size:=1
trail_Title=
gosub set_levels
trail_Size:=LY1-UY1
Upper_Y_Support:=LY1
gosub Find_The_Peak
gosub greenWatch
Last_Known_Red:=LY1
coordMode, mouse, screen
mouseClickDrag, left, xgFound, ygFound , xgFound, upper_Yellow_Y,,								;bring the Green_Line to the last known peak
xRed:=-1
yRed:=-1
last_red_Line:=110										;random init value
mouseMove, UX1, upper_Yellow_Y,,				;lpace the red_Line on LY1
gosub !R
shrink_Value:=0
trail_reduction_interval:=120000
sound_interval:=0											;reset the increasing alert interval
ElapsedTime2:=1
ElapsedTime1:=1
ElapsedTime0:=1
Y_scan_flag:=1
upDown:=-1														;for trail mode -> set 'down' (only) trigger
Suspend, off
Gui, Add, Progress, Vertical -Smooth w20 h300 cDefault vMyProgress
GuiControl, Show, MyProgress
;progress, On
Last_Alert:=A_TickCount-55000		;For a quick ignition
Scanner_pace:=1500
setTimer, Scanner, 1500, 350		;tracks the yellow trail
return
And this part: makes the actual calculation of the progress and display it:

Code: Select all

;---------------------------------[This part calculate shrink_Value as the value to advance trail towards the last price]------------
	if (support_Y<LY1)
		{
		shrink_Value:=Floor((LY1-support_Y)/5)								;20% from the gap from the current trail to the last price
		if (shrink_Value<1)
			shrink_Value:=1
		if (LY1-shrink_Value<=support_Y and trail_reduction_interval!=180001)		;are you too close to the current postion? (Stay just below it) - the 180001 to prevent repeating sounds
			{
			trail_reduction_interval:=180001									;Increase the interval to ~6 minutes
			ElapsedTime0:=A_TickCount
			soundPlay, %A_WorkingDir%\Sounds\Locomotive steam panting[8].wav
			shrink_Value:=0																;dont shrink anymore
			}
;			if (shrink_Value>0 and peak_detection=0 and (LY1-shrink_Value>support_Y or (LY1-shrink_Value>=trail_lower_barrier and trail_lower_barrier>0)))
			if (shrink_Value>0 and (LY1-shrink_Value>support_Y or (LY1-shrink_Value>=trail_lower_barrier and trail_lower_barrier>0)))
			{
			LY1:=LY1-shrink_Value													;reduce the current trail gap
			GuiControl, Show, MyProgress
;			progress, Show
			setFormat, float, 5.2
;			Xtemp:=(1-((LY1-rightMost_Y)/trail_Size))*100
			Xtemp:=(1-((LY1-support_Y)/trail_Size))*100
			GuiControl,, MyProgress, %shrink_Value%`%
;			progress, %Xtemp%,,, Reduction amount: %Xtemp%`%,
			soundPlay, %A_WorkingDir%\Sounds\Stone Slide 01.wav
			coordMode, mouse, Screen
			mouseGetPos, Xpos, Ypos
			if (yRed>Ypos)	;if the mouse cursor hangs above the red line
				{
James
hunter99
Posts: 128
Joined: 20 Jan 2014, 17:57

Re: Gui, Add, Progress, display nothing..

18 Jan 2017, 11:07

Hi James:
I would say change this:
ElapsedTime0:=1
Y_scan_flag:=1
upDown:=-1 ;for trail mode -> set 'down' (only) trigger
Suspend, off
Gui, Add, Progress, Vertical -Smooth w20 h300 cDefault vMyProgress
GuiControl, Show, MyProgress ;<-------------------------------------------change this to "Gui, Show" --> this "GuiControl, Show, MyProgress " is not a valid command.
;see the docs
;progress, On
Last_Alert:=A_TickCount-55000 ;For a quick ignition
Scanner_pace:=1500
hunter99

Edit:
get a copy of CodeQuicktester by GeekDude from here:
https://autohotkey.com/boards/viewtopic.php?f=6&t=6113
Great for testing these little snippets of code.
James9491
Posts: 19
Joined: 18 Feb 2016, 12:10

Re: Gui, Add, Progress, display nothing..  Topic is solved

18 Jan 2017, 13:42

Thanks hunter99 but it seems that I solved the mystery.
In the end, the other two Gui's controls panels (checkBox type) they was the cause that blocked the 'Gui, Add, Progress..'
I had to give the 'Gui, Add, Progress' also a number to be able to refer to it separately.

Here is a combined three GUIs test script that I've built in order to solve the mystery.

Code: Select all

#Persistent
#SingleInstance force
X2_gui:=582		;Trigger menu initial X position
Y2_gui:=57		;Trigger menu initial Y position

Gui 1:Destroy
Gui 1:Add, CheckBox, w115 y10 vOptPC %pcSign%, pixel color
Gui 1:Add, CheckBox, w115 v1st_V %1st_vSign%, 1st_Volume detector
Gui 1:Add, CheckBox, w115 v2nd_V %2nd_vSign%, 2nd_Volume detector
;Gui 1:Add, CheckBox, w115 vOptBL gOptBL, breach_levels
;Gui 1:Add, CheckBox, w115 vOptTL gOptTL, trend_line
Gui 1:Add, ComboBox, vMode, breach_levels||trend_line|

Gui 1:Add, Button, default x100, OK  ; The label ButtonOK (if it exists) will be run when the button is pressed.

Gui 1:Show
;=======================================================================
Gui 2:Destroy
/*
Gui 2:Add, CheckBox, w80 x10 vOplclk gOplclk %lSign%, Left Breach
Gui 2:Add, CheckBox, x+5 vOprclk gOprclk %rSign%, Right Breach
Gui 2:Add, CheckBox, y25 x55 vbuyEnable gbuyEnable %bSign%, Breach Up 
Gui 2:Add, CheckBox, vSL_TP_Mode gSL_TP_Mode %tSign%, Break Down
*/
Gui 2:Add, CheckBox, vbuyEnable %bSign%, ---| BUY ENABLE |---
Gui 2:Add, CheckBox, vSL_TP_Mode %tSign%, ---| SL / TP |---
Gui 2:Add, CheckBox, y+15 vcolors_upd %cSign%, ---| COLORS UPDATE |---

Gui 2:Show, X%X2_gui% Y%Y2_gui%,
;=======================================================================
Gui 3: Destroy
fill:=0
Gui 3: Add, Progress, Vertical -Smooth w20 h300 cDefault vMyProgress
loop, 11
	{
	GuiControl 3:, MyProgress, %fill%
	Gui 3: Show
	fill:=fill+10
	sleep,	150
	}
sleep, 4000
Gui 3: Hide
sleep, 4000
Gui 3: Show
Thanks guys,

James

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], mikeyww, tatagi and 26 guests