Jump to content

Need slider and input help


E1M1
 Share

Recommended Posts

How I can edit Slider's value by editing input1? I want also update input 1 value in real time while I move slider 1. But if I click on input 1 I cant type new value there.

How can I stop input1 updating while I am typing in input1? and if i click on slider 1 i want start updating input1 again.

$Form1 = GUICreate("Settings", 316, 333, 192, 124)
        $Slider1 = GUICtrlCreateSlider(16, 248, 286, 45,BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS))
        GUICtrlSetLimit(-1, 1000, 0)
        GUICtrlSetData(-1,10)
        $input1 = GUICtrlCreateInput(10, 88, 216, 49, 21)
        GUISetState(@SW_SHOW)

        While 1
            $nMsg = GUIGetMsg()
            GUICtrlSetData($input1,GUICtrlRead($Slider1))
            Switch $nMsg
                Case $GUI_EVENT_CLOSE
                    GUIDelete()
                    ExitLoop
                Case $input1
                    $active = 1
                    Exit
            EndSwitch
        WEnd
Edited by E1M1

edited

Link to comment
Share on other sites

  • Moderators

E1M1,

This should do what you asked for. Press {Enter} when you have edited the Input:

#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <Misc.au3>
#include <WinAPI.au3>

$Form1 = GUICreate("Settings", 316, 333, 192, 124)
$Slider1 = GUICtrlCreateSlider(16, 248, 286, 45, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS))
GUICtrlSetLimit(-1, 1000, 0)
GUICtrlSetData(-1, 10)
$input1 = GUICtrlCreateInput(10, 88, 216, 49, 21)
$hButton = GUICtrlCreateButton("", -10, 10, 1, 1)
GUICtrlSetState(-1, $GUI_FOCUS)
GUISetState(@SW_SHOW)

While 1

    If _WinAPI_GetFocus() = ControlGetHandle($Form1, "", $input1) Then
        _Manual()
    Else
        GUICtrlSetData($input1, GUICtrlRead($Slider1))
    EndIf

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd


Func _Manual()

    $dll = DllOpen("user32.dll")
    Do
        Sleep(10)
    Until _IsPressed("0D", $dll)
    DllClose($dll)
    ConsoleWrite("Here 3" & @CRLF)
    GUICtrlSetData($Slider1, GUICtrlRead($input1))
    GUICtrlSetState($hButton, $GUI_FOCUS)

EndFunc

M23

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

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

E1M1,

You want fries with that? :)

Func _Manual()

    GUICtrlSetData($Slider1, GUICtrlRead($input1))

EndFunc

M23

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

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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...