Jump to content

GUICtrlCreateEdit problem


ASut
 Share

Recommended Posts

I find that "Ctrl + A" can't work in the GUICtrlCreateEdit, every time when I need to copy all the text inside the GUICtrlCreateEdit, I need to right clik the mouse and then select "Select All",How to make Ctrl + A work in the GUICtrlCreateEdit?

Link to comment
Share on other sites

  • Moderators

ASut,

This will work if you do not keep the A key pressed long enough to start the typematic repeat: ;)

#include <GUIConstantsEx.au3>
#include <GUIEdit.au3>
#include <WinAPI.au3>

Global $hInput_Handle

HotKeySet("^a", "_SelAll")

$hGUI = GUICreate("Test", 500, 500)

$hInput = GUICtrlCreateEdit("here is some text", 10, 10, 480, 480)
$hInput_Handle = GUICtrlGetHandle(-1)

$hSelAll = GUICtrlCreateDummy()

GUISetState()

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

Func _SelAll()

    Switch _WinAPI_GetFocus()
        Case $hInput_Handle
            _GUICtrlEdit_SetSel($hInput_Handle, 0, -1)
            Return
    EndSwitch

EndFunc   ;==>_SelAll

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

Thanks, I have tried all 2 methods, for Send("^{A}") I don't know how to make it works, for M23 's method, How can it work for 2 or more GUICtrlCreateEdit?

Ctrl+C

;)

Or try this function I made a while ago.

INPUTBOX("Copy All","Edit Strings Below"&@CRLF&@CRLF&"Note: Ctrl+C = Copy",GUICTRLREAD($YourEditControlVarName))

Edited by Kalin
Link to comment
Share on other sites

  • Moderators

ASut,

for M23 's method, How can it work for 2 or more GUICtrlCreateEdit?

Just test for the different handles - like this: ;)

#include <GUIConstantsEx.au3>
#include <GUIEdit.au3>
#include <WinAPI.au3>

Global $hInput_Handle

HotKeySet("^a", "_SelAll")

$hGUI = GUICreate("Test", 500, 500)

$hInput_1 = GUICtrlCreateEdit("here is some text", 10, 10, 230, 480)
$hInput_1_Handle = GUICtrlGetHandle(-1)
$hInput_2 = GUICtrlCreateEdit("here is some text", 260, 10, 230, 480)
$hInput_2_Handle = GUICtrlGetHandle(-1)

$hSelAll = GUICtrlCreateDummy()

GUISetState()

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

Func _SelAll()

    Switch _WinAPI_GetFocus()
        Case $hInput_1_Handle
            _GUICtrlEdit_SetSel($hInput_1_Handle, 0, -1)
        Case $hInput_2_Handle
            _GUICtrlEdit_SetSel($hInput_2_Handle, 0, -1)
    EndSwitch

EndFunc   ;==>_SelAll

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

ASut,

That is why I am here. Glad I could help. ;)

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

Kalin,

Try increasing the medication - or stopping it altogether if you prefer. ;)

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

ASut,

That is why I am here. Glad I could help. ;)

M23

I'm certainly glad you answered that question.

Oooops, I quoted the reply and I'm sooooooooo sorry (NOT). I can show you boards where you would get fried for not quoting at least part of the post you are replying to.

Yes big M, I'm in an ugly mood and it was that lucky day where your name came out of the hat.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

  • Moderators

George,

Perhaps you need a new dosage (or is that dotage? ;) ) prescription as well! :)

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

Kalin,

If you cannot take banter - then do not start it. ;)

"click"

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

Mat,

CLICK!!!!!

Better? ;)

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

ASut,

If we use an accelerator instead of a HotKey, we can get over that problem: :)

#include <GUIConstantsEx.au3>
#include <GUIEdit.au3>
#include <WinAPI.au3>

$hGUI = GUICreate("Test", 500, 500)

$hInput_1 = GUICtrlCreateEdit("here is some text", 10, 10, 230, 480)
$hInput_1_Handle = GUICtrlGetHandle(-1)
$hInput_2 = GUICtrlCreateEdit("here is some text", 260, 10, 230, 480)
$hInput_2_Handle = GUICtrlGetHandle(-1)

$hSelAll = GUICtrlCreateDummy()

GUISetState()
; Set accelerator for Ctrl+a
Global $aAccelKeys[1][2]=[["^a", $hSelAll]]
GUISetAccelerators($aAccelKeys)

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hSelAll
            _SelAll()
    EndSwitch

WEnd

Func _SelAll()

    Switch _WinAPI_GetFocus()
        Case $hInput_1_Handle
            _GUICtrlEdit_SetSel($hInput_1_Handle, 0, -1)
        Case $hInput_2_Handle
            _GUICtrlEdit_SetSel($hInput_2_Handle, 0, -1)
    EndSwitch

EndFunc   ;==>_SelAll

Better? ;)

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