Jump to content
Sign in to follow this  
Heretic

Update text in Input box

Recommended Posts

Heretic

Hello, I have been unable to figure this one out..  I would like the numbers displayed in the $Input boxes to change as the slider is moved.  Which command should I be using to accomplish this? I'm still kinda new to the language..   Thanks in advance

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 330, 146, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1Maximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "Form1Restore")
$Group2 = GUICtrlCreateGroup("Slider 1", 8, 72, 193, 65)
$Slider2 = GUICtrlCreateSlider(24, 96, 134, 29)
GUICtrlSetLimit(-1, 5, 1)
GUICtrlSetData(-1, 1)
GUICtrlSetOnEvent(-1, "Slider2Change")
$Input2 = GUICtrlCreateInput("1", 160, 96, 33, 21)
GUICtrlSetOnEvent(-1, "Input2Change")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group1 = GUICtrlCreateGroup("Slider 2", 8, 8, 313, 65)
$Slider1 = GUICtrlCreateSlider(24, 32, 254, 29)
GUICtrlSetLimit(-1, 150, 0)
GUICtrlSetData(-1, 1)
GUICtrlSetOnEvent(-1, "Slider1Change")
$Input1 = GUICtrlCreateInput("1", 280, 32, 33, 21)
GUICtrlSetOnEvent(-1, "Input1Change")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("Apply", 208, 80, 107, 57)
GUICtrlSetOnEvent(-1, "Button1Click")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    Sleep(100)
WEnd






Func Button1Click()

EndFunc





Func Form1Close()
exit
EndFunc





Func Input1Change()

EndFunc





Func Input2Change()

EndFunc





Func Slider1Change()
Global $Slide = GUICtrlRead($Slider1)

EndFunc





Func Slider2Change()
Global $Slide2 = GUICtrlRead($Slider2)
EndFunc

Share this post


Link to post
Share on other sites
mrflibblehat

Try This

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 330, 146, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
;GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize")
;GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1Maximize")
;GUISetOnEvent($GUI_EVENT_RESTORE, "Form1Restore")
$Group2 = GUICtrlCreateGroup("Slider 1", 8, 72, 193, 65)
$Slider2 = GUICtrlCreateSlider(24, 96, 134, 29)
GUICtrlSetLimit(-1, 5, 1)
GUICtrlSetData(-1, 1)
GUICtrlSetOnEvent(-1, "Slider2Change")
$Input2 = GUICtrlCreateInput("1", 160, 96, 33, 21)
GUICtrlSetOnEvent(-1, "Input2Change")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group1 = GUICtrlCreateGroup("Slider 2", 8, 8, 313, 65)
$Slider1 = GUICtrlCreateSlider(24, 32, 254, 29)
GUICtrlSetLimit(-1, 150, 0)
GUICtrlSetData(-1, 1)
GUICtrlSetOnEvent(-1, "Slider1Change")
$Input1 = GUICtrlCreateInput("1", 280, 32, 33, 21)
GUICtrlSetOnEvent(-1, "Input1Change")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("Apply", 208, 80, 107, 57)
GUICtrlSetOnEvent(-1, "Button1Click")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    Sleep(100)
    GUICtrlSetData($Input1, GUICtrlRead($slider1))
    GUICtrlSetData($Input2, GUICtrlRead($slider2))
WEnd

Func Button1Click()

EndFunc

Func Form1Close()
exit
EndFunc

Func Input1Change()

EndFunc

Func Input2Change()

EndFunc

Func Slider1Change()
Global $Slide = GUICtrlRead($Slider1)

EndFunc

Func Slider2Change()
Global $Slide2 = GUICtrlRead($Slider2)
EndFunc

Added the lines in the while loop

GUICtrlSetData($Input1, GUICtrlRead($slider1))
GUICtrlSetData($Input2, GUICtrlRead($slider2))

[font="'courier new', courier, monospace;"]Pastebin UDF | Prowl UDF[/font]

Share this post


Link to post
Share on other sites
BrewManNH

Here is how I would handle it.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 330, 146, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Group2 = GUICtrlCreateGroup("Slider 1", 8, 72, 193, 65)
$Slider2 = GUICtrlCreateSlider(24, 96, 134, 29)
GUICtrlSetLimit(-1, 5, 1)
GUICtrlSetData(-1, 1)
$Input2 = GUICtrlCreateInput("1", 160, 96, 33, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group1 = GUICtrlCreateGroup("Slider 2", 8, 8, 313, 65)
$Slider1 = GUICtrlCreateSlider(24, 32, 254, 29)
GUICtrlSetLimit(-1, 150, 0)
GUICtrlSetData(-1, 1)
$Input1 = GUICtrlCreateInput("1", 280, 32, 33, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("Apply", 208, 80, 107, 57)
GUICtrlSetOnEvent(-1, "Button1Click")
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
Global $Slide2, $Slide, $LastSlide2 = 0, $LastSlide = 0

While 1
    $Slide2 = GUICtrlRead($Slider2)
    $Slide = GUICtrlRead($Slider1)
    If $LastSlide <> $Slide Then
        GUICtrlSetData($Input1, $Slide)
        $LastSlide = $Slide
    EndIf
    If $LastSlide2 <> $Slide2 Then
        GUICtrlSetData($Input2, $Slide2)
        $LastSlide2 = $Slide2
    EndIf
    Sleep(100)
WEnd
Func Form1Close()
    Exit
EndFunc   ;==>Form1Close

Func Button1Click()
EndFunc   ;==>Button1Click

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
Heretic

Beautiful, they both work !   Thank you both for the answers :bye: Now I can continue

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  

×