nikolajp Posted May 30, 2007 Share Posted May 30, 2007 Hello. First time on the forum and really using AutoIT alot. Great program!I'm creating a GUI tool for inspecting log files at work. When you push some buttons the program retrieves a logfile and show it in an EditBox (GUICtrlCreateEdit). My problem is that I need to highlight some of the more important lines for easy inspection.I can set a font for the whole control (like bold or underline), but not for specific areas/line in the text.Can I do this somehow with the "simple" EditBox??I have tried implementing the RichTextBox control and it works with bold etc. BUT I have been unable to get the scrollbars to work!! I have searched for plenty of examples and others seem to have the same problem.So I need specific font-setting in EditBox text or some way of enabling the scrollbars properly in a RichTextBox.Any ideas? Or links to other projects where this is done?Thanks in advance - I really need this to work. Link to comment Share on other sites More sharing options...
GaryFrost Posted May 30, 2007 Share Posted May 30, 2007 Hello. First time on the forum and really using AutoIT alot. Great program!I'm creating a GUI tool for inspecting log files at work. When you push some buttons the program retrieves a logfile and show it in an EditBox (GUICtrlCreateEdit). My problem is that I need to highlight some of the more important lines for easy inspection.I can set a font for the whole control (like bold or underline), but not for specific areas/line in the text.Can I do this somehow with the "simple" EditBox??I have tried implementing the RichTextBox control and it works with bold etc. BUT I have been unable to get the scrollbars to work!! I have searched for plenty of examples and others seem to have the same problem.So I need specific font-setting in EditBox text or some way of enabling the scrollbars properly in a RichTextBox.Any ideas? Or links to other projects where this is done?Thanks in advance - I really need this to work.No not with an EditBox.You should be able to treat the RichTextBox scrollbars the same as EditBox scrollbars. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
nikolajp Posted May 30, 2007 Author Share Posted May 30, 2007 No not with an EditBox.You should be able to treat the RichTextBox scrollbars the same as EditBox scrollbars.Thx for replying. The problem is, I cannot seem to get the scrollbars working.As far as I know I need to set it like the following (taken from the help script).CODEWith $oRT .MultiLine = True .ScrollBars = 2EndWithBut they are flagged read-only.This person has the same issue with setting these:http://www.autoitscript.com/forum/index.ph...text+scrollbarsIt is flagged read-only at runtime.Is there another way of creating Richtext Boxes with Scrollbars active?You say:"You should be able to treat the RichTextBox scrollbars the same as EditBox scrollbars."This means I should be able to set the RichTextBox like my a simple one..simple one:CODE$mylist=GUICtrlCreateEdit ("",30,200,750,400,$ES_READONLY + $WS_VSCROLL + $WS_HSCROLL, $WS_EX_CLIENTEDGE)And the Rich Text Box is defined like this in the help text:CODE$GUIActiveX = GUICtrlCreateObj( $oRP, 10, 10 , 400 , 260 )GUICtrlSetPos($GUIActiveX,10,10,300,160)I cannot see how I can use the same type-settings as before.And the above .Scrollbars =2 fails due to the read-only state.Any ideas? Link to comment Share on other sites More sharing options...
GaryFrost Posted May 30, 2007 Share Posted May 30, 2007 Don't think you can set the scrollbars that way, haven't found how.I last worked on a RichEdit project over a year ago, If someone wants to see what they can do with it (have fun) http://www.autoitscript.com/forum/index.ph...st&p=148943I believe there is an rtfplugin.dll somewhere in the Example Scripts also, I've used that one before. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
nikolajp Posted May 31, 2007 Author Share Posted May 31, 2007 Thanks for trying, but it does not solve the issue.I cannot seem to get scrollbars with a RichTextObject and cannot see anybody has done it before.. too bad as it was the final hurdle..nikolajpDon't think you can set the scrollbars that way, haven't found how.I last worked on a RichEdit project over a year ago, If someone wants to see what they can do with it (have fun) http://www.autoitscript.com/forum/index.ph...st&p=148943I believe there is an rtfplugin.dll somewhere in the Example Scripts also, I've used that one before. Link to comment Share on other sites More sharing options...
GaryFrost Posted May 31, 2007 Share Posted May 31, 2007 expandcollapse popup#include <GUIConstants.au3> #include <Misc.au3> Global Const $EM_SHOWSCROLLBAR = ($WM_USER + 96) Global Const $SB_HORZ = 0 Global Const $SB_VERT = 1 Global Const $SB_BOTH = 3 $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $oRP = ObjCreate("RICHTEXT.RichtextCtrl.1") GUICreate("Embedded RICHTEXT control Test", 320, 200, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN)) $TagsPageC = GUICtrlCreateLabel('Visit Tags Page', 5, 180, 100, 15, $SS_CENTER) GUICtrlSetFont($TagsPageC, 9, 400, 4) GUICtrlSetColor($TagsPageC, 0x0000ff) GUICtrlSetCursor($TagsPageC, 0) $AboutC = GUICtrlCreateButton('About', 105, 177, 70, 20) $PrefsC = GUICtrlCreateButton('FontSize', 175, 177, 70, 20) $StatC = GUICtrlCreateButton('Plain Style', 245, 177, 70, 20) $GUIActiveX = GUICtrlCreateObj($oRP, 10, 10, 400, 260) GUICtrlSetPos($GUIActiveX, 10, 10, 300, 160) With $oRP; Object tag pool .OLEDrag () .Font = 'Arial' .text = "Hello - Au3 supports ActiveX components like the RICHTEXT thanks to SvenP" & @CRLF & 'Try write some text and quit to reload' ;.FileName = @ScriptDir & '\RichText.rtf' ;.BackColor = 0xff00 EndWith $rt_handle = ControlGetHandle("Embedded RICHTEXT control Test", "", "RichTextWndClass1") _SendMessage($rt_handle, $EM_SHOWSCROLLBAR, $SB_VERT, True) GUISetState();Show GUI While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE $oRP.SaveFile (@ScriptDir & "\RichText.rtf", 0) ExitLoop Case $msg = $TagsPageC Run(@ComSpec & ' /c start http://www.myplugins.info/guids/typeinfo/typeinfo.php?clsid={3B7C8860-D78F-101B-B9B5-04021C009402}', '', @SW_HIDE) Case $msg = $AboutC $oRP.AboutBox () Case $msg = $PrefsC $oRP.SelFontSize = 12 Case $msg = $StatC $oRP.SelBold = False $oRP.SelItalic = False $oRP.SelUnderline = False $oRP.SelFontSize = 8 EndSelect WEnd Exit Func MyErrFunc() MsgBox(0, "AutoItCOM Test", "We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & Hex($oMyError.number, 8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ , 5) ; Will automatically continue after 5 seconds Local $err = $oMyError.number If $err = 0 Then $err = -1 SetError($err) ; to check for after this function returns EndFunc ;==>MyErrFunc SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
nikolajp Posted June 4, 2007 Author Share Posted June 4, 2007 Thanks alot! That seems to be working.. implementing it right now. Link to comment Share on other sites More sharing options...
nikolajp Posted June 4, 2007 Author Share Posted June 4, 2007 Thanks alot!That seems to be working.. implementing it right now.Thank you again. It worked. I have one last issue I hope you can help me with.When I write certain logs in the RichTextBox the text is listed kinda scrambled (not in line).So certain logs are not easy to read. These logs I would like to show as the simple text box does it.I think it is the tabbing that is causing trouble in a RichTextBox.I need to change the behavior to correctly handle these tabs.. or change the box to some other state, before pasting the text in the code, so it will line correctly.I could perhaps replace/switch the RichTextBox in the gui, whenever these logs are written, but it would be much better to change the RichTextBox to support tabbed logs correctly. Any idea? Thanks again for the help.Much appreciated. Link to comment Share on other sites More sharing options...
James Posted June 4, 2007 Share Posted June 4, 2007 Look at betapad. It uses scrollbars (Thanks again Gary) Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Raja Posted August 9, 2007 Share Posted August 9, 2007 To gafrost, Thank you so much for the example on getting scroll bars to work in a RichTextBox. You are a genius and a life saver, hats off to you! Was lucky to find your example that saved my work from being scrapped. Much appreciate your contributions. Thanks once again. Raja 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