? Rich Edit Formatting Lost When Inserting At Position 0

    Hi,

    I'm using a CRichEditCtrl but am having trouble with the formatting.  I
use SetSel and ReplaceSel to insert text into the control and if the text is
inserted in the middle or at the end of the control's buffer it works just
fine but if I insert it at the start (SetSel(0,0)) then it takes on the
formatting (both character formatting and paragraph formatting) of the text
immediately after it (the text formerly at 0).  There is a small note about
ReplaceSel in MSDN:

"This function will format the inserted text with the existing character
formatting. When replacing the entire range of text (by calling SetSel(0,-1)
before calling ReplaceSel), there is an end of paragraph character that
retains the previous paragraph's formatting, which in inherited by the newly
inserted text."

    I assume my problem is related to this.  Is there a way around it?  Is
there a way to insert text at position 0 using the currently selected
character and paragraph formatting instead of those of the text currently at
position 0?


    Thanks a lot.

--
Alec S.
alec <@> synetech <.> cjb <.> net




0
Alec
12/10/2004 7:35:29 AM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
587 Views

Similar Articles

[PageSpeed] 44

Alec,

I would try getting and saving the formatting of the currently selected
text, do the insertion, and then reapply the saved formatting.

Johan Rosengren
Abstrakt Mekanik AB

"Alec S." <a@a.com> a �crit dans le message de
news:ObLzXro3EHA.1188@tk2msftngp13.phx.gbl...
>     Hi,
>
>     I'm using a CRichEditCtrl but am having trouble with the formatting.
I
> use SetSel and ReplaceSel to insert text into the control and if the text
is
> inserted in the middle or at the end of the control's buffer it works just
> fine but if I insert it at the start (SetSel(0,0)) then it takes on the
> formatting (both character formatting and paragraph formatting) of the
text
> immediately after it (the text formerly at 0).  There is a small note
about
> ReplaceSel in MSDN:
>
> "This function will format the inserted text with the existing character
> formatting. When replacing the entire range of text (by calling
SetSel(0,-1)
> before calling ReplaceSel), there is an end of paragraph character that
> retains the previous paragraph's formatting, which in inherited by the
newly
> inserted text."
>
>     I assume my problem is related to this.  Is there a way around it?  Is
> there a way to insert text at position 0 using the currently selected
> character and paragraph formatting instead of those of the text currently
at
> position 0?
>
>
>     Thanks a lot.
>
> --
> Alec S.
> alec <@> synetech <.> cjb <.> net
>
>
>
>


0
12/11/2004 8:56:26 AM
    I've already tried that but it doesn't work.  The paragraph formatting
(alignment) doesn't seem to take when I insert at (0,0).  The character
formatting does though.  Also, if I set the alignment AFTER I insert it at
(0,0) then the line right below the target line takes on that alignment.
Plus, I'm left with the target formats (both paragraph and character) at the
end of the buffer.


--
Alec S.
alec <@> synetech <.> cjb <.> net


"Johan Rosengren" <johan.rosengren@telia.com> wrote in message
news:ev8t$%2313EHA.3472@TK2MSFTNGP09.phx.gbl...
> Alec,
>
> I would try getting and saving the formatting of the currently selected
> text, do the insertion, and then reapply the saved formatting.
>
> Johan Rosengren
> Abstrakt Mekanik AB
>


0
Alec
12/15/2004 5:49:56 AM
Alec,

The RTF-control is a trying beast :-)

Alignment will have to be broken by having a new paragraph between the new
and old block, you might have some luck making sure that the block you copy
is ended with one. And you should try not just apply to 0,0, but rather
0,[length-of-inserted-text].

A more elaborate way - which I have used myself for advanced formatting
needs - is having a hidden RTF into which you can do steps "in-between", in
your case perhaps pasting all the contents, then explicitly re-copy in the
hidden control, and then finally paste back to the original control. One
advantage is that you can have the hidden control displayed while developing
:-)

Johan Rosengren
Abstrakt Mekanik AB

"Alec S." <a@a.com> a �crit dans le message de
news:%231pBPnm4EHA.1400@TK2MSFTNGP11.phx.gbl...
>     I've already tried that but it doesn't work.  The paragraph formatting
> (alignment) doesn't seem to take when I insert at (0,0).  The character
> formatting does though.  Also, if I set the alignment AFTER I insert it at
> (0,0) then the line right below the target line takes on that alignment.
> Plus, I'm left with the target formats (both paragraph and character) at
the
> end of the buffer.
>
>
> --
> Alec S.
> alec <@> synetech <.> cjb <.> net
>
>
> "Johan Rosengren" <johan.rosengren@telia.com> wrote in message
> news:ev8t$%2313EHA.3472@TK2MSFTNGP09.phx.gbl...
> > Alec,
> >
> > I would try getting and saving the formatting of the currently selected
> > text, do the insertion, and then reapply the saved formatting.
> >
> > Johan Rosengren
> > Abstrakt Mekanik AB
> >
>
>


0
12/16/2004 5:45:24 PM
Reply:

Similar Artilces:

tools|options|Edit tab|fixed decimal places
Following up on a post from a couple weeks ago. I'm wondering if anyone knows of a good use for this option. As far as I can tell, it is a global setting (i.e., affects all open worksheets). It appears as if it would be used for data entry purposes, but it doesn't work like I would expect it to. For example, if fixed decimal places is set to 3, when you enter 12,345 = 12.345 (once you hit enter, excel moves the decimal position three to the left) 12,345.6 = 12,345.6 (but if you use a decimal place when you type the number, it doesn't move the decimal at all) If you...

[MS Graph] Cannot edit in the datasheets
Hello, We have a problem with Microsoft Graph (Office 2004 on Mac) opened by PowerPoint 2004. Sometime, it's impossible to edit the graph : I cannot modify the value in the datasheet. I can delete or paste a new value with the clipboard, but I cannot write anything with my keyboard. Sometime, closing MS Graph solve the problem, sometime no. Same thing with a system reboot. When restarting MS Graph or rebooting doesn't solve the problem, the only solution is... waiting. Yes, waiting.. It will works later when I will retry some hours later. The bug appear at least on 2 Mac on OSX...

Basic Authentication in CRM 3.0?
Hi All, Does anyone know how to get Basic Authentication to work on the CRM 3.0? NTLM does not work across the firewall. (CRM 1.2 used to work ok in basic) Any help is appreciated! mobigital ...

Get Rich
Take advantage of a great deal ...

XP Tablet edition
Everything I have seen indicates that the SFO client is only support on XP Pro. Is this accurate? Is there any plans that any one has heard of for XP Tablet support? XP Tablet edition is simply a version of XP Pro - so CRM client (both 1.2 and 3) work on it absolutely fine - been using this myself for some time with no probs at all Regards Roger <mstrubel@gmail.com> wrote in message news:1142978717.068831.60780@z34g2000cwc.googlegroups.com... > Everything I have seen indicates that the SFO client is only support on > XP Pro. Is this accurate? Is there any plans that any...

Discount on $0 item
I have an item that has a $0.00 price. The purpose of this item is for information and tracking purposes, we also want it to apprear on the sales receipt. The problem is that when we apply a discount to the whole transaction this item, eg. $10 off the entire transaction, the item even though it is has a $0.00 price gets a $0.01 value. Is there a way around this so that the no discounts are appllied to this $0.00 item. Thanks Chas In the item's properties, under options, select "item is not discountable" Alex Bullock The RSC Group www.rsc.com "Chas" <chuck@y...

Illegal Address in position setup
I have a client who has just purchased Advanced Payroll. I installed it and set security per the instructions. Now, when trying to set up a position-or even look at a position we get an "unhandled script exception:Illegal address for field "[Not found]" in script 'Display_Existing_Record'. Script terminated". Any ideas on how to fix this? I haven't been able to find a KB regarding this. Thanks for any help. Tracey D ------=_NextPart_0001_119D8CA4 Content-Type: text/plain Content-Transfer-Encoding: 7bit Are you using modified window? Is there alt...

editing custom views
Hello, I have a finance spreadsheet I created for myself to plan my household budget where I have a row for every day of the year. Sine some days nothing happens amongst the days I am planing for I created 2 views. One which displays all the rows and a "part view" which hides the rows with no activity. As the year goes on and I plan further down the sheet I'll want to edit the "part view" so that it includes further rows which will be hidden. How do I do this? When I go to View/Custom View it only gives me the option to Show, Close, Add or Delete a view? Wou...

How can I force certain text formatting in a cell?
I'm building an invoice template for my own use (self employed trade). I want a cell to be a properly formated 2-letter state abbreviation in caps no matter how I enter it. I suppose that will involving limiting the length ot the text to 2 letters and performing some action to capitalize the text if necessary. I don't know if the best way to do this is with a macro or some other way. I think I would prefer a macro to automatically capitalize all letters in the cell after the text is entered no matter how exited (enter, tab, mouse click). I'll settle for the capitalizatio...

Changing "Formats" on "System Settings" has no effect....
I'm having a really hard time changing the way that dates are displayed on forms. I've gone to "Administration", "System Settings" and "Formats" tab, and selected "English (United Kingdom)" According to this the Short Date should show as "05/02/2009". However, on all the forms that show dates this is "02/05/2009" Thoughts? Thanks Edward Hi, On top of what you've already done, you'll also have to do the following: Tools -> Options -> Formats Tab -> English (United Kingdom). Send a quick email to all ...

editing exsisting access database
I have recently inheirited a 2007 Access Database. I am currently trying to find the forms and queries part of this database to make changes to it; such as adding the ability to search by last name option instead of looking thru an entire list of names. Currently to look at the database I can either just dbl click the access db and get the first form or I can hold down the shift key and get a database tools , external data menus. How do I get to where the forms and queries are located? Thank you What happens if you push F11 in either view? UpRider "benny wa" <be...

Copy Series of Formatted Charts & easily Chg Range source
I'm running XCL'02 and have to make hundreds of charts that are all going to look the same but just have different ranges of data feeding them (similar ones will be printed together for comparison). For example, if I have 5 charts lined down a Col. each with their proper source data and format, I want to (hopefully easily!) copy the formatted charts, paste in the adjacent col. and ideally have some sort of cell referencing feed in the new data source. Currently, I have to manually change the source range to update the new data source. Not fun when you have to repeat it lo...

Excel Inserting "=" when entering date
can anybody tell me when my excel workbook is inserting a "=" when enter a date. instead of just the date. when i enter a normal numbe the "=" is not inserted i think this is a settings problem but i cant see how to change it Simo -- Message posted from http://www.ExcelForum.com Hi Simon! This is a setting that you can deactivate. In Excel, click on the Tools menu, then click on Options, select the Transition tab and unselect "Transition formula entry". Best regards Stefan H�gglund Microsoft "simeyg >" <<simeyg.1blf1x@excelforum-no...

Edit + Find
How do I find exact text when using the Edit + Find? I want to find all of the "Bapt" in my list, but when I type in Bapt in my edit + find, it scrolls to the Baptist as well. In the Find window, choose to "Find entire cell only". Paul "Mindy" <mcliburn@kub.org> wrote in message news:143601c53c78$b17516b0$a401280a@phx.gbl... > How do I find exact text when using the Edit + Find? I > want to find all of the "Bapt" in my list, but when I > type in Bapt in my edit + find, it scrolls to the Baptist > as well. If it's the onl...

Get Rich
Take advantage of a great deal ...

conditional formatting question #9
I have a spreadsheet that gets updated monthly and looks like the example below Jan Feb march April May June 21,000 23,500 22,224 22111 20,111 25,000 I've asked this question before and have gotten great tips but each month when refesh the pivot table it looses all the conditional formatting and I start over again. The conditional formatting needed is if #'s go down for three consecutive months in a row they are highlighted in red. I need the first month of dropped revenue example above would be March in yellow and then t...

text color of edit control
I have an edit control which is filled by - DDX_Text(pDX, IDC_EDIT_ADJ, m_ctrDate2) I tried to do the following things in order to color the text in it - IDC_EDIT_ADJ is the ID of the edit control I would like to colo CWnd *pWnd = GetDlgItem(IDC_EDIT_ADJ) CDC *pDC = pWnd->GetDC(); pDC->SetTextColor(m_textcolor) How can I solve this Thanks a lot. Liat Try overriding the OnCtrlColor() method, and via the GetDlgItemID(), you can use a switch to color the text/background/etc. based on the dialog item of interest. Balboos Liat wrote: > I have an edit control which is filled ...

Account Overview Report CRM 3.0
Hello NG, When i run this report i get shown at most 10 pages but with this query i should get much more than these 10 pages. Do you have any idea how i can magnify this limit higher? Thanks Thomas ------=_NextPart_0001_0A4F8D19 Content-Type: text/plain Content-Transfer-Encoding: 7bit "Thomas Burger" <thomas.burger@nospam.de> wrote: > When i run this report i get shown at most 10 pages but with this query i > should get much more than these 10 pages. Do you have any idea how i can > magnify this limit higher? The limit of 10 is hardcoded into the report. ...

rich text box in forms
I would like to use rich text boxes in my forms. I read that you can use this un-allowed tools in forms if you make a change to the browser. Does someone out there know the answer to this? -- Ed Ayers ...

Will Store Operations 2.0 run on Windows 7
Is there an official word if RMS SO 2.0 will run on a Windows 7 system? I would like to upgrade 1 of my backoffice system to Win 7 end of the month. Thanks for your reply. Not sure about RMS, but POS 2009 runs like a top. I would wait untill you get confirmed compstibility before making the change though. -- Thanks! David D. L.S.B. "Gerd" wrote: > Is there an official word if RMS SO 2.0 will run on a Windows 7 system? > > I would like to upgrade 1 of my backoffice system to Win 7 end of the month. > > Thanks for your reply. > I have been running 2.0 o...

Formulas no longer auto update with newly inserted data!
All of a sudden, I add sales numbers to a row that was included in the summation. The sum function did not sum the newly inserted information until I double-clicked on the formula cell and re-entered. This now holds true for all of my linked worksheets and formulas, rendering me useless for entering additional data. Anybody know why this is happening and how to remedy? Hi you probably have disabled the automatic calculation. Goto 'Tools - Options - Calculation' and check 'Automatic calculation -- Regards Frank Kabel Frankfurt, Germany Oyitch wrote: > All of a sudden,...

Style Formatting Task Pane
Somehow this task pane has become resized and now appears across my page, making it very difficult to edit my document while the task pane is open. (Note, I am using Word 2003.) I have tried resizing it by placing my cursor over the four dots until it turns to the four arrows, but it will NOT resize. I tried closing all my toolbars and using customize to reset it, but "reset" becomes grayed out when all the toolbars are closed. I want it to go back to the right hand side of my page. Any suggestions would be appreciated. Thank you. -- -JT See the "Resiz...

Letter Writing error after upgrade to 9.0
We just upgraded to 9.0. When we try and print a letter in the letter writing program we receive a Header Record Delimiters error. It is asking for a field delimiter and a record delimiter. How do we correct this error. If we run this same letter in a Historical Co, the letter writer works. Thank you, Amy Are you referring to Letter Writing Assistant? I haven't seen any errors in LWA. What kind of letter is it? -- Charles Allen, MVP "Amy" wrote: > We just upgraded to 9.0. When we try and print a letter in the letter > writing program we receive a Header Re...

Ingenico i6550 on 2.0.0114
Hi All, I am having a hard time finding any information on installation and configuration of the i6550. Would anyone out there be willing to share their documentation and/or procedures with me? I followed the KB article 935588 but all I get is a blank screen once the device boots. I have gleaned that I need several things to make this work: Form Designer for the device Ingenico OPOS driver newer than 2.4 (?) Better configuration documentation Sample receipt template (?) I would appreciate any detailed documentation that I can get my hands on. Thanks all very much! I installed 7 of th...

format "focus" characteristics
The cell on which the focus rests is indicated by a thick box outline. Is there a way to thin those lines? Are the other formating features that can indicate focus? I don't think so. But you may want to take a look at Chip Pearson's rowliner utility. http://www.cpearson.com/excel/RowLiner.htm Pa Maher wrote: > > The cell on which the focus rests is indicated by a thick box outline. > Is there a way to thin those lines? > Are the other formating features that can indicate focus? -- Dave Peterson Thanks Dave, The add-in allows for some efficient and attractive feature...