Jump to content

EditBox Font


Floppy
 Share

Recommended Posts

I can write the GuiCtrlSet... function in the script...I would to create a program like MS Word.

For example, if in the editbox there is the phrase:

HELLO WORLD!

I can change the HELLO word to green, and the WORLD word to red, like this:

HELLO WORLD!

Link to comment
Share on other sites

I can write the GuiCtrlSet... function in the script...I would to create a program like MS Word.

You know how long they spend creating Word? :)

I can change the HELLO word to green, and the WORLD word to red, like this:

You need a richtext control to do that. :o Edited by Kip
Link to comment
Share on other sites

You have to use a RichEdit instead of an Edit. Look in my sig for an UDF :) It's an extended version of the one created by Kip.

*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

Link to comment
Share on other sites

Is this really so difficult?

1) Create the RichEdit with _GUICtrlRichEdit_Create

2) use the functions like _GUICtrlRichEdit_SetBold, _GUICtrlRichEdit_SetItalic, _GUICtrlRichEdit_SetFontName for your buttons :)

Most functions are listed here: http://pastebin.com/f7f2a956b

*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

Link to comment
Share on other sites

Is this really so difficult?

1) Create the RichEdit with _GUICtrlRichEdit_Create

2) use the functions like _GUICtrlRichEdit_SetBold, _GUICtrlRichEdit_SetItalic, _GUICtrlRichEdit_SetFontName for your buttons :)

Most functions are listed here: http://pastebin.com/f7f2a956b

it works, but when i'm trying to toggle bold...it doesn't toggle really...maybe the script is wrong...look please:

#include <GuiConstants.au3>
#Include <GuiEdit.au3>
#include <GuiRichEdit.au3>

$gui=GUICreate("Html Editor",1000,500)
$edit=GUICtrlCreateEdit("",10,50,480,440)
$rich=_GUICtrlRichEdit_Create($gui,505,50,480,440)
$bold=GUICtrlCreateButton("B",10,10,30,30)
GUISetState(@SW_SHOW)


While 1
    $m=GUIGetMsg()
    Select
    Case $m=$gui_event_close
        ExitLoop
    Case $m=$bold
        $test=_GUICtrlRichEdit_SetBold($rich,False)
    EndSelect
WEnd

thanks and bye!!!

Edited by FSoft
Link to comment
Share on other sites

First, you have to select a font which has bold and standard style and set it to default. Then you can use the funcs :)

#include <GuiConstants.au3>
#Include <GuiEdit.au3>
#include <GuiRichEdit.au3>

$gui=GUICreate("Html Editor",1000,500)
$edit=GUICtrlCreateEdit("",10,50,480,440)
$rich=_GUICtrlRichEdit_Create($gui,505,50,480,440)
$bold=GUICtrlCreateButton("B",10,10,30,30)
GUISetState(@SW_SHOW)
_GUICtrlRichEdit_SetBold($rich,False,False)
_GUICtrlRichEdit_SetFontName($rich,"Arial",False)


While 1
    $m=GUIGetMsg()
    Select
    Case $m=$gui_event_close
        ExitLoop
    Case $m=$bold
        If _GUICtrlRichEdit_GetBold($rich) Then
            _GUICtrlRichEdit_SetBold($rich,False)
        Else
            _GUICtrlRichEdit_SetBold($rich,True)
        EndIf
    EndSelect
WEnd

*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

Link to comment
Share on other sites

Bold works...

Sorry for the questions...but now ITALIC and UNDERLINE don't works :o (I don't WHY?)...I'm used the same code of the BOLD...look

#include <GuiConstants.au3>
#Include <GuiEdit.au3>
#include <GuiRichEdit.au3>;~ see http://pastebin.com/f7f2a956b

$gui=GUICreate("Html Editor",1000,500)
$edit=GUICtrlCreateEdit("",10,50,480,440)
$rich=_GUICtrlRichEdit_Create($gui,505,50,480,440)
$bold=GUICtrlCreateButton("B",10,10,30,30)
$italic=GUICtrlCreateButton("I",40,10,30,30)
$underline=GUICtrlCreateButton("U",70,10,30,30)
GUISetState(@SW_SHOW)
_GUICtrlRichEdit_SetFontName($rich,"Arial",False)
_GUICtrlRichEdit_SetBold($rich,False,False)
_GUICtrlRichEdit_SetItalic($rich,False,False)
_GUICtrlRichEdit_SetLink($rich,False,False)


While 1
    $m=GUIGetMsg()
    Select
    Case $m=$gui_event_close
        ExitLoop
    Case $m=$bold
        If _GUICtrlRichEdit_GetBold($rich) Then
            _GUICtrlRichEdit_SetBold($rich,False)
        Else
            _GUICtrlRichEdit_SetBold($rich,True)
        EndIf
    Case $m=$italic
        If _GUICtrlRichEdit_SetItalic($rich) Then
            _GUICtrlRichEdit_SetItalic($rich,False)
        Else
            _GUICtrlRichEdit_SetItalic($rich,True)
        EndIf   
    Case $m=$underline
        If _GUICtrlRichEdit_SetLink($rich) Then
            _GUICtrlRichEdit_SetLink($rich,False)
        Else
            _GUICtrlRichEdit_SetLink($rich,True)
        EndIf   
    EndSelect
WEnd

sorry for bother... :) bye and thanks

Edited by FSoft
Link to comment
Share on other sites

Don't forget to use _GUICtrlRichEdit_Get... in if-statement :)

//Edit: use _GUICtrlRichEdit_SetUnderline for underline, not Link. This creates Link-styled text.

Edited by ProgAndy

*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

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