Jump to content

[SOLVED] GUICtrlCreateEdit() - Question...


Recommended Posts

Hello,

Anyone could tell me how can I make for a GUICtrlCreateEdit() be enabled only when I click the mouse over him, and when I click out it disable?

Edited by jscript

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

#Include <Misc.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
$gui = GUICreate("My GUI edit")  ; will create a dialog box that when displayed is centered
$myedit = GUICtrlCreateEdit("First line" & @CRLF, 176, 32, 121, 97, $ES_AUTOVSCROLL + $WS_VSCROLL)
GUISetState()
$state = 0
GUICtrlSetState($myedit,$GUI_DISABLE)
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    If _IsPressed("01") Then
        $over = GUIGetCursorInfo ( $gui )
        If $over[4] = $myedit Then
            If Not $state Then
                $state = 1
                GUICtrlSetState($myedit,$GUI_ENABLE)
            EndIf
        Else
            If $state Then 
                $state = 0
                GUICtrlSetState($myedit,$GUI_DISABLE)
            EndIf
        EndIf
        Do
            Sleep(10)
        Until Not _IsPressed("01")
    EndIf
    Sleep(10)
WEnd

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

that was example, this isnt copy paste site :)

That can b solved with one or two "If" if you know how :)

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

that was example, this isnt copy paste site :)

That can b solved with one or two "If" if you know how :)

Their example was very useful, a few changes after I came to this conclusion:

#include <Misc.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>

Global $hGUI, $hEdit

$hGUI = GUICreate("My GUI edit")
$hEdit = GUICtrlCreateEdit("", 117, 37, 206, 89, BitOR($ES_AUTOVSCROLL, $ES_MULTILINE, $ES_WANTRETURN, $WS_VSCROLL))
GUICtrlSetState($hEdit, $GUI_DISABLE)
GUISetState()

_GuiLoop()

Func _GuiLoop()
    Local Static $IsEnable = 0

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop

            Case $GUI_EVENT_PRIMARYDOWN
                Local $aIsOver = GUIGetCursorInfo($hGUI)
                If $aIsOver[4] = $hEdit Then
                    If Not $IsEnable Then
                        $IsEnable = 1
                        GUICtrlSetState($hEdit, $GUI_ENABLE)
                        GUICtrlSetState($hEdit, $GUI_FOCUS)
                    EndIf
                Else
                    If $IsEnable Then
                        $IsEnable = 0
                        GUICtrlSetState($hEdit, $GUI_DISABLE)
                    EndIf
                EndIf
        EndSwitch
    WEnd
EndFunc   ;==>_GuiLoop

No need use the functions: _IsPressed() or Sleep.

I thank you!

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

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