Sign in to follow this  
Followers 0
AsLY

multi-controlID

7 posts in this topic

hello,

i have just a question;

is it possible to use two or more variable in GUICtrlSetData or other command ?

my script, i want used the same GUICtrlSetData for all GUICtrlCreateCombo...

$p1lvlMm = GUICtrlCreateInput ( $p1lvlMm, 220, 170, 25, 21, $SS_CENTER )
$p1PMm = GUICtrlCreateCombo ("100%", 245, 170, 55)
$p2lvlMm = GUICtrlCreateInput ( $p2lvlMm, 300, 170, 25, 21, $SS_CENTER )
$p2PMm = GUICtrlCreateCombo ("100%", 325, 170, 55)
$p3lvlMm = GUICtrlCreateInput ( $p3lvlMm, 380, 170, 25, 21, $SS_CENTER )
$p3PMm = GUICtrlCreateCombo ("100%", 405, 170, 55)
$p4lvlMm = GUICtrlCreateInput ( $p4lvlMm, 460, 170, 25, 21, $SS_CENTER )
$p4PMm = GUICtrlCreateCombo ("100%", 485, 170, 55)
$p5lvlMm = GUICtrlCreateInput ( $p5lvlMm, 540, 170, 25, 21, $SS_CENTER )
$p5PMm = GUICtrlCreateCombo ("100%", 565, 170, 55)
$p6lvlMm = GUICtrlCreateInput ( $p6lvlMm, 620, 170, 25, 21, $SS_CENTER )
$p6PMm = GUICtrlCreateCombo ("100%", 645, 170, 55)
$p7lvlMm = GUICtrlCreateInput ( $p7lvlMm, 700, 170, 25, 21, $SS_CENTER )
$p7PMm = GUICtrlCreateCombo ("100%", 725, 170, 55)
$p8lvlMm = GUICtrlCreateInput ( $p8lvlMm, 780, 170, 25, 21, $SS_CENTER )
$p8PMm = GUICtrlCreateCombo ("100%", 805, 170, 55)
$p9lvlMm = GUICtrlCreateInput ( $p9lvlMm, 860, 170, 25, 21, $SS_CENTER )
$p9PMm = GUICtrlCreateCombo ("100%", 885, 170, 55)

GUICtrlSetData( $p1PMm & $p2PMm,"90%|80%|70%|60%|50%|40%|30%|20%|10%|0%")

thanks

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Here's what rakudave is saying, 7 lines of code to replace what you have above, added a gui to show how it looks:

#include <guiconstants.au3>
Global $plv1Mm[10], $pPMm[10]
$Main = GUICreate('My GUI', 950, 300)
For $iCount = 1 To 9
    $plv1Mm[$iCount] = GUICtrlCreateInput('', 140 + ($iCount * 80), 170, 25, 21, $SS_CENTER)
    $pPMm[$iCount] = GUICtrlCreateCombo('', 165 + ($iCount * 80), 170, 55, 150)
    GUICtrlSetData($pPMm[$iCount], "100%|90%|80%|70%|60%|50%|40%|30%|20%|10%|0%", '100%')
Next

GUISetState()

While GUIGetMsg() <> -3
WEnd

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Thanks a lot,

i am a noob with autoit, i have discoverd it 2weeks ago, so i learn

Share this post


Link to post
Share on other sites

i have an other probleme

i want to write the data of the GUICtrlCreateInput into a ini file.

i use this code:

; $namep[1] = t9 in the inputbx
For $iCount = 1 To 9
    $namep[$iCount] = GUICtrlCreateInput ("", 180 + ($iCount * 80), 50, 80, 20, $SS_CENTER)
next
$calc = GuiCtrlCreateButton ("Calculer", 220, 111, 100, 30)
GuiSetState ()
Do
    $Msg = GuiGetMsg()
    If $msg = $calc Then
    For $iCount = 1 To 9
    iniWrite ( "DB.ini", $nplanete[$iCount], "Nom de la planète", GUICtrlRead ($namep[$iCount]))
    Next
endif
Until $msg = $GUI_EVENT_CLOSE; Continue loop untill window is closed

but it write only

[0]
Nom de la planète=t9

Share this post


Link to post
Share on other sites

The key name never changed, therefore it was overwritten on each iteration of the loop

try something like

iniWrite ( "DB.ini", $nplanete[$iCount], "Nom de la planète " & $iCount, GUICtrlRead ($namep[$iCount]))

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

thanks lot it work fine

@+

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0