AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

gLabel with Treeview

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
myscript



Joined: 05 Jul 2007
Posts: 14

PostPosted: Sat May 10, 2008 9:55 pm    Post subject: gLabel with Treeview Reply with quote

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???


Rolling Eyes thanks for the answer!!!
Back to top
View user's profile Send private message
evan
Guest





PostPosted: Sat May 10, 2008 10:34 pm    Post subject: Reply with quote

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

PostPosted: Sat May 10, 2008 10:45 pm    Post subject: Reply with quote

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
View user's profile Send private message
Superfraggle



Joined: 02 Nov 2004
Posts: 901
Location: London, UK

PostPosted: Sun May 11, 2008 12:53 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
myscript



Joined: 05 Jul 2007
Posts: 14

PostPosted: Sun May 11, 2008 4:08 pm    Post subject: Reply with quote

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

Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group