 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Klaus
Joined: 12 May 2005 Posts: 325 Location: Münster, Germany
|
Posted: Mon Sep 14, 2009 12:27 pm Post subject: Adding controls dynamically |
|
|
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 |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 8255 Location: Maywood, IL
|
Posted: Mon Sep 14, 2009 12:30 pm Post subject: |
|
|
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 |
|
 |
Klaus, not logged in Guest
|
Posted: Mon Sep 14, 2009 12:45 pm Post subject: |
|
|
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
|
Posted: Mon Sep 14, 2009 12:51 pm Post subject: |
|
|
I'm not sure what you mean by that. Is it working now? _________________
(Common Answers) |
|
| Back to top |
|
 |
Klaus, not logged in Guest
|
Posted: Mon Sep 14, 2009 1:48 pm Post subject: |
|
|
Excuse me, please,
yes, it works!
Regards,
Klaus |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|