GUI the same variable in different TABs

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
euras
Posts: 429
Joined: 05 Nov 2015, 12:56

GUI the same variable in different TABs

22 Jan 2018, 13:18

What I try to do is to transfer the same Edit variable with the same name through all TABs. In example I have bellow there is only the one variable, but in my original one, there is a LOT of variables and if I need to repeat all those again in each Tab with different name like vVar_1 vVar_2 vVar_3 it would be a hell. I know that I can skip putting it into TAB's and put it into Gui, Tab but is there a way how I can use the same variable in all TABs? In example bellow you can see what I tried to make (without success..)

Code: Select all

gui, new
gui, add, Tab2, AltSubmit vTabs gTabs, First|Second|Third
gui, show, autosize
return

Tabs:
Gui, Submit, NoHide
gui, tab, %Tabs%
First_Tab()
return

First_Tab()
{
	global
	gui, add, Edit, x20 y40 w100 vEdit_1
}
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: GUI the same variable in different TABs

22 Jan 2018, 16:06

Code: Select all

.
.
.
Tab(5)
Return

Tab(no) {
   Loop % no
	   Gui, Add, Edit,% "x20 y40 w100 vEdit_" . A_Index  ; you might change the coords accordingly
       }
Not tested.
euras
Posts: 429
Joined: 05 Nov 2015, 12:56

Re: GUI the same variable in different TABs

23 Jan 2018, 02:47

BoBo wrote:

Code: Select all

	   Gui, Add, Edit,% "x20 y40 w100 vEdit_" . A_Index  ; you might change the coords accordingly
       }
It looks like you are adding Unique Variable vEdit_1, vEdit_2, vEdit_3 instead of the same named Variable to each TAB like vEdit_1, vEdit_1, vEdit_1
the Example doesn't work also.. ;/
User avatar
divanebaba
Posts: 805
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: GUI the same variable in different TABs

23 Jan 2018, 03:15

I think inside a Gui same variable names isn't possible.
When you split in multiple Gui's, like Gui, 1: Add, Edit, vMyEdit and Gui, 2: Add, Edit, vMyEdit than it is no problem with same variable names.
Using a TAB-control does not effect like multiple GUI's.

BoBo gave (surely) best method to create a bunch of virtual rows with minimum use of code.
Einfach nur ein toller Typ. :mrgreen:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Anput, Google [Bot], mcd, Nerafius and 128 guests