P0ZiTR0N Posted April 13, 2009 Posted April 13, 2009 In my brain born the idea to do the "dynamical" text... But how? Searched forum - found nothing usefull... maybe someone know or give the link to the topic where is the same described... The goal of the project is hot-changing data on-the-fly without creating any new label, but just modify current. I think it could be done as the progressbar but don't know the way for this... Any tips or critics are welcome expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> global $conf, $t ;~ $t = "text1" if $conf = 0 Then _check(0) endif func _check ($lab) if $lab = 1 then $t = "text1" MsgBox(0,"",$t) return $t elseIf $lab = 2 then $t = "text2" MsgBox(0,"",$t) return $t else $t = "text-no" MsgBox(0,"",$t) return $t endif endFunc ; the example of how it must work but without changing form code... Without overlay ; hot-changing data on-the-fly: if pressed radio 1, $value = "x", if pressed radio 2 - "y" ; and the form-window displays the data of $value #cs func _contr ($lab) if $lab = 1 then $Label2 = GUICtrlCreateLabel("text1", 40, 80, 40, 40) GUICtrlSetFont(-1, 10, 600, 0, "MS Sans Serif") return $t ElseIf $lab = 2 then $Label2 = GUICtrlCreateLabel("text2", 40, 80, 40, 40) GUICtrlSetFont(-1, 10, 600, 0, "MS Sans Serif") return $t else $Label2 = GUICtrlCreateLabel("text0", 40, 80, 40, 40) GUICtrlSetFont(-1, 10, 600, 0, "MS Sans Serif") return $t endif EndFunc #ce #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 116, 100, 193, 125) $Radio1 = GUICtrlCreateRadio("conf1", 0, 8, 113, 17) GUICtrlSetState(-1, $GUI_CHECKED) $Radio2 = GUICtrlCreateRadio("conf2", 0, 24, 113, 17) $Label2 = GUICtrlCreateLabel($t, 40, 80, 50, 40) GUICtrlSetFont(-1, 10, 600, 0, "MS Sans Serif") GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Radio1 _check(1) ;~ MsgBox(0,"","Radio1") Case $Radio2 _check(2) ;~ MsgBox(0,"","Radio2") EndSwitch WEnd
JRowe Posted April 13, 2009 Posted April 13, 2009 Not sure if this is what you want, but use the following to set the text on controls: GUICtrlSetData($yourControl, "Whatever text you want placed in the control") Just use that function wherever you want to change the text on a control. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center]
evilertoaster Posted April 13, 2009 Posted April 13, 2009 Are you talking about dynamic label text in general? eg- expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> global $conf, $t ;~ $t = "text1" ;if $conf = 0 Then ; _check(0) ;endif func _check ($lab) if $lab = 1 then $t = "text1" MsgBox(0,"",$t) GUICtrlSetData ($Label2,$t) return $t elseIf $lab = 2 then $t = "text2" MsgBox(0,"",$t) GUICtrlSetData ($Label2,$t) return $t else $t = "text-no" MsgBox(0,"",$t) GUICtrlSetData ($Label2,$t) return $t endif endFunc ; the example of how it must work but without changing form code... Without overlay ; hot-changing data on-the-fly: if pressed radio 1, $value = "x", if pressed radio 2 - "y" ; and the form-window displays the data of $value #cs func _contr ($lab) if $lab = 1 then $Label2 = GUICtrlCreateLabel("text1", 40, 80, 40, 40) GUICtrlSetFont(-1, 10, 600, 0, "MS Sans Serif") return $t ElseIf $lab = 2 then $Label2 = GUICtrlCreateLabel("text2", 40, 80, 40, 40) GUICtrlSetFont(-1, 10, 600, 0, "MS Sans Serif") return $t else $Label2 = GUICtrlCreateLabel("text0", 40, 80, 40, 40) GUICtrlSetFont(-1, 10, 600, 0, "MS Sans Serif") return $t endif EndFunc #ce #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 116, 100, 193, 125) $Radio1 = GUICtrlCreateRadio("conf1", 0, 8, 113, 17) GUICtrlSetState(-1, $GUI_CHECKED) $Radio2 = GUICtrlCreateRadio("conf2", 0, 24, 113, 17) $Label2 = GUICtrlCreateLabel($t, 40, 80, 50, 40) GUICtrlSetFont(-1, 10, 600, 0, "MS Sans Serif") GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Radio1 _check(1) ;~ MsgBox(0,"","Radio1") Case $Radio2 _check(2) ;~ MsgBox(0,"","Radio2") EndSwitch WEnd that's just using GUICtrlSetData ()...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now