Jump to content

Is _GUICtrlRichEdit_HideSelection not working?


nobbitry
 Share

Recommended Posts

Hi,

I'm using v3.3.14.2 and have a Problem with _GUICtrlRichEdit_HideSelection. It doesn't seem to work (it doesn't hide the selection).

At the moment I help myself with a ControlSend to hide my previous selection, but I hope that isn't necessary.

 

That's the example from the help.

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

Global $g_idLblMsg, $g_hRichEdit

Example()

Func Example()
    Local $hGui, $iMsg, $idBtnNext, $iStep = 0
    $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, StringLen(".exe")) & ")", 320, 350, -1, -1)
    $g_hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
            BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
    $g_idLblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
    $idBtnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
    GUISetState(@SW_SHOW)

    _GUICtrlRichEdit_SetText($g_hRichEdit, "First paragraph")

    While True
        $iMsg = GUIGetMsg()
        Select
            Case $iMsg = $GUI_EVENT_CLOSE
                _GUICtrlRichEdit_Destroy($g_hRichEdit) ; needed unless script crashes
                ; GUIDelete()   ; is OK too
                Exit
            Case $iMsg = $idBtnNext
                $iStep += 1
                Switch $iStep
                    Case 1
                        _GUICtrlRichEdit_SetSel($g_hRichEdit, 2, 5)
                        Report("Text is selected")
                    Case 2
                        _GUICtrlRichEdit_HideSelection($g_hRichEdit, True)
                        Report("Selection is hidden")
                    Case 3
                        _GUICtrlRichEdit_HideSelection($g_hRichEdit, False)
                        Report("Selection is not hidden")
                        GUICtrlSetState($idBtnNext, $GUI_DISABLE)
                EndSwitch
        EndSelect
    WEnd
EndFunc   ;==>Example

 

Link to comment
Share on other sites

What windows version are you using?

I'm using Win10 Version 1607. And i can't seem to get _GUICtrlRichEdit_HideSelection to work. I'm suspecting it might be windows 10 related

Edit:

never mind, i misunderstood what HideSelction is supposed to do.

Just to be clear what do you expect to happen? because as i read it, it's setting if selection is visible when loosing focus

Edited by genius257
Link to comment
Share on other sites

16 minutes ago, genius257 said:

Just to be clear what do you expect to happen? because as i read it, it's setting if selection is visible when loosing focus

 

Link to comment
Share on other sites

4 minutes ago, nobbitry said:

Ah I got it. Sorry. I thought  _GUICtrlRichEdit_HideSelection($g_hRichEdit, True) would hide the selection in the active window.

Thank you.

Hehe totally understand why you would think that. I was under the same impression, until reading TextBoxBase.HideSelection Property from MSDN.

Edited by genius257
Spell check
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...