| View previous topic :: View next topic |
| Author |
Message |
myscript
Joined: 05 Jul 2007 Posts: 14
|
Posted: Sat May 10, 2008 9:55 pm Post subject: gLabel with Treeview |
|
|
Hi all,
In the manual i read:
| Quote: | | A g-label such as gMySubroutine may be listed in the control's options. This would cause the MySubroutine label to be launched automatically whenever the user performs an action in the control |
I have this code:
| Code: | ImageListID := IL_Create(10) ; Create an ImageList with initial capacity for 10 icons.
Loop 150 ; Load the ImageList with some standard system icons.
IL_Add(ImageListID, "shell32.dll", A_Index) ; Omits the DLL's path so that it works on Windows 9x too.
Gui, Add, TreeView, gMyTree ImageList%ImageListID%
TV_Add("Name of Item", 0, "Icon136") ; Add an item to the TreeView and give it a folder icon.
Gui, Show
return
MyTree:
MsgBox aaaaaaaaaaaaaaaaa
Return
Guiclose:
exitapp |
Why the label MyTree is executed the first time i run the script???
thanks for the answer!!! |
|
| Back to top |
|
 |
evan Guest
|
Posted: Sat May 10, 2008 10:34 pm Post subject: |
|
|
i dont know why
but i do know there are simple ways to avoid
for example, using if statements
| Code: | xx=0
function:
if xx != 0
{
msgbox, aaaaaa
}
xx=1
return |
|
|
| Back to top |
|
 |
myscript
Joined: 05 Jul 2007 Posts: 14
|
Posted: Sat May 10, 2008 10:45 pm Post subject: |
|
|
Thanks for the answer but i think the function Label is executed however the first time
Yes i start with xx=0 but the line xx=1 is executed without action in the control |
|
| Back to top |
|
 |
Superfraggle
Joined: 02 Nov 2004 Posts: 901 Location: London, UK
|
Posted: Sun May 11, 2008 12:53 am Post subject: |
|
|
When you add an item to the treeview the item is automatically selected. Selecting an item launches the Subroutine. _________________ Steve F AKA Superfraggle
http://r.yuwie.com/superfraggle |
|
| Back to top |
|
 |
myscript
Joined: 05 Jul 2007 Posts: 14
|
Posted: Sun May 11, 2008 4:08 pm Post subject: |
|
|
thanks....
I found that it's possible to insert in treview's options "AltSumit"
then in the suroutine:
if (A_GuiEvent == "Normal") thus it's possible to execute the subroutine only if i left click the item
 |
|
| Back to top |
|
 |
|