RichEdit Functions (OOP) New: with Image-Support
Re: RichEdit Functions (OOP) New: with Image-Support
Thanks but...
The values of 'startpos' and 'endpos' are memory addresses' and I need to read (a) the contents of the line in the HEX editor (to recover the offset address) and (b) the highlighted section that the user has identified.
I suppose I could search backwards or forwards from 'startpos' until I find an address (which is identifiable because it has a lot of digits with no spaces) but that is a bit of a kludge!
Richard
			
			
									
									
						The values of 'startpos' and 'endpos' are memory addresses' and I need to read (a) the contents of the line in the HEX editor (to recover the offset address) and (b) the highlighted section that the user has identified.
I suppose I could search backwards or forwards from 'startpos' until I find an address (which is identifiable because it has a lot of digits with no spaces) but that is a bit of a kludge!
Richard
- VB6_to_PBx
 - Enthusiast

 - Posts: 627
 - Joined: Mon May 09, 2011 9:36 am
 
Re: RichEdit Functions (OOP) New: with Image-Support
ts-soft ,
How can i Open a regular .TXT file with your RichEdit Software ??
i would like to Open and Edit a regular .TXT file with your RichEdit Software ,
then make some RichText changes to that .TXT file content, ( such as Bold or Font Color changes , etc. )
and then be able to Save that file along with any Rich Text changes i've made
and Save it with .RTF extension , as a real .RTF file.
-----------
i know i can open a .TXT file then Copy its Text to the ClipBoard
and then Paste it into your RichEdit software
but i would like to just Open a TXT file and do Rich Text editing inside your software
then Save it as .RTF File
			
			
													How can i Open a regular .TXT file with your RichEdit Software ??
i would like to Open and Edit a regular .TXT file with your RichEdit Software ,
then make some RichText changes to that .TXT file content, ( such as Bold or Font Color changes , etc. )
and then be able to Save that file along with any Rich Text changes i've made
and Save it with .RTF extension , as a real .RTF file.
-----------
i know i can open a .TXT file then Copy its Text to the ClipBoard
and then Paste it into your RichEdit software
but i would like to just Open a TXT file and do Rich Text editing inside your software
then Save it as .RTF File
					Last edited by VB6_to_PBx on Wed Oct 09, 2013 12:20 am, edited 1 time in total.
									
			
									PureBasic .... making tiny electrons do what you want !
"With every mistake we must surely be learning" - George Harrison
Re: RichEdit Functions (OOP) New: with Image-Support
Did you try renaming the .txt to .rtf?
Just asking. I have not tried it myself.
cheers
			
			
									
									
						Just asking. I have not tried it myself.
cheers
- VB6_to_PBx
 - Enthusiast

 - Posts: 627
 - Joined: Mon May 09, 2011 9:36 am
 
Re: RichEdit Functions (OOP) New: with Image-Support
i had tried that too, but it does not work .rsts wrote:Did you try renaming the .txt to .rtf?
Just asking. I have not tried it myself.
cheers
the only other way is too Paste text from the ClipBoard
PureBasic .... making tiny electrons do what you want !
"With every mistake we must surely be learning" - George Harrison
Re: RichEdit Functions (OOP) New: with Image-Support
Code: Select all
RichEdit_LoadText()
RichEdit_SaveRTF()PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

						Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

- VB6_to_PBx
 - Enthusiast

 - Posts: 627
 - Joined: Mon May 09, 2011 9:36 am
 
Re: RichEdit Functions (OOP) New: with Image-Support
i changed your Code to this : Edit\LoadText(File)ts-soft wrote:?Code: Select all
RichEdit_LoadText() RichEdit_SaveRTF()
Code: Select all
    Case #PB_Event_Menu
      Select EventMenu()
        Case #mnu_New
          Edit\Clear()
          SetStatusbarText()
          DisableToolBarButton(0, #mnu_Undo, Edit\CanUndo() ! 1)
          DisableToolBarButton(0, #mnu_Redo, #True)
        Case #mnu_Open
          File = OpenFileRequester(Lang(23), "", "RichText (*.rtf)|*.rtf | Text (*.txt)|*.txt", 0)
          If File
            Edit\LoadRTF(File)
            Edit\LoadText(File)
            SetStatusbarText()
            DisableToolBarButton(0, #mnu_Undo, Edit\CanUndo() ! 1)
            DisableToolBarButton(0, #mnu_Redo, #True) 
          EndIf
is that OK or proper way to modify your Code ??
any problems doing that way ??
Also when you Save a File it does not automatically add the .RTF extension
One more Problem occurs if i try your RichText software in new PB version 5.20
but not in older v5.11
the PB v5.20 ERROR is Line = #CFM_SUPERSCRIPT
[01:52:36] [COMPILER] Line 106: Constant already declared with a different value: #CFM_SUPERSCRIPT.
PureBasic .... making tiny electrons do what you want !
"With every mistake we must surely be learning" - George Harrison
Re: RichEdit Functions (OOP) New: with Image-Support
This is a featureVB6_to_PBx wrote:Also when you Save a File it does not automatically add the .RTF extension
Add a compilerdirective with CompilerIf Defined around the declaration.VB6_to_PBx wrote:the PB v5.20 ERROR is Line = #CFM_SUPERSCRIPT
[01:52:36] [COMPILER] Line 106: Constant already declared with a different value: #CFM_SUPERSCRIPT.
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

						Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Re: RichEdit Functions (OOP) New: with Image-Support
Update:
			
			
									
									Special thanks to ozzie for his suggestions/fixesHistory wrote:; Version 2.2, October 31, 2013
; modified for PB 5.20
; modified: GetRTFStreamCallback
; Version 2.3, November 03, 2013
; changed to Module (RichEdit)
; some bugfixes
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

						Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Re: RichEdit Functions (OOP) New: with Image-Support
I know this is an old thread but anyone downloading this may still get an error from
#CFM_SUPERSCRIPT already defined with different value
Because the constant is declared again a little further down the list of constants
just after the CFE constants
#CFM_SUBSCRIPT = #CFE_SUBSCRIPT | #CFE_SUPERSCRIPT
So the first definition can be commented out and everything will be ok.
			
			
									
									
						#CFM_SUPERSCRIPT already defined with different value
Because the constant is declared again a little further down the list of constants
just after the CFE constants
#CFM_SUBSCRIPT = #CFE_SUBSCRIPT | #CFE_SUPERSCRIPT
So the first definition can be commented out and everything will be ok.
Re: RichEdit Functions (OOP) New: with Image-Support
@ASI
from first page:
http://www.realsource.de/downloads/doc_ ... edit-class
			
			
									
									from first page:
here the link (is also in the first page):ts-soft wrote:Attention:
The new version breaks the limit of 60000 chars from the forum,
please download it.
Current is Version 2.3 from 2013/11/03
http://www.realsource.de/downloads/doc_ ... edit-class
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

						Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Re: RichEdit Functions (OOP) New: with Image-Support
Yes i know links are on the first page.
Appologies for confusion caused. And not meant to offend,
I thank you for creating this in the first place.
I have been using the code for a while in a project.
			
			
									
									
						Appologies for confusion caused. And not meant to offend,
I thank you for creating this in the first place.
I have been using the code for a while in a project.
Re: RichEdit Functions (OOP) New: with Image-Support
I mean, there is no problem with constants in v 2.3?
			
			
									
									Code: Select all
  #CFM_ALLCAPS = $80
  #CFM_ANIMATION = $40000
  #CFM_BACKCOLOR = $4000000
  #CFM_BOLD = $1
  #CFM_CHARSET = $8000000
  #CFM_COLOR = $40000000
  #CFM_DISABLED = $2000
  #CFM_EMBOSS = $800
  #CFM_FACE = $20000000
  #CFM_HIDDEN = $100
  #CFM_IMPRINT = $1000
  #CFM_ITALIC = $2
  #CFM_KERNING = $100000
  #CFM_LCID = $2000000
  #CFM_LINK = $20
  #CFM_OFFSET = $10000000
  #CFM_OUTLINE = $200
  #CFM_PROTECTED = $10
  #CFM_REVAUTHOR = $8000
  #CFM_REVISED = $4000
  #CFM_SHADOW = $400
  #CFM_SIZE = $80000000
  #CFM_SMALLCAPS = $40
  #CFM_SPACING = $200000
  #CFM_STRIKEOUT = $8
  #CFM_STYLE = $80000
  CompilerIf Defined(CFM_SUPERSCRIPT, #PB_Constant) = #False
    #CFM_SUPERSCRIPT =  $20000; #CFM_SUBSCRIPT
  CompilerEndIf
  #CFM_UNDERLINE = $4
  #CFM_UNDERLINETYPE = $800000
  #CFM_WEIGHT = $400000
  
  #CFE_ALLCAPS = #CFM_ALLCAPS
  #CFE_AUTOBACKCOLOR = #CFM_BACKCOLOR
  #CFE_AUTOCOLOR = $40000000
  #CFE_BOLD = #CFM_BOLD
  #CFE_DISABLED = #CFM_DISABLED
  #CFE_EMBOSS = #CFM_EMBOSS
  #CFE_HIDDEN = #CFM_HIDDEN
  #CFE_IMPRINT = #CFM_IMPRINT
  #CFE_ITALIC = #CFM_ITALIC
  #CFE_LINK = #CFM_LINK
  #CFE_OUTLINE = #CFM_OUTLINE
  #CFE_PROTECTED = #CFM_PROTECTED
  #CFE_REVISED = #CFM_REVISED
  #CFE_SHADOW = #CFM_SHADOW
  #CFE_SMALLCAPS = #CFM_SMALLCAPS
  #CFE_STRIKEOUT = $8
  #CFE_SUBSCRIPT = $10000
  #CFE_SUPERSCRIPT = $20000
  #CFE_UNDERLINE = $4
  #CFM_SUBSCRIPT = #CFE_SUBSCRIPT | #CFE_SUPERSCRIPT
  
  #ENM_LINK = $04000000
  
  #PFA_JUSTIFY = 4  ;New paragraph-alignment option 2.0
  
  #ST_DEFAULT = 0
  #ST_KEEPUNDO = 1
  #ST_SELECTION = 2
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

						Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Re: RichEdit Functions (OOP) New: with Image-Support
Just downloaded and experimented with this.
I didn't get any error messages.
And I think this is really impressive.
 
thanks for the work on it, ts-soft.
			
			
									
									
						I didn't get any error messages.
And I think this is really impressive.
thanks for the work on it, ts-soft.
Re: RichEdit Functions (OOP) New: with Image-Support
Hello Thomas!
Just needed an RTF-converting to raw text.
Seems that SetText and GetText do this easily as PB can show RTF.
So, thanks a lot for sharing!!!
			
			
									
									
						Just needed an RTF-converting to raw text.
Seems that SetText and GetText do this easily as PB can show RTF.
So, thanks a lot for sharing!!!
Re: RichEdit Functions (OOP) New: with Image-Support
Thanks for this usefull and great work.
This is a lot of time i wait for something like this.
I noticed in the spellchecker example that if the first word at top/left is wrong, correcting it will make its first letter to be doubled.
I also noticed that the Chr(13) separator seems to not be recognised in the "Tokenise" functions.
For example, if i delete the randomly generated text, and put a wrong word at the first line and a wrong word at the second line, a right click on the first word will give me a correction based on the two words.
EDIT:
The first bug was that at three times, you should use #WB_MOVEWORDLEFT, not #WB_LEFTBREAK.
This is the three procedures to edit :
			
			
									
									This is a lot of time i wait for something like this.
I noticed in the spellchecker example that if the first word at top/left is wrong, correcting it will make its first letter to be doubled.
I also noticed that the Chr(13) separator seems to not be recognised in the "Tokenise" functions.
For example, if i delete the randomly generated text, and put a wrong word at the first line and a wrong word at the second line, a right click on the first word will give me a correction based on the two words.
EDIT:
The first bug was that at three times, you should use #WB_MOVEWORDLEFT, not #WB_LEFTBREAK.
This is the three procedures to edit :
Code: Select all
RichEdit_GetWordUnderMouse( *this.RichEditClassTemplate, x.i, y.i )
RichEdit_GetCurrentWord(*this.RichEditClassTemplate)
RichEdit_GetWordAtPosition(*this.RichEditClassTemplate, Pos.i)
Enjoy the silence
						


