Jump to content

Edit control help needed.


Recommended Posts

I'm creating a log window for my script, using a multiple line & read-only edit box. I use GUICtrlSetData to send the message to the edit box. If any of the text in the edit control is highlighted, it will insert the new text over it. It's as if it isn't completely read-only. I can even manually highlight the text in the edit box with the mouse, send a log entry, and it'll overwrite what I highlighted. That's really the best I can explain it. It's very odd.

The log GUI:

$GUI_Log = GUICreate("Log", 600, 150, -1, 745)
GUISetOnEvent($GUI_EVENT_MINIMIZE, "CheckGUI", $GUI_Log)
GUISetOnEvent($GUI_EVENT_RESTORE, "CheckGUI", $GUI_Log)
GUISetOnEvent($GUI_EVENT_CLOSE, "CheckGUI", $GUI_Log)
$GUI_Log_LogEdit = GUICtrlCreateEdit("", 6, 6, 588, 138, BitOR($ES_MULTILINE, $ES_READONLY, $WS_VSCROLL))
GUISetState(@SW_SHOW, $GUI_Log)oÝ÷ Ù8^ xºw-ÚºÚ"µÍÎÈKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKBÎÈÙÕÜ]BÎÈKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKB[ÈÙÕÜ]J   ÌÍÓYÜØYÙJBIÌÍÕ[YTÝ[H  ][ÝÖÈ    ][ÝÈ  [ÈSÓ  [È ][ÝË][ÝÈ    [ÈQVH  [È ][ÝË][ÝÈ    [ÈQPT  [È ][ÝÈ  ][ÝÈ  [ÈÕT  [È ][ÝÎ][ÝÈ    [ÈRS   [È ][ÝÎ][ÝÈ    [ÈÑPÈ    [È ][ÝÈH ][ÝÂQÕRPÝÙ]]J  ÌÍÑÕRWÓÙ×ÓÙÑY]    ÌÍÕ[YTÝ[    [È ÌÍÓYÜØYÙH [ÈÔYJB[[ÈÏOIÝÓÙÕÜ]oÝ÷ Øz0!Æ¥Ø^~éܶ*'jëh×6LogWrite("Initializing.")

Any help or input is greatly appreciated.

Link to comment
Share on other sites

;; ----------------------------------------
;; LogWrite
;; ----------------------------------------
Func LogWrite($Message)
    If Guictrlread($GUI_Log_LogEdit) = "" Then
    $Gettext = ""
    else
    $Gettext = Guictrlread($GUI_Log_LogEdit) & @CRLF
    Endif
    $TimeStamp = "[ " & @MON & "." & @MDAY & "." & @YEAR & "  " & @HOUR & ":" & @MIN & ":" & @SEC & " ] "
    GUICtrlSetData($GUI_Log_LogEdit, $Gettext & $TimeStamp & $Message)
EndFunc   ;==>LogWrite

Edited by billthecreator

[font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap

Link to comment
Share on other sites

Just use this:

$GUI_Log_LogEdit = GUICtrlCreateEdit("", 6, 6, 588, 138,  BitOR($ES_AUTOVSCROLL, $ES_READONLY, $ES_WANTRETURN))
Edited by billthecreator

[font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap

Link to comment
Share on other sites

Just use this:

$GUI_Log_LogEdit = GUICtrlCreateEdit("", 6, 6, 588, 138,  BitOR($ES_AUTOVSCROLL, $ES_READONLY, $ES_WANTRETURN))
I tried $ES_AUTOVSCROLL and $ES_WANTRETURN styles previously when I last replied, it still doesn't work though.

With that one you gave me, since it doesn't have $WS_VSCROLL, it actually doesn't scroll at all, it just stops at the bottom of the edit box.

Link to comment
Share on other sites

I tried $ES_AUTOVSCROLL and $ES_WANTRETURN styles previously when I last replied, it still doesn't work though.

With that one you gave me, since it doesn't have $WS_VSCROLL, it actually doesn't scroll at all, it just stops at the bottom of the edit box.

did you try them all

[font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap

Link to comment
Share on other sites

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

i have this in my scripts, and they work...

Hmm.. I don't know, I just tried those four styles above right now, and it's still doing it. When the log hits the bottom, it keeps printing logs normally, but it just doesn't scroll automatically so I can see them.
Link to comment
Share on other sites

Here's a test to show you, just keep clicking the minimize/restore/close buttons until you reach past the bottom of the log.

;; ----------------------------------------
;; Includes & Options
;; ----------------------------------------
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
;; ----------------------------------------
;; Log GUI
;; ----------------------------------------
$GUI_Log = GUICreate("AutoOre Log", 600, 150, -1, 745)
$GUI_Log_LogEdit = GUICtrlCreateEdit("", 6, 6, 588, 138, BitOR($ES_AUTOVSCROLL, $ES_READONLY, $ES_WANTRETURN, $WS_VSCROLL))
GUISetOnEvent($GUI_EVENT_MINIMIZE, "CheckGUI", $GUI_Log)
GUISetOnEvent($GUI_EVENT_RESTORE, "CheckGUI", $GUI_Log)
GUISetOnEvent($GUI_EVENT_CLOSE, "CheckGUI", $GUI_Log)
GUISetState(@SW_SHOW, $GUI_Log)
;; ----------------------------------------
;; LogWrite
;; ----------------------------------------
Func LogWrite($Message)
    If GUICtrlRead($GUI_Log_LogEdit) = "" Then
        $GetText = ""
    ElseIf GUICtrlRead($GUI_Log_LogEdit) = Not "" Then
        $GetText = GUICtrlRead($GUI_Log_LogEdit) & @CRLF
    EndIf
    $TimeStamp = "[ " & @MON & "." & @MDAY & "." & @YEAR & "  " & @HOUR & ":" & @MIN & ":" & @SEC & " ] "
    GUICtrlSetData($GUI_Log_LogEdit, $GetText & $TimeStamp & $Message)
EndFunc   ;==>LogWrite
;; ----------------------------------------
;; CheckGUI
;; ----------------------------------------
Func CheckGUI()
    Select
        Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE
            LogWrite("AutoOre log window minimized.")
        Case @GUI_CtrlId = $GUI_EVENT_RESTORE
            LogWrite("AutoOre log window restored.")
        Case @GUI_CtrlId = $GUI_EVENT_CLOSE
            LogWrite("AutoOre log window closed.")
    EndSelect
EndFunc ;==>CheckGUI
;; ----------------------------------------
;; Run GUI
;; ----------------------------------------
While 1
    Sleep(100)
WEnd
Edited by SixWingedFreak
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...