Sign in to follow this  
Followers 0
P0ZiTR0N

Could it be realisable?

4 posts in this topic

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 :D

#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

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
Share on other sites

Are you talking about dynamic label text in general?

eg-

#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 ()...

Share this post


Link to post
Share on other sites

ok.. I'll try it. thanx

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