Sign in to follow this  
Followers 0
zeffy

Using GUICtrlSetData on edit box highlights the text

3 posts in this topic

Whenever I use GUICtrlSetData on a text box, the text always gets highlighted, no matter what I do. The only way I have figured out how to fix it is to send a ControlClick() to the edit box, but I want a more reliable way to do it. Here is a scenario script:

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

GUICreate("ChangeLog", 625, 443, Default, Default, BitOR($WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_BORDER, $WS_CLIPSIBLINGS))
GUICtrlCreateEdit("", 0, 0, 625, 443, BitOR($ES_AUTOVSCROLL, $ES_READONLY, $ES_WANTRETURN, $WS_VSCROLL))
GUICtrlSetData(-1, BinaryToString(InetRead("http://www.autoitscript.com/autoit3/files/beta/update.dat")))
GUICtrlSetFont(-1, 10, 400, 0, "Consolas")
GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
GUISetState()

Do

Until GUIGetMsg() = $GUI_EVENT_CLOSE

Share this post


Link to post
Share on other sites



First show the Gui and then update the edit control ;)

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


GUICreate("ChangeLog", 625, 443);, Default, Default, BitOR($WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_BORDER, $WS_CLIPSIBLINGS))
$hEdit = GUICtrlCreateEdit("", 0, 0, 625, 443);, BitOR($ES_AUTOVSCROLL, $ES_READONLY, $ES_WANTRETURN, $WS_VSCROLL))
GUICtrlSetFont(-1, 10, 400, 0, "Consolas")
GUICtrlSetResizing(-1, $GUI_DOCKAUTO)

GUISetState()

GUICtrlSetData(-1, "This is some text!")

Do
 Sleep(20)
Until GUIGetMsg() = $GUI_EVENT_CLOSE

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.

Share this post


Link to post
Share on other sites

Haha, wow I can't believe I didn't think of that. 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