Jump to content
Sign in to follow this  
qwert

Scrolling Rich Text on background ... with a flaw

Recommended Posts

qwert

As I've worked more with RichEdit controls on top of a background image, I've come close to what I consider an ideal solution: simple and with no unusual visual effects.  Scrolling is smooth and natural if you use the scroll wheel on the mouse.

But if you use the scroll bar, the text scrolls, but the scroll bar doesn't move ... until you release it.  Then it updates.  I haven't been able to figure out why.  The script, below, demonstrates the effect (on Windows 7 ... non-aero).

Can someone can suggest a way to have scroll bar track properly.  Thanks.

Rich Text Background.jpg

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

$text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. " & _
"Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in " & _
"reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, " & _
"sunt in culpa qui officia deserunt mollit anim id est laborum."

$bgImage = StringReplace(@AutoItExe, "\autoit3.exe", "") & "\Examples\GUI\msoobe.jpg"

$hGUI = GUICreate("Scroll Transparent", 400, 480, -1, -1, -1, $WS_EX_COMPOSITED) ; ... flashes wildly without Composited
GUISetBkColor(0xFFFFFF)

$hRichEdit = _GUICtrlRichEdit_Create($hGUI, "", 20, 30, 362, 412, BitOR($ES_MULTILINE, $WS_VSCROLL), $WS_EX_TRANSPARENT)
;$hRichEdit = _GUICtrlRichEdit_Create($panel, "", 20, 30, 362, 412, BitOR($ES_MULTILINE, $WS_VSCROLL)) ; << this works properly

_GUICtrlRichEdit_SetText($hRichEdit, $text)
_GUICtrlRichEdit_AppendText($hRichEdit, @CRLF & @CRLF & $text)
_GUICtrlRichEdit_AppendText($hRichEdit, @CRLF & @CRLF & $text)

_GUICtrlRichEdit_SetSel($hRichEdit, 0, -1)                          ; select all
_GUICtrlRichEdit_SetFont($hRichEdit, 14, "Arial")                   ; set font
_GUICtrlRichEdit_SetCharColor($hRichEdit, 0xFFFFFF)
_GUICtrlRichEdit_SetSel($hRichEdit, 0, 0)                           ; set cursor to start

$hPic = GUICtrlCreatePic($bgImage, 0, 0, 400, 480)
GUICtrlSetState(-1, $GUI_DISABLE)

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

 

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  

×

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.