Sign in to follow this  
Followers 0
Darter

crazy bug

4 posts in this topic

#1 ·  Posted (edited)

Do somebedoy have a reason for this ?

I want to to this like that because i don´t wanna loose the fokus from the menue.

If i do it with a "Normal" child exactly that will happpen

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

Opt('GUIOnEventMode', 1)

$hwinM = GUICreate('test', 300,300, -1, -1, $WS_SIZEBOX)
$MenueID = GUICtrlCreateMenu('Menü')
$MenueItemID1 = GUICtrlCreateMenuItem('Item1', $MenueID)
$MenueItemID2 = GUICtrlCreateMenuItem('Item2', $MenueID)
GUISetOnEvent(-3, '_Exit')
GUISetState()
GUIRegisterMsg(0x0113, "WM_TIMER") ;$WM_TIMER = 0x0113

;~ $hWindChild = GUICreate('child', 100, 100, 100, 100, -1)
$hEdit = _GUICtrlRichEdit_Create($hwinM,"",0,0,100,100,BitOR($ES_READONLY, $ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL, $WS_CAPTION, $WS_CHILD, $WS_THICKFRAME, $WS_SIZEBOX, $WS_SYSMENU), $WS_EX_TOOLWINDOW )
;~ $hEdit = GUICtrlCreateEdit("",0,0,100,100,BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL, $WS_CAPTION, $WS_CHILD, $WS_THICKFRAME, $WS_SIZEBOX, $WS_SYSMENU))
;~ GUISetState(@SW_SHOW, $hWindChild)
DllCall("User32.dll", "int", "SetTimer", "hwnd", $hwinM, "int", 1, "int", 1000, "int", 0)

While 1
    Sleep(1000)
WEnd

Func WM_TIMER($hWnd, $Msg, $wParam, $lParam)
    _GUICtrlRichEdit_AppendTextUTF8($hEdit, 1 & @CRLF)
    ;GUICtrlSetData($hEdit, GUICtrlRead($hEdit) & @CRLF + 1 & @CRLF)
EndFunc

; ProgAndy ; Edited
Func _GUICtrlRichEdit_AppendTextUTF8($hWnd, $sText)
    If Not IsHWnd($hWnd) Then Return SetError(101, 0, False)
    _GUICtrlRichEdit_SetSel($hWnd, -1, -1) ; go to end of text
    Local $tSetText = DllStructCreate($tagSETTEXTEX)
    DllStructSetData($tSetText, 1, $ST_SELECTION)
    DllStructSetData($tSetText, 2, 65001)
    Local $iRet = _SendMessage($hWnd, $EM_SETTEXTEX, DllStructGetPtr($tSetText), BinaryToString(StringToBinary($sText, 4), 1), 0, "ptr", "STR")
    If Not $iRet Then Return SetError(700, 0, False)
    Return True
EndFunc   ;==>_GUICtrlRichEdit_AppendText

Func _Exit()
    Exit
EndFunc
Edited by Darter

Share this post


Link to post
Share on other sites



Why do you need this? Without WS_CAPTION it works fine.


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I sad why ^^

and $ES_MULTILINE creates that bug that the edit is spin colockwise about 90°.

But only Richt edit the normal Edit Ctrl works fine, but i need the richt edit control and i should make this like that,

because if i put the edit on a "Normal" Child Window, the rich edit crl steal me the fokus from my Menue.

Edited by Darter

Share this post


Link to post
Share on other sites

Focus steal is not caused from _GUICtrlRichEdit_AppendText but from _GUICtrlRichEdit_SetSel.

You can edit GuiRichEdit.au3 removing _WinAPI_SetFocus($hWnd) from that function but you will then have to use _GUICtrlRichEdit_ScrollLineOrPage or _GUICtrlRichEdit_ScrollLines to do the scrolling yourself.

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