Jump to content

Displaying updated variables in the GUI


faldo
 Share

Recommended Posts

Is there a way to retrace the GUI with new information from updated variables?

For example, i need to read a value in an ini file and display it in realytime:

#include <GUIConstants.au3>

$var = IniRead("C:\Temp\myfile.ini", "section2", "key", "NotFound")

GUICreate("My GUI", -1, -1, -1, -1, -1 )
GUICtrlCreateLabel ($var, 20,50)
GUISetState ()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Once i change the value in the ini file i want my GUI to pick it up and display it. Is this possible?

Link to comment
Share on other sites

Hi,

you have to read it again and then GuiCtrlSetData() on the label.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hi,

try this:

#include <GUIConstants.au3>

$var = IniRead("C:\Temp\mega.ini", "Mega", "1", "NotFound")

GUICreate("My GUI", 150, 100, 5, 5)
$read_B = GUICtrlCreateButton("Read again", 10, 10, 100, 30)
$var_L = GUICtrlCreateLabel ($var, 10, 50, 100, 20, $SS_SUNKEN)
GUISetState ()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    Select
        case $msg = $GUI_EVENT_CLOSE 
            ExitLoop
        case $msg = $read_B
            GUICtrlSetData($var_L, IniRead("C:\Temp\mega.ini", "Mega", "1", "NotFound"))
    EndSelect
Wend

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...