AutoHotkey Community

It is currently May 27th, 2012, 1:07 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: new dropdownlist
PostPosted: April 25th, 2008, 2:43 am 
Offline

Joined: June 23rd, 2007, 2:44 am
Posts: 136
I am making a new dropdownlist for use in my script.

Code:

x:=10
y:=10
r:=5
i=12||01|02|03|04|05|06|07|08|09|10|11
NewListBox(x,y,r,i,"hour")
         
gui, show, w500 h500

return



guiclose:
exitapp

NewListBox(x,y,r,i,v)
{
global
StringSplit, i, i , ||,
Gui, Add, ListBox,x%x% y%y% r1 v%v% gLBhandler ReadOnly,%i1%
Gui, Add, ListBox,x%x% y%y% r%r% vDD gLBhandler ReadOnly,%i%
GuiControl,Hide,DD
Return

LBhandler:
if state=1
{
state=0
Gui, submit,nohide


GuiControl,,%v%,|%DD% ;error with %v%
GuiControl,Hide,DD
GuiControl,Show,%v%
}
else
{
state=1
GuiControl,Show,DD
GuiControl,Hide,%v%
}
Return
}


there is an error with

GuiControl,,%v%,|%DD%

I want to change the variable who's name is stored in variable v. I need to do it like this so i have have multiple dropdownlists. Can anyone help me resolve it.

if you change the above line to
GuiControl,,hour,|%DD%
it works but I cant have multiple dropdownlists.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 25th, 2008, 5:59 am 
Offline

Joined: February 8th, 2008, 9:17 pm
Posts: 31
Location: VA
1. your code didnt produce an error when i tried it but maybe you could force an expression
Code:
GuiControl,, % v   ; forcing an expression might work
   ,|%DD%


2. I dont quite see the point of 'GuiControl,,%v%,|%DD% ;error with %v%' in your example because 'v' could never contain the name of a var assigned to a control


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 25th, 2008, 6:02 am 
Offline

Joined: June 23rd, 2007, 2:44 am
Posts: 136
It doesnt actually give an error. what i want is for 'v' to contain the name of the var assigned to the control. why is this not possible?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 25th, 2008, 6:08 am 
Offline

Joined: February 8th, 2008, 9:17 pm
Posts: 31
Location: VA
i meant your code does not assign a name of a var to 'v'


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 25th, 2008, 6:09 am 
Offline

Joined: June 23rd, 2007, 2:44 am
Posts: 136
yes it does. i do it in the function call

put msgbox,%v% in the function and it will come up with hour.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 25th, 2008, 6:13 am 
Offline

Joined: February 8th, 2008, 9:17 pm
Posts: 31
Location: VA
my bad i didnt see that


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 25th, 2008, 6:14 am 
Offline

Joined: June 23rd, 2007, 2:44 am
Posts: 136
any ideas??


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 25th, 2008, 6:59 am 
Offline

Joined: February 8th, 2008, 9:17 pm
Posts: 31
Location: VA
v is local not global
Code:
NewListBox(x,y,r,i,var)
{
global
v:=var


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 25th, 2008, 8:58 am 
Offline

Joined: June 23rd, 2007, 2:44 am
Posts: 136
thanks for the help

still having troubles
Code:


x:=10
y:=10
w:=40
r:=5
i=12||01|02|03|04|05|06|07|08|09|10|11
NewListBox(x,y,w,r,i,"hour")
y:=100
i=00||05|10|15|20|25|30|35|40|45|50|55
NewListBox(x,y,w,r,i,"hour1")

gui, show, w500 h500

return

guiclose:
exitapp

NewListBox(x,y,w,r,inf,var)
{
global
v=%var%
DD=DD%var%
h:=r*15
i=%inf%
StringSplit, i, i , ||,
Gui, Add, ListBox,x%x% y%y% w%w% r1 v%v% gLBhandler ReadOnly,%i1%
GuiControlGet, VarHwnd, Hwnd,%v%
GuiControl,Hide,%DD%




Return VarHwnd

LBhandler:
MouseGetPos, , , , CurHwnd, 1
GuiControlGet, state,Visible, %DD% ; Visible: Retrieves 1 if the control is visible or 0 if it is hidden.

;**********************************
;I need to save the variable "i" into something like i%VarHwnd% so i can use something like the line below
;GuiControl,,%CurHwnd%,% "" . i%CurHwnd%
GuiControl,,%CurHwnd%,%i%


GuiControl,move,%CurHwnd%,h%h%

KeyWait, LButton, D
MouseGetPos, , , , MouHwnd, 3

if MouHwnd!=%CurHwnd%   
{
GuiControlGet, OutputVar , , %CurHwnd%
GuiControl,,%CurHwnd%,|%OutputVar%
GuiControl,move,%CurHwnd%,h20
}

Return


}



I seed to save the information that i load in my Dropdown box so when i have multiple the correct one loads. can you help


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Amandaville, BrandonHotkey, chaosad and 22 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group