Sign in to follow this  
Followers 0
LiveOnTheFly

Different Font types and Smoothness in a Edit

4 posts in this topic

#1 ·  Posted (edited)

1. Is there anyway to not have the whole font of the Edit change when Ii change the font?

2. When I update my edit using guisetdata() It's flickering(lots of guisetdata one every 53 ms)

here my code:

#include <GUIConstants.au3>
;~ #include <EditConstants.au3>
#include <guiedit.au3>
#include <ScrollBarConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 447, 193, 125)
$Edit1 = GUICtrlCreateEdit("", 0, 0, 633, 447,0x0080+0x0040+0x0004+0x0800)
;~ GUICtrlSetState($Edit1,$GUI_DISABLE)
GUICtrlSetColor($Edit1,0xFFFFFF)
GUICtrlSetBkColor($Edit1,0x000000)
GUICtrlSetData(-1, "Edit1")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###)
$mission = "mission1";hardcoded for now untill everything is done. Mission selector will we added last
$mission = FileRead($mission & ".txt")
$mission = StringSplit($mission,@crlf,1)
dim $oldtxt
ConsoleWrite(@crlf)
$n = 1
$max = $mission[0]
while 1
    $toparse = $mission[$n]
    ConsoleWrite($toparse)
    $toparse = StringSplit($toparse,"|")
    if $toparse[0] > 0 then
        if $toparse[1] = "Say" Then
            Say($toparse[2])
        ElseIf $toparse[1] = "Sayncrlf" Then
            Sayncrlf($toparse[2])
        elseif $toparse[1] = "Sayi" Then
            Sayi($toparse[2])
        elseif $toparse[1] = "Sayincrlf" Then
            Sayincrlf($toparse[2])
        EndIf
    EndIf
    $n+= 1
    if $n > $max Then
        MsgBox(0,"","Mission Complete!")
        Exit;make this go back to mission select and do various save game things
    EndIf
    _GUICtrlEdit_Scroll($Edit1,$SB_SCROLLCARET)
WEnd
func say($txt = "")
    for $i = 1 to StringLen($txt)
        $oldtxt&= StringMid($txt,$i,1)
        GUICtrlSetData($Edit1,$oldtxt)
        sleep(53)
    Next
    $oldtxt &= @crlf
    GUICtrlSetData($Edit1,$oldtxt)
EndFunc
func sayncrlf($txt = "")
    for $i = 1 to StringLen($txt)
        $oldtxt&= StringMid($txt,$i,1)
        GUICtrlSetData($Edit1,$oldtxt)
        sleep(53)
    Next
;~  $oldtxt &= @crlf
    GUICtrlSetData($Edit1,$oldtxt)
EndFunc
func sayi($txt = "")
    GUICtrlSetFont($Edit1,Default,400,2)
    for $i = 1 to StringLen($txt)
        $oldtxt&= StringMid($txt,$i,1)
        GUICtrlSetData($Edit1,$oldtxt)
        sleep(53)
    Next
    GUICtrlSetFont($Edit1,Default,400,0)
    $oldtxt &= @crlf
    GUICtrlSetData($Edit1,$oldtxt)
EndFunc
func sayincrlf($txt = "")
    GUICtrlSetFont($Edit1,"8.5",400,2)
    for $i = 1 to StringLen($txt)
        $oldtxt&= StringMid($txt,$i,1)
        GUICtrlSetData($Edit1,$oldtxt)
        sleep(53)
    Next
    GUICtrlSetFont($Edit1,"8.5",400,0)
    $oldtxt &= @crlf
    GUICtrlSetData($Edit1,$oldtxt)
EndFunc

and here is mission1.txt

Say|December 15, 1966
Say|
Say|You've just setup both of your computers' connections to this new internet thing.
Sayncrlf|Yay! It's time to finally learn how to use this thing! 
Sayi|You get out the instruction
Sayincrlf|manual to the internet and flip to page 122. 
Say|It says to type in "telnet 192.168.1.122"
Say|into the console to connect to your other computer
Edited by LiveOnTheFly

Share this post


Link to post
Share on other sites



Thanks for suggesting the richedit guys. There's no flickering with it either!

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