Jump to content
kaufpark

Output Text in the GUI

Recommended Posts

kaufpark

Hi AutoIt Community,

I am new and hope that you have a tip for my simple question. I'm trying out Koda and looking for a way to output text. I found an input box - but is there an output box that can be built into the GUI? So almost like the MsgBox or ToolBox but just firmly integrated in the GUI?

 

Thx, Kauf

Share this post


Link to post
Share on other sites
JLogan3o13

Welcome to the forum. Look at GUICtrlCreateEdit in the help file. Look at the Styles to see how you would make it read only


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
aa2zz6

Is this supposed to be some type of log sheet built inside the GUI as your script is running?

Share this post


Link to post
Share on other sites
kaufpark

 

I mean it a little differently. I measure the temperature every 10 secounds via USB-RS232-microcontroller etc. That works so far. Now I have created a GUI with KODA and in this GUI I want to display this temperature as text. That's why I wanted to know if anyone knows how to incorporate some kind of "output field" into the GUI. The "input field" in the coda menu I have found but no output field.

Share this post


Link to post
Share on other sites
Simpel

Hi.

You can simply use GUICtrlCreateLabel.

Regards, Conrad


SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win7Pro SP1   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Share this post


Link to post
Share on other sites
kaufpark
The solution is always simple, you just have to find it.

 

Thanks!

Share this post


Link to post
Share on other sites
JLogan3o13

It might help us help you find it if you actually posted code rather than having us guess ;)

 


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
aa2zz6

So when the temp changes you want it to display inside the GUI? Maybe BrewManNH has your solution in this thread? He uses a label as a display for the counter. I assume you would want the label to display the temperature every 10 seconds?

 

GUICtrlSetData($lbl01, $seconds)

       

#include <GUIConstantsEx.au3>
$seconds = 0
$gui = GUICreate("Test", 360, 333)
$btn01=GUICtrlCreateButton("START",15,15)
GUISetFont(222 )
$lbl01 = GUICtrlCreateLabel("", 25, 53, 330, 300)
GUISetState()
Global $cnt=0, $swh=0
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $btn01
            $cnt +=1
            $swh=mod($cnt,2)
            $tBegin01 = TimerInit()
        EndSwitch
    If $swh=1 and TimerDiff($tBegin01) > 999 Then
        $seconds +=1
        GUICtrlSetData($lbl01, $seconds)
        $tBegin01 = TimerInit()
    EndIf
WEnd

 

Share this post


Link to post
Share on other sites
kylomas

kaufpark,

A small example of using timers for the time of day and a 10 second countdown...

#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <timers.au3>

#AutoIt3Wrapper_Add_Constants=n

Local $gui010 = GUICreate('WM_Timer Example',310,70)

GUICtrlCreateLabel('Time of Day', 10, 10, 100, 20)
Local $TOD = GUICtrlCreateLabel('', 10, 30, 100, 20, BitOR($ss_center, $ss_sunken, $ss_centerimage))
GUICtrlCreateLabel('10 second Count', 200, 10, 100, 20)
Local $10sec = GUICtrlCreateLabel('10', 200, 30, 100, 20, BitOR($ss_sunken, $ss_center, $ss_centerimage))

Local $dummy_TOD = GUICtrlCreateDummy()
Local $dummy_10sec = GUICtrlCreateDummy()

GUISetState()

GUIRegisterMsg($wm_timer, 'WM_TIMER')

Local $tod_timer = _Timer_SetTimer($gui010, 500, '', -1)
Local $10sec_timer = _Timer_SetTimer($gui010, 1000, '', -1)

While 1

    Switch GUIGetMsg()
        Case $gui_event_close
            Exit
        Case $dummy_TOD
            GUICtrlSetData($TOD, StringFormat('%02i:%02i:%02i', @HOUR, @MIN, @SEC))
        Case $dummy_10sec
            If GUICtrlRead($10sec) = 0 Then
                GUICtrlSetBkColor($10sec, 0xffffffff)
                GUICtrlSetData($10sec, 10)
                ContinueLoop
            EndIf
            GUICtrlSetData($10sec, GUICtrlRead($10sec) - 1)
            If GUICtrlRead($10sec) = 0 Then GUICtrlSetBkColor($10sec, 0xff0000)
    EndSwitch

WEnd

Func WM_TIMER($hWnd, $iMsg, $iwParam, $ilParam)

    Switch $iwParam

        Case $tod_timer
            GUICtrlSendToDummy($dummy_TOD)
        Case $10sec_timer
            GUICtrlSendToDummy($dummy_10sec)
    EndSwitch

    Return $GUI_RUNDEFMSG

EndFunc   ;==>WM_TIMER

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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

×