AutoHotkey Community

It is currently May 26th, 2012, 6:36 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 106 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
Author Message
 Post subject:
PostPosted: November 16th, 2007, 8:53 am 
Offline

Joined: November 14th, 2007, 3:33 pm
Posts: 6
Location: Germany
Thanks for that great piece of software! For my special purpose I need word wrap (as others did). Here is a quick & dirty solution:

In cGUI.ahk immediately after

If (ErrorLevel != 0 OR _ctrlID = 0)
Return "ERROR: Error creating control" . ErrorLevel . "/" . A_LastError

add

DllCall("SendMessage", "UInt", _ctrlID, "UInt", 0x448, "UInt", "0", "UInt", "0") ; EM_SETTARGETDEVICE

This works for me, but corrupt will know better, how to do it the clean way.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Scroll bars?
PostPosted: December 6th, 2007, 5:51 pm 
Offline

Joined: June 4th, 2005, 1:54 am
Posts: 146
Nice control!

How do I make the scroll bars disappear? I can't even make them disappear when there's nothing to scroll. I want them to disappear completely, even if there's something to scroll. (And I don't want multi-line...)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 9th, 2007, 7:24 pm 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2541
Thanks for the code suggestion casano :D . I'll have a look.

ezuk, the scrollbars are part of the default style used to create the control. Same with multi-line. I'll look into adding a function to change a few style options to make things a bit more user friendly :) . Thanks


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 18th, 2007, 6:13 pm 
Offline

Joined: March 21st, 2006, 8:31 pm
Posts: 49
Location: Slovakia, Europe :)
how can i make it read only ? and also is there a function that will jump to the end of doc (+new line) ? so i can just append stuff at the end ( imagine something like IRC log or whatever... )

maybe add function addline() to append text to the end of doc.

btw thanx for this :P

EDIT: Ok i know how to make it readonly, just add 0x800 style and its ok :P so now i need jump to the end function :P

_________________
RegExReplace("C:\Program Files\AutoHotkey", "(^C)(?=\W).{4}((?i)[GOD])\w{1,4}\s(\D)(?:\w+)*\\(?3)(u|o).*?(k).*" , "$3$4$l1$5$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 29th, 2008, 2:31 pm 
hello,
nice object, but to add the richedit to another gui window does not work.
Code:
Gui, 3:Show, +hide  H550 W550,HH Converter

If A_OSVersion = WIN_95
  cGUI("3:Add", REdit1, 10, 40, 480, 450, "RICHEDIT")
Else
  cGUI("3:Add", REdit1, 10, 40, 480, 450, "RichEdit20A")
cRichEdit(REdit1, "FileOpen", (A_ScriptDir . "\test.rtf"))

Gui, 3:Show

This adds the richedit to the main gui window. What am i doing wrong?

veio


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 5th, 2008, 4:19 pm 
maybe i found the error:
in cGUI.ahk at "if(_Action0="3")" it must be "else if" i guess.


Report this post
Top
  
Reply with quote  
 Post subject: RTF within a TAB2
PostPosted: March 2nd, 2008, 2:46 pm 
Whe doesn't this work?
Code:
;TRY TO PUT RTF UNDER A TAB
Gui,add,Tab2,,one|two
Gui,Tab,two
GuiHwnd := WinExist()
cGUI("1:Add:%GuiHwnd%", REdit1, GMarginW, GRTFeditT, GRTFeditW, GRTFeditH, RTFeditor)


Note:
Code:
If A_OSVersion = WIN_95
  RTFeditor:="RICHEDIT"
Else
  RTFeditor:="RichEdit20A"


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 8th, 2008, 7:13 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2541
I'm pretty sure you need to specify the HWND of the TAB. I'll see if I can put an example together... :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 16th, 2008, 12:35 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2541
Updated to version 0.08 beta :)

- fixed a bug in cGUI that prevented specifying a HWND for the control's parent
- added an example script for adding the control to an AutoHotkey Tab control to the download (link on the first page).



Here's one method for adding the RichEdit control to a Tab (version 0.08 or higher required):
Code:
Gui, Add, Tab, x10 y10 w380 h380 +0x2C2, Tab1|Tab2|Tab3
Gui, Add, Button, w100 h30,This is a test
Gui, Add, Text,, Please go to tab 2 to see the RichEdit control
Gui, Tab, Tab2
Gui, Add, Button, w100 h30,Ok
Gui, Add, Picture, w320 h270 HwndREparent1

Gui, Add, Text,, This is another test control
Gui, Tab, Tab3
Gui, Add, Button, w100 h30,Cancel

If A_OSVersion = WIN_95
  cGUI("1:Add:" . REparent1, REdit1, 0, 0, 320, 270, "RICHEDIT")
Else
  cGUI("1:Add:" . REparent1, REdit1, 0, 0, 320, 270, "RichEdit20A")

cRichEdit(REdit1, "ReplaceSel",
(
"{\rtf1\ansi\ansicpg13312\deff0\deflang1033\deflangfe1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}{\f1\fswiss\fprq2\fcharset0 Arial Black;}}{\colortbl ;\red0\green0\blue0;\red128\green128\blue128;\red255\green0\blue0;\red0\green0\blue255;\red0\green255\blue0;\red255\green0\blue255;}\viewkind4\uc1\pard\nowidctlpar\cf1\f0\fs20 .\cf2\f1 This is a test\cf3\f0\par\cf4\parTesting 1 2 3 4\par\par\cf5\fs56 Hello\cf4\fs20  \cf6\fs44 World\cf4\fs20   :) \par}
}"
))

Gui, Show, h400 w400, Tab Test
Return

GuiClose:
If (REdit1)
  cRichEdit(REdit1, "Destroy")
Gui, %A_Gui%:Destroy
cGUI("FreeDlls", NULL)
ExitApp
Return

; comment the following #Include lines if you are using stdlib and have copied the required
; cGUI.ahk and cRichedit.ahk files to your stdlib directory

#Include cGUI.ahk
#Include cRichEdit.ahk

Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 19th, 2008, 11:47 pm 
Offline

Joined: December 29th, 2007, 9:40 pm
Posts: 142
corrupt (or someone else :)),

Can you please take a peek at my most recent request for assistance? I haven't gotten a response to it therein. Lexikos (via IRC) pointed me towards another thread, which has potential for being a means of resolution. While reading that, I came across this thread, which seems to be equally as exciting.

I attempted to and have successfully integrated the use of cRichEdit into my IDE project. It was actually pretty easy, once I got over the initial fear of breaking everything with changing one of the most important controls in my project.

Anyways, if you could offer input on how you might go about trying to address my needs, via the use of your tools, it would be greatly appreciated. TIA.

Take care.

-t

_________________
When replying, please feel free to address me as Tod. My AHK.net site...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 20th, 2008, 2:17 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2541
Hi TodWulff :) . There are likely a few methods that you could use to scroll to the bottom of the control. One method might be to use GetTextLength to get the number of characters in the control then use EXSETSEL to set the current selection to the number of characters in the control (start and end position both set to the number of characters in the control). You can test this method by using the commands in the Feature_Demo script that is included in the download.

Another method might be to send a <ctrl> + <end> keystroke to the control... There are a few other methods also... Since the control that gets added using the code here is a standard Windows RichEdit control (not modified - this code is just a wrapper), you will likely find that many of the other methods/functions that you find for use with Edit/RichEdit controls will likely work with this instance of the RichEdit control also.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 20th, 2008, 2:21 am 
Offline

Joined: December 29th, 2007, 9:40 pm
Posts: 142
Thanks corrupt.

Maybe I confused the issue a bit. Yeah, the movement to the bottom of the control is not an issue.

What I am wondering how to accomplish is how do I keep the text in the displayed portion of the control static, while appending to the end of the text in the control...

Is this something that you think is do-able?

-t

_________________
When replying, please feel free to address me as Tod. My AHK.net site...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 20th, 2008, 6:26 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2541
Here's a subroutine that might not be exactly what you're looking for if you are adding to the control constantly at the end and trying to scroll and read through the results at the same time...

Code:
testadd:
  ; Get current scroll position and current selection/caret position
  curpos := cRichEdit(REdit1, "GETSCROLLPOS")
  cursel := cRichEdit(REdit1, "EXGETSEL")
  DllCall("LockWindowUpdate", "UInt", REdit1) ; stop refreshing the control
  ; move to the end of the control
  endpos := cRichEdit(REdit1, "GETTEXTLENGTH")
  cRichEdit(REdit1, "EXSETSEL", endpos, endpos)
  ; add text
  Loop, 200
    cRichEdit(REdit1, "ReplaceSel", "This is a test`r`n`r`ntesting 1 2 3 4 `r`n`r`na b c d ", true)
  ; set the scroll position and selection back to the previous values
  StringSplit, sxy, cursel, |
  cRichEdit(REdit1, "EXSETSEL", sxy1, sxy2)
  StringSplit, xy, curpos, |
  cRichEdit(REdit1, "SETSCROLLPOS", xy1, xy2) 
  DllCall("LockWindowUpdate", "UInt", 0) ; resume refreshing
  ControlFocus,, ahk_id %REdit1%
Return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 20th, 2008, 6:33 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2541
Updated to version 0.9

- added WordWrap option - Thanks casano


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 20th, 2008, 6:51 am 
Offline

Joined: December 29th, 2007, 9:40 pm
Posts: 142
Thanks corrupt - looks to be working with some minor tweaks.!.

I see in another post above where another user was able to set the control to read only with a style of 0x800. I've been struggling to implement this as I don't want the user to have the ability to alter the contents of the console window. Can you provide an example of the use of the 0x800 style in the cRichEdit Constructs?

Take care. Thanks again!

-t

BTW, does the WordWrap'g you just added, negate the need for, and subsequently suppress, the horizontal scroll bar, when enabled? If not, you might want to consider it...

_________________
When replying, please feel free to address me as Tod. My AHK.net site...


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 106 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher, siterip, Stigg and 19 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group