Floppy Posted December 22, 2008 Share Posted December 22, 2008 Hi, I have an editbox with some text, how can i change the font in editbox...for example, some text BOLD, other ITALIC, etc. Thanks in advance Link to comment Share on other sites More sharing options...
youknowwho4eva Posted December 22, 2008 Share Posted December 22, 2008 look up all the guictrlset functions in autoit. Giggity Link to comment Share on other sites More sharing options...
Floppy Posted December 22, 2008 Author Share Posted December 22, 2008 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 More sharing options...
Developers Jos Posted December 22, 2008 Developers Share Posted December 22, 2008 Edit control doesn't support that. SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Floppy Posted December 22, 2008 Author Share Posted December 22, 2008 :( Is there another way? Otherwise, thank you... Link to comment Share on other sites More sharing options...
Kip Posted December 22, 2008 Share Posted December 22, 2008 (edited) 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. Edited December 22, 2008 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
Floppy Posted December 23, 2008 Author Share Posted December 23, 2008 You know how long they spend creating Word? You need a richtext control to do that. Yes, but I want to create a program similar Word, not exactly the same... Link to comment Share on other sites More sharing options...
ProgAndy Posted December 23, 2008 Share Posted December 23, 2008 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 More sharing options...
Floppy Posted December 23, 2008 Author Share Posted December 23, 2008 It's very long. Can you explain how can I use it, please? Link to comment Share on other sites More sharing options...
ProgAndy Posted December 23, 2008 Share Posted December 23, 2008 Is this really so difficult?1) Create the RichEdit with _GUICtrlRichEdit_Create2) 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 More sharing options...
Floppy Posted December 23, 2008 Author Share Posted December 23, 2008 (edited) 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 December 23, 2008 by FSoft Link to comment Share on other sites More sharing options...
ProgAndy Posted December 23, 2008 Share Posted December 23, 2008 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 More sharing options...
Floppy Posted December 23, 2008 Author Share Posted December 23, 2008 (edited) Bold works... Sorry for the questions...but now ITALIC and UNDERLINE don't works (I don't WHY?)...I'm used the same code of the BOLD...look expandcollapse popup#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 December 23, 2008 by FSoft Link to comment Share on other sites More sharing options...
ProgAndy Posted December 23, 2008 Share Posted December 23, 2008 (edited) Don't forget to use _GUICtrlRichEdit_Get... in if-statement //Edit: use _GUICtrlRichEdit_SetUnderline for underline, not Link. This creates Link-styled text. Edited December 23, 2008 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 More sharing options...
Floppy Posted December 24, 2008 Author Share Posted December 24, 2008 I'M VERY VERY SILLY . Now works...thank you very much...BYE! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now