Sign in to follow this  
Followers 0
seanm

Edit window highlighting text when restored

3 posts in this topic

Hi. Trying to create a window to display some text. I went with an Edit GUI, setting it to read-only.

I display it, minimize it, and later restore it. When I restore it, all of the text in the GUI is highlighted. I would rather it wasn't highlighted. At the very least, I can send a mouse click to the center of the screen (MouseClick("left", @DesktopWidth/2, @DesktopHeight/2, 1, 1), but I'd like to fix this instead of band-aiding it.

Here's some sample code. Thanks.

#include <GUIConstants.au3> ;GUI creation library

#include <GuiEdit.au3> ;GUI edit library

AutoItSetOption("MustDeclareVars", 0)

$result1="Some text....."

GUICreate("Test Results:",640,400,-1,-1,$WS_OVERLAPPEDWINDOW)

GUISetFont (8.5, 400, -1, "Courier")

$myedit=GUICtrlCreateEdit ($result1, 0,0,640,400,$WS_VSCROLL+$WS_HSCROLL+$ES_READONLY)

GUISetState ()

GUICtrlSetData($myedit, $result1) ;Update the result text GUI

WinSetState("Test Results:", "", @SW_RESTORE) ;Un-Minimize the Test Results window

WinActive("Test Results:") ;Make the Test Results window the active one

_GUICtrlEditScroll($myedit, $SB_SCROLLCARET) ;Scroll down the result text GUI

Sleep(5000)

WinSetState("Test Results:", "", @SW_MINIMIZE) ;Minimize the Test Results window

WinSetState("Test Results:", "", @SW_RESTORE) ;Un-Minimize the Test Results window

Sleep(10000)

;;;;;;; MouseClick("left", @DesktopWidth/2, @DesktopHeight/2, 1, 1)

Share this post


Link to post
Share on other sites



Might try adding a default button.

For example:

#include <GUIConstants.au3> ;GUI creation library
#include <GuiEdit.au3> ;GUI edit library

AutoItSetOption("MustDeclareVars", 0)

$result1="Some text....."
GUICreate("Test Results:",640,440,-1,-1,$WS_OVERLAPPEDWINDOW)
GUISetFont (8.5, 400, -1, "Courier")
$myedit=GUICtrlCreateEdit ($result1, 0,0,640,400,$WS_VSCROLL+$WS_HSCROLL+$ES_READONLY)
$mybutton = GUICtrlCreateButton("Default", 10, 410, 90, 25)
GUICtrlSetState($mybutton, $GUI_DEFBUTTON)
GUISetState ()

GUICtrlSetData($myedit, $result1) ;Update the result text GUI
WinSetState("Test Results:", "", @SW_RESTORE) ;Un-Minimize the Test Results window
WinActive("Test Results:") ;Make the Test Results window the active one
_GUICtrlEditScroll($myedit, $SB_SCROLLCARET) ;Scroll down the result text GUI
Sleep(5000)
WinSetState("Test Results:", "", @SW_MINIMIZE) ;Minimize the Test Results window

WinSetState("Test Results:", "", @SW_RESTORE) ;Un-Minimize the Test Results window
Sleep(10000)

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

That works. Thanks.

Share this post


Link to post
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
Sign in to follow this  
Followers 0