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 

Adding controls dynamically

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



Joined: 12 May 2005
Posts: 325
Location: Münster, Germany

PostPosted: Mon Sep 14, 2009 12:27 pm    Post subject: Adding controls dynamically Reply with quote

Hi, Community,
playing around with some simplifying ideas around Gui's I stumbled into the following which I can't explain (well, it works, but why).
Here's my code
Code:
c1=1,Add, Button,   w100 h20  x10 y10   glabelB1 vValueB1     , Button1
c2=1,Add, ListView, w100 h100 x10 y150  glabelL1 vValueL1 grid, One|Two
c3=1,Add, Button,   w50  h20  x10 y 260 glabelB2 vValueB2     , Button2
; three control definitions, could come from an .INI-file

loop, 3
{
  addControl(c%A_Index%)
}
Gui, Show
return


labelB1:
msgbox, Here is Button 1
return

labelL1:
Msgbox, Here is the ListView
return

labelB2:
MsgBox, Here is Button 2
return


addControl(parms)
{
  global
  StringSplit, p, parms, `,
  p3 = %p3% ; works only with this line activated, why?
  Gui, %p1%:%p2%, %p3%, %p4%, %p5%
}

You see my red coloured question in the code box, could anyone explain?
Regards,
Klaus
Back to top
View user's profile Send private message Send e-mail
engunneer



Joined: 30 Aug 2005
Posts: 8255
Location: Maywood, IL

PostPosted: Mon Sep 14, 2009 12:30 pm    Post subject: Reply with quote

most likely due to autotrim, try changing
Code:

StringSplit, p, parms, `,
;to
StringSplit, p, parms, `,, %A_Space%


Without this, it's trying to create a " Button", not a "Button"
_________________

(Common Answers)
Back to top
View user's profile Send private message Visit poster's website
Klaus, not logged in
Guest





PostPosted: Mon Sep 14, 2009 12:45 pm    Post subject: Reply with quote

Hi, engunneer,
I imputed StringSplit to autotrim, but it doesn't (of course!).
Thanks for you explanation,
Klaus
Back to top
engunneer



Joined: 30 Aug 2005
Posts: 8255
Location: Maywood, IL

PostPosted: Mon Sep 14, 2009 12:51 pm    Post subject: Reply with quote

I'm not sure what you mean by that. Is it working now?
_________________

(Common Answers)
Back to top
View user's profile Send private message Visit poster's website
Klaus, not logged in
Guest





PostPosted: Mon Sep 14, 2009 1:48 pm    Post subject: Reply with quote

Excuse me, please,
yes, it works!
Regards,
Klaus
Back to top
Display posts from previous:   
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