Jump to content

Printing out info to GUICtrlCreateEdit


Recommended Posts

Here's my code so far:

 

Global $getEditGui = GUICtrlSetData(-1, "test")

This initializes the GUI and sets the "test" string.

Later on in the script, I use this code to record my mouse position. My goal is to print out the contents of $getCoords into the GUI without it executing it. Also, I want to make sure I can do this as many times as I want without it erasing the previous edits. My current code just prints "1" in the GUI and executes the contents of $getCoords

Func getCords()
   Opt("MouseCoordMode", 2)
   WinActivate("Calculator")
   sleep(3000)
   $MousePos = MouseGetPos()
   $MousePos[0] ; Mouse X position
   $MousePos[1] ; Mouse Y position
      $getCoords = MouseClick("Left", $MousePos[0], $MousePos[1])
      $getEditGui = GUICtrlSetData(-1, $getCoords)
EndFunc

 

Link to comment
Share on other sites

How about something like this.

$Edit = GUICtrlCreateEdit("", 176, 32, 121, 97, BitOr($GUI_SS_DEFAULT_EDIT, $ES_READONLY))

; some code here..

$getEditGui = GUICtrlSetData($Edit, $getCoords)

BTW, can you post the working code so we can see what went wrong.

Edited by KickStarter15

Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.

Link to comment
Share on other sites

@Subz
@KickStarter15

Not if you set the last parameter of GUICtrlSetData() to "non-empty"...
From the Help file:

default [optional]
Combo, List: The default value.
Edit, Input: If non-empty (""), the string is inserted at the current insertion point (caret).

And, this thing is showed in the GUICtrlCreateEdit() in the Help file:

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

Example()

Func Example()
    GUICreate("My GUI edit") ; will create a dialog box that when displayed is centered

    Local $idMyedit = GUICtrlCreateEdit("First line" & @CRLF, 176, 32, 121, 97, $ES_AUTOVSCROLL + $WS_VSCROLL)

    GUISetState(@SW_SHOW)

    Send("{END}")

    ; will be append dont' forget 3rd parameter
    GUICtrlSetData($idMyedit, "Second line", 1)

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop

        EndSwitch
    WEnd
    GUIDelete()
EndFunc   ;==>Example


Best Regards.

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

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