Jump to content

Input as title.


Recommended Posts

How about an input box that modifies the title?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
Local $myinput, $msg, $h

$sTitle = "My GUI edit"
$h = GUICreate($sTitle) ; will create a dialog box that when displayed is centered

$myinput = GUICtrlCreateInput ($sTitle,15,15)

GUISetState()

; will be append dont' forget 3rd parameter

; Run the GUI until the dialog is closed

While 1
    $msg = GUIGetMsg()
    If ControlGetText($h,"",$myinput)<>WinGetTitle($h) Then
        WinSetTitle($h,"",ControlGetText($h,"",$myinput))
    EndIf

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
GUIDelete()
Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Think outside of the box

; Johnmcloud - 2015
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$hParent = GUICreate("Johnmcloud", 310, 225)
$hButton = GUICtrlCreateButton("Read input", 25, 25, 70, 30)
GUISetState(@SW_SHOW, $hParent)

$aParent = WinGetPos($hParent)
$hChild = GUICreate("", 75, 25, $aParent[0] + 160, $aParent[1] + 3, $WS_POPUP, $WS_EX_TOOLWINDOW, $hParent)
$hInput = GUICtrlCreateInput("Test code", 0, 0, 75, 25)
GUISetState(@SW_SHOWNOACTIVATE, $hChild)

GUIRegisterMsg($WM_MOVE, "WM_MOVE")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton
            MsgBox(0, "Info", ControlGetText($hChild, "", $hInput))
    EndSwitch
WEnd

Func WM_MOVE($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam, $lParam
    If ($hWnd = $hParent) Then
        $aParent = WinGetPos($hParent)
        WinMove($hChild, "", $aParent[0] + 160, $aParent[1] + 3)
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_MOVE

o9efx0.png

Not perfect because the parent lose the focus when click on the input but give an idea

Edited by johnmcloud
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...