Sign in to follow this  
Followers 0
Daniel W.

Script Problem.... With Guictrlsetdata

5 posts in this topic

#1 ·  Posted (edited)

Hi,

i got it already o.O

....

Edited by Daniel W.

--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

Share this post


Link to post
Share on other sites



Hi,

i got this code:

CODE

#include <GUIConstants.au3>

GUICreate("Config Manager", 700, 220)

$bind = GUICtrlCreateLabel("Bind", 10, 13)

$input1 = GUICtrlCreateInput("", 50, 10, 100)

$input2 = GUICtrlCreateInput("", 160, 10, 430)

$save = GUICtrlCreateButton("Save", 595, 8, 100)

$label = GUICtrlCreateLabel("", 5, 40, 688, 175, $SS_SUNKEN)

$label1 = GUICtrlCreateLabel( "", 10, 45)

$label2 = GUICtrlCreateLabel( "", 52, 45)

$label3 = GUICtrlCreateLabel( "", 162, 45)

$label4 = GUICtrlCreateLabel( "", 10, 65)

$label5 = GUICtrlCreateLabel( "", 52, 65)

$label6 = GUICtrlCreateLabel( "", 162, 65)

$label7 = GUICtrlCreateLabel( "", 10, 85)

$label8 = GUICtrlCreateLabel( "", 52, 85)

$label9 = GUICtrlCreateLabel( "", 162, 85)

$label10 = GUICtrlCreateLabel( "", 10, 105)

$label11 = GUICtrlCreateLabel( "", 52, 105)

$label12 = GUICtrlCreateLabel( "", 162, 105)

$label13 = GUICtrlCreateLabel( "", 10, 125)

$label14 = GUICtrlCreateLabel( "", 52, 125)

$label15 = GUICtrlCreateLabel( "", 162, 125)

$label16 = GUICtrlCreateLabel( "", 10, 145)

$label17 = GUICtrlCreateLabel( "", 52, 145)

$label18 = GUICtrlCreateLabel( "", 162, 145)

$label16 = GUICtrlCreateLabel( "", 10, 165)

$label17 = GUICtrlCreateLabel( "", 52, 165)

$label18 = GUICtrlCreateLabel( "", 162, 165)

$label16 = GUICtrlCreateLabel( "", 10, 185)

$label17 = GUICtrlCreateLabel( "", 52, 185)

$label18 = GUICtrlCreateLabel( "", 162, 185)

GUISetState()

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

Exit

Case $msg = $save

$inputread1 = GUICtrlRead( $input1 )

$inputread2 = GUICtrlRead( $input2 )

If $label1 = "" Then

GUICtrlSetData( $label1 , "Bind")

GUICtrlSetData( $label2 , $inputread1)

GUICtrlSetData( $label3 , $inputread2)

Else

If $label4 = "" Then

GUICtrlSetData( $label4 , "Bind")

GUICtrlSetData( $label5 , $inputread1)

GUICtrlSetData( $label6 , $inputread2)

Else

If $label7 = "" Then

GUICtrlSetData( $label7 , "Bind")

GUICtrlSetData( $label8 , $inputread1)

GUICtrlSetData( $label9 , $inputread2)

Else

If $label10 = "" Then

GUICtrlSetData( $label10 , "Bind")

GUICtrlSetData( $label11 , $inputread1)

GUICtrlSetData( $label12 , $inputread2)

Else

If $label13 = "" Then

GUICtrlSetData( $label13 , "Bind")

GUICtrlSetData( $label14 , $inputread1)

GUICtrlSetData( $label15 , $inputread2)

Else

If $label16 = "" Then

GUICtrlSetData( $label16 , "Bind")

GUICtrlSetData( $label17 , $inputread1)

GUICtrlSetData( $label18 , $inputread2)

EndIf

EndIf

EndIf

EndIf

EndIf

EndIf

EndSelect

WEnd

When you write something in the Inputs and klick on "Save" it should write them in the first line that is free , but i doesn't write anything there and i got no idea why

regards Daniel w.

Your $label<n> variables contain the Control ID of the label, not it's text. Just as you use GuiCtrlSetData to write text to the lable, you need to use GuiCtrlRead to read the text from it:

#include <GUIConstants.au3>

GUICreate("Config Manager", 700, 220)

$bind = GUICtrlCreateLabel("Bind", 10, 13)
$input1 = GUICtrlCreateInput("", 50, 10, 100)
$input2 = GUICtrlCreateInput("", 160, 10, 430)
$save = GUICtrlCreateButton("Save", 595, 8, 100)
$label = GUICtrlCreateLabel("", 5, 40, 688, 175, $SS_SUNKEN)
$label1 = GUICtrlCreateLabel("", 10, 45)
$label2 = GUICtrlCreateLabel("", 52, 45)
$label3 = GUICtrlCreateLabel("", 162, 45)
$label4 = GUICtrlCreateLabel("", 10, 65)
$label5 = GUICtrlCreateLabel("", 52, 65)
$label6 = GUICtrlCreateLabel("", 162, 65)
$label7 = GUICtrlCreateLabel("", 10, 85)
$label8 = GUICtrlCreateLabel("", 52, 85)
$label9 = GUICtrlCreateLabel("", 162, 85)
$label10 = GUICtrlCreateLabel("", 10, 105)
$label11 = GUICtrlCreateLabel("", 52, 105)
$label12 = GUICtrlCreateLabel("", 162, 105)
$label13 = GUICtrlCreateLabel("", 10, 125)
$label14 = GUICtrlCreateLabel("", 52, 125)
$label15 = GUICtrlCreateLabel("", 162, 125)
$label16 = GUICtrlCreateLabel("", 10, 145)
$label17 = GUICtrlCreateLabel("", 52, 145)
$label18 = GUICtrlCreateLabel("", 162, 145)
$label16 = GUICtrlCreateLabel("", 10, 165)
$label17 = GUICtrlCreateLabel("", 52, 165)
$label18 = GUICtrlCreateLabel("", 162, 165)
$label16 = GUICtrlCreateLabel("", 10, 185)
$label17 = GUICtrlCreateLabel("", 52, 185)
$label18 = GUICtrlCreateLabel("", 162, 185)

GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $save
            $inputread1 = GUICtrlRead($input1)
            $inputread2 = GUICtrlRead($input2)
            If GUICtrlRead($label1) = "" Then
                GUICtrlSetData($label1, "Bind")
                GUICtrlSetData($label2, $inputread1)
                GUICtrlSetData($label3, $inputread2)
            Else
                If GUICtrlRead($label4) = "" Then
                    GUICtrlSetData($label4, "Bind")
                    GUICtrlSetData($label5, $inputread1)
                    GUICtrlSetData($label6, $inputread2)
                Else
                    If GUICtrlRead($label7) = "" Then
                        GUICtrlSetData($label7, "Bind")
                        GUICtrlSetData($label8, $inputread1)
                        GUICtrlSetData($label9, $inputread2)
                    Else
                        If GUICtrlRead($label10) = "" Then
                            GUICtrlSetData($label10, "Bind")
                            GUICtrlSetData($label11, $inputread1)
                            GUICtrlSetData($label12, $inputread2)
                        Else
                            If GUICtrlRead($label13) = "" Then
                                GUICtrlSetData($label13, "Bind")
                                GUICtrlSetData($label14, $inputread1)
                                GUICtrlSetData($label15, $inputread2)
                            Else
                                If GUICtrlRead($label16) = "" Then
                                    GUICtrlSetData($label16, "Bind")
                                    GUICtrlSetData($label17, $inputread1)
                                    GUICtrlSetData($label18, $inputread2)
                                EndIf
                            EndIf
                        EndIf
                    EndIf
                EndIf
            EndIf
    EndSelect
WEnd

Hope that helps! :)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Hi,

i got it already o.O

....

Well... that just takes all the fun out of it! :)

P.S. You might investigate putting the control IDs of your labels in an array to simplify the code, just for fun... :(


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

my script hadnt read the labels to edit that was the error


--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

Share this post


Link to post
Share on other sites

my script hadnt read the labels to edit that was the error

Glad you got it working! :)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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