Jump to content
senatin

Why RichEdit become so Buggy when put inside Tab

Recommended Posts

senatin
#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

Share this post


Link to post
Share on other sites
Danyfirex

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

  • Like 1

Share this post


Link to post
Share on other sites
senatin

Thank you so much Thats Why I really Looking for

Ops something went wrong again
when I click tabs The richEdit become buggy again.

Edited by senatin

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

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.