Jump to content

Why RichEdit become so Buggy when put inside Tab


senatin
 Share

Recommended Posts

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

HotKeySet ("-", "InsertText")
HotKeySet( "=", "Turnoff")

$Form1 = GUICreate("Senatin", 466, 422, 79, 132)
$Tab1 = GUICtrlCreateTab(5, 0, 457, 420)
;~ ;TabSheet1
$TabSheet1 = GUICtrlCreateTabItem("Main")
$hRichEdit = _GUICtrlRichEdit_Create($Form1, "", 12, 161, 241, 249, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)

While 1
   Sleep(100)
WEnd



Func InsertText()
    ; Count the @CRLFs
    StringReplace(_GUICtrlRichEdit_GetText($hRichEdit, True), @CRLF, "")
    Local $iLines = @extended
    ; Adjust the text char count to account for the @CRLFs
    Local $iEndPoint = _GUICtrlRichEdit_GetTextLength($hRichEdit, True, True) - $iLines
    ; Add new text
    _GUICtrlRichEdit_AppendText($hRichEdit, "test on Test" & @CRLF)
    ; Select text between old and new end points
    _GuiCtrlRichEdit_SetSel($hRichEdit, $iEndPoint, -1)
    ; Convert colour from RGB to BGR
    $iColor = Hex(0xff0000, 6)
    $iColor = '0x' & StringMid($iColor, 5, 2) & StringMid($iColor, 3, 2) & StringMid($iColor, 1, 2)
    ; Set colour
   _GuiCtrlRichEdit_SetCharColor($hRichEdit, $iColor)
    ; Set size
   _GUICtrlRichEdit_ChangeFontSize($hRichEdit, 0)
    ; Set weight
   _GUICtrlRichEdit_SetCharAttributes($hRichEdit, "-bo")
    ; Clear selection
    _GUICtrlRichEdit_Deselect($hRichEdit)
EndFunc

Func Turnoff()
   GUIDelete($Form1)
   Exit
EndFunc

When The RichEdit become full by pressing "-" The Old Text become color white and Richedit losses its form.
can Someone Please Help me Fix this. Thank you

Oh I figure it out
Puting RichEdit Before Creation of Tab is the solution.
 

Edited by senatin
Link to comment
Share on other sites

Hello.

Create the RicthEdit into the Tab Control.

$hRichEdit = _GUICtrlRichEdit_Create(GUICtrlGetHandle($Tab1), "", 12, 161, 241, 249, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))

 

Saludos

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...