Jump to content

_GUICtrlEdit_SetSel() does not work in Beta v3.3.15.3.


patshi
 Share

Recommended Posts

Sadly the UDF function _GUICtrlEdit_SetSel() does not work in Beta v3.3.15.3.

It was still working in Beta v3.3.15.1

It seems to be not the UDF, but the compiler produces this bug.

Any chance to get a quick fix of this function to work again?

Thanks,

Patrick.

 

Edited by patshi
Link to comment
Share on other sites

  • Developers
17 minutes ago, patshi said:

does not work

Meaning ??????

17 minutes ago, patshi said:

Any chance to get a quick fix of this function to work again?

What about you tell us what isn't working ? ;) 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

1 hour ago, Jos said:

Meaning ??????

What about you tell us what isn't working ? ;) 

The function just does not select the text in the edit box. The main purpose of the function. The editbox just blinks very briefly as it would select all text and then deselects it again.

 

Link to comment
Share on other sites

  • Developers

Show us an script that demonstrates the issue please.

Jos

ps: This will be split off into a thread in the support forum soon.

 

 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

4 minutes ago, Jos said:

Show us an script that demonstrates the issue please.

Jos

ps: This will be split off into a thread in the support forum soon.

 

 

 

#Include <GuiEdit.au3>
#Include <GUIConstantsEx.au3>

$gGUI = GUICreate("Test")
$but = GUICtrlCreateButton("Select Text", 0, 0, 60, 20)
$edit = GUICtrlCreateEdit("Some Text Is Here", 0, 30, 640, 200)
GUISetState()

While 1
    $guiM = GUIGetMsg()
    Switch $guiM
        Case $GUI_EVENT_CLOSE
            Exit
        Case $but
            _GUICtrlEdit_SetSel($edit, 5, 6)
    EndSwitch
WEnd

 

This is the example. Works with v3.3.15.1 but not with v3.3.15.2 and v3.3.15.3

 

Thanks for any help on this.

Link to comment
Share on other sites

  • Moderators

patshi,

Same here - what OS are you running?

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

18 hours ago, Melba23 said:

patshi,

Same here - what OS are you running?

M23

Tested it right now with a clean install on a Win10 machine. Same result. Works with v3.3.15.1-BETA but not with v3.3.15.3-BETA, so still not solved.
Is there anything I could look up what this could cause?

 

EDIT:
i also tried to focus the editbox first, but no luck.

#Include <GuiEdit.au3>
#Include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Dim $gGUI = GUICreate(@AutoItVersion, 640, 200)
Dim $but = GUICtrlCreateButton("Select Text", 5, 5, 60, 20)
Dim $edit = GUICtrlCreateEdit("", 0, 30, 640, 120)

GUISetState()

_GUICtrlEdit_AppendText($edit, "df sdfg sdfg fdg s dfg sdfg")

Sleep(3000)

While 1
    $guiM = GUIGetMsg()
    Switch $guiM
        Case $GUI_EVENT_CLOSE
            Exit
        Case $but
            GUICtrlSetState($edit, $GUI_FOCUS)
            _GUICtrlEdit_SetSel($edit, 5, 10)
    EndSwitch
WEnd

 

Edited by patshi
Link to comment
Share on other sites

  • Moderators

patshi,

Quote

Is there anything I could look up what this could cause?

As it works for the 2 responders to this thread I do not see how we can offer any more suggestions, sorry.

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

  • Developers

When running the OP's script with PROD (3.3.14.5) it works fine, but with BETA (3.3.15.3) nothing happens.
Will try to do some debugging to see what is happening.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

22 hours ago, Nine said:

Set focus to the edit box before setting the selection :

ControlFocus ($gGUI, "", $edit)
_GUICtrlEdit_SetSel($edit, 5, 6)

 

Ok, somehow, magically this works now also with v3.3.15.3  🤩

Thanks all.

The final Script:

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

Example()

Func Example()
    Local $hGUI = GUICreate(@AutoItVersion, 400, 300)
    Local $idEdit = GUICtrlCreateEdit("", 2, 2+20, 394, 268-20)
    Local $but = GUICtrlCreateButton("ok", 2, 2, 60, 20)
    GUISetState(@SW_SHOW)

    _GUICtrlEdit_SetText($idEdit, "Hsdf asdf ksdfhg jsdfghjsdf gdsd")
    
    While 1
        $msg = GUIGetMsg()
        Switch $msg
            Case $GUI_EVENT_CLOSE
                Exit
            Case $but
                ControlFocus($hGUI, "", $idEdit)
                _GUICtrlEdit_SetSel($idEdit, 5, 15)
        EndSwitch
    WEnd
EndFunc   ;==>Example

 

Edited by patshi
Link to comment
Share on other sites

  • Developers
25 minutes ago, Jos said:

When running the OP's script with PROD (3.3.14.5) it works fine, but with BETA (3.3.15.3) nothing happens.
Will try to do some debugging to see what is happening.

Jos

Changing :

GUICtrlSetState($edit, $GUI_FOCUS)

to :

ControlFocus($hGUI, "", $Edit)

Fixes the issue in the original script. 
Does anybody know why we need to set the focus as I would have thought the Windows Message was send to the control without the requirement for giving it the focus? ..... I haven't look under the hood as yet...

Edited by Jos
typo

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Specifying $ES_NOHIDESEL works.

Maybe there was something changed in how edit controls are generated?

 

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

Example()

Func Example()
    Local $hGUI = GUICreate(@AutoItVersion, 400, 300)
    Local $idEdit = GUICtrlCreateEdit("", 2, 2+20, 394, 268-20, $ES_NOHIDESEL)
    Local $but = GUICtrlCreateButton("ok", 2, 2, 60, 20)
    GUISetState(@SW_SHOW)

    _GUICtrlEdit_SetText($idEdit, "Hsdf asdf ksdfhg jsdfghjsdf gdsd")

    While 1
        $msg = GUIGetMsg()
        Switch $msg
            Case $GUI_EVENT_CLOSE
                Exit
            Case $but
                _GUICtrlEdit_SetSel($idEdit, 5, 15)
        EndSwitch
    WEnd
EndFunc   ;==>Example

 

Edited by funkey

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
Share on other sites

  • Developers
15 minutes ago, funkey said:

Maybe there was something changed in how edit controls are generated?

Good find on how to properly fix it, but strangely the default attributes for the Edit Control haven't changed since 2006, so still lost where the difference is between PROD/BETA 1&2 and BETA 3. There has to be a change there that causes this or maybe we need to set that the defaults for the edit control to include $ES_NOHIDESEL.

I leave it to the folks that build/messed with these function internally to check it.

Jos

 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

1 hour ago, funkey said:

Specifying $ES_NOHIDESEL works.

Maybe there was something changed in how edit controls are generated?

 

funkey: i tried if with the below combinations (because I have them in a script like that)  and again, does not work - only with prior focus set to the edit.

BitOR($ES_WANTRETURN, $WS_VSCROLL, $ES_AUTOVSCROLL, $ES_NOHIDESEL, $ES_READONLY)

BitOR($ES_WANTRETURN, $WS_VSCROLL, $ES_AUTOVSCROLL, $ES_NOHIDESEL)

 

Link to comment
Share on other sites

OK, I found something strange:

When there ist a   GUICtrlSetState($eNote, $GUI_FOCUS)  before the   _GUICtrlEdit_SetSel(....  this effect happens - even with $ES_NOHIDESEL defined.

There's something fishy with that focus stuff.

 

Link to comment
Share on other sites

Not sure it is a good idea to have $ES_NOHIDESEL as default to edit box.  Look what is happening if you set the text at control creation :

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

Example()

Func Example()
  Local $hGUI = GUICreate(@AutoItVersion, 400, 300)
  Local $idEdit = GUICtrlCreateEdit("This is a test", 2, 2 + 20, 394, 268 - 20, $ES_NOHIDESEL)
  Local $but = GUICtrlCreateButton("ok", 2, 2, 60, 20)
  GUISetState(@SW_SHOW)

  While 1
    $msg = GUIGetMsg()
    Switch $msg
      Case $GUI_EVENT_CLOSE
        Exit
      Case $but
        _GUICtrlEdit_SetSel($idEdit, 5, 15)
    EndSwitch
  WEnd
EndFunc   ;==>Example

I don't like much the edit box being selected by default...

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