Sign in to follow this  
Followers 0
Bluhair

Calculating on the fly ?

5 posts in this topic

This seems logical to me but not Autoit.

Calculating command on the fly ?

Example:

$Label1= GuiCtrlCreateLabel("Test1", 5, 30, 100, 15)

$Label2= GuiCtrlCreateLabel("Test2", 5, 45, 100, 15)

$Label3= GuiCtrlCreateLabel("Test3", 5, 60, 100, 15)

For $i = 1 to 3

GuiCtrlSetData ("$Label"&$i, "Result " & $i)

Next

My goal was to Set the data in the three labels. Autoit returned no error message and no results.

Any suggestions ?

Thank You in advance.

Bluhair

Share this post


Link to post
Share on other sites



Interesting idea and I will probably use that in the future. However, I am trying to populate existing Labels with new data.

Thank you for your reply.

Share this post


Link to post
Share on other sites

Yet another way for your consideration.

#include <GUIConstantsEx.au3>

local  $width=500,$height=300,$Label1,$Label2,$Label3,$num=0

$hGui = GUICreate("GUI", $width, $height, -1, -1)
GUISetState()
$Label1= GuiCtrlCreateLabel("Test1", 5, 30, 100, 15)
$Label2= GuiCtrlCreateLabel("Test2", 5, 45, 100, 15)
$Label3= GuiCtrlCreateLabel("Test3", 5, 60, 100, 15)

; Because the labels were created sequencially, the labels' 
; identifiers (controlID) are numbered sequencially.
For $i = $Label1 to $Label3
    $num +=1
    GuiCtrlSetData ($i, "Result " & $num) ;$i being the controlID when label created.
Next

do
    sleep(10)
Until GUIGetMsg() = $GUI_EVENT_CLOSE

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