Beiträge von old_news

    >if no text is selected, SelStart always returns 0 (see TWPCustomRtfEdit.GetSelStart in WpWinCtr).
    >Shouldn't it not better reflect the current position (with SelLength=0) like TMemo does?

    Logically SelStart has nothing in comon with the cursor position -
    they can be completely different. So I cannot encourage to use
    SelStart instead of the CPPosition property, either to assign nor to
    read. So it is ok that it returns 0.

    >I am interested in using TWPOCheckbox objects in my documents, but when I
    >print the document, the checkboxes show up as very small squares. There
    >doesn't seem to be any way to adjust the printed appearance. Can you help?

    The checkboxes use their own code to print (in WPEmOBJ) - this code is
    pretty simple and just draws the box. You can change that to your
    needs. The source is part of the standard version.

    You can trap the OnEditFieldFocus and set the property CurrAttr
    according to the edit field you are in (function CurrentEditField :
    string).

    Other procedures helpful in this context are:

    function InputField(c: Char; const text, fieldname: string):
    Integer;
    function InputFieldEx(c: Char; const DisplayName, FieldName,
    Command: string; Format: Integer): Integer;
    function InputEditField(const fieldname, fieldtext: string;
    placecaret: Boolean): Integer;
    function ReadFieldText(const fieldname: string): string;
    procedure GetFields(list: TStrings);
    function GetFieldName(tag: Integer): string;
    function GetPreviousFieldName(par: PTParagraph; lin: PTLine; pos:
    Integer): string;
    function CurrentEditField: string;
    // EditField Support
    function MoveToField(const fieldname: string; from_start:
    Boolean): Boolean;
    function MoveToNextField(from_start: Boolean): string;
    function MoveToPreviousField(from_end: Boolean): string;
    function DeleteFieldAtCP: Boolean;
    function SelectFieldAtCP: Boolean;

    Hi Julian (or anyone who migth help me :-))
    How I can avoid the format of one EditField to be copied to next when moved
    using cursor Up or Down keys? For example, I have two fields, one bold the
    second normal. When I move from One to Second using cursor down, the second
    field gets bold when I start to type its content, but if I use TAB works
    correctly.

    I can't found this in Edit options. Another acceptable way could be disable
    cursors keys between fields, but I need them into multiline fields, so
    KeyDown event for the editor don't work.

    Thanks a lot

    Diego

    I insert this object in the text:

    obj := TWPObjectField.Create(Editor);
    obj.FieldName := 'LICENTIE';
    obj.Name:='LI';
    Editor.TextObjects.Insert(obj);

    That works fine.
    Then I want to see if that TextObject is inserted in the text with this:

    with Editor3.TextObjects do
    begin
    if FindName('LICENTIE')=nil then ShowMessage('found!');
    end;

    But it does not find the field. What am I doing wrong?

    <--->

    I tried, but FindName does not work.
    I made this function and it works OK.

    function
    FindFieldName(WPEditor:TWPRichText;aFieldName:string):TWPObjectField;
    var
    t1 :integer;
    begin
    Result:=nil;
    if WPEditor.TextObjects.Count>0 then
    begin
    for t1:=0 to WPEditor.TextObjects.Count-1 do if
    SameText(TWPObjectField(WPEditor.TextObjects.List
    [t1]).FieldName,aFieldName) then
    Result:=TWPObjectField(WPEditor.TextObjects.List[t1]);
    end;
    end;

    >1. When quitting my app or closing a doc, I would like to ask the user if
    >they want to save, but only if changes have been made.

    In Form.OnCloseQuery ud a

    CanClose := WPRichText.CanClose;

    >2. How do I suppress the file save dialog when the user clicks the "save"
    >tool? ie: I want to "save", and don't want to "save as".

    You can use your own button or you trap the ToolBar.IconSelection
    event. See the code in WPRich.PAS which is usually executed for this
    event: OnToolBarIconSelection

    >I have code in my editor that inserts a fastsetpagebreak(true) into my
    >document, but there is no visible sign of it. It does take effect, as I can
    >see in the preview. How do I make this visible to the user?

    The 'fast' procedure do not reformat the text. So you can either use
    InputString(#12) to insert the page break or create the text 'fast'
    and use Refresh; when you are done.

    and ... layoutmode has to be wplayShowManualPageBreaks.

    >My app is used to edit merge templates which were originally created in MS
    >Word as ordinary rtf documents, with headers, footers, boxes, font
    >formatting. When I open one of these dox, the headers don't seem to come
    >in, and the doc doesn't fit on a single page, although it did in Word. I've
    >tinkered with margins, but it doesn't seem to help. I have a pagepropdlg
    >attached to the richtext edit box, and it does affect the margins, just not
    >enough.

    I found out the screenresmode rm1440 is very similar to what is using
    word inside - although I of course don't know. Since font sizes are
    somehow relative (depends on resolution etc) there is no possibility
    to make a file looking in RTF component A like in RTF component B.

    >Could you give us a little sample about "binary RTFVariables function" ?

    A pretty simple example:

    Save the image to the stream:

    Code
    WPRichText1.RTFVariables.AddStream('demoimage').Clear;Image1.Picture.Bitmap.SaveToStream(       WPRichText1.RTFVariables.AddStream('demoimage') );


    Load the image from the stream:

    Code
    WPRichText1.RTFVariables.AddStream('demoimage').Position := 0;
    Image4.Picture.Bitmap.LoadFromStream(
    WPRichText1.RTFVariables.AddStream('demoimage'));

    >A couple of years ago, there were some messages on this forum about the
    >possibility of WPTools using XML as a native format. Since then, I
    >haven't seen anything about this. I'm in desperate need of a rich edit
    >component whose underlying file format is xml; will WPTools do this, or
    >does anyone know of any other component that can do it?

    If native XML is just the storing of the par and char properties in
    XML nodes this could be done using WPTools and the included XML class
    but I see no real improvement here. WPTools would be the only
    application which understand it.

    Instead the XMLFile unit which loads and saves XHTML has been further
    developed and improved. WPTools is now able to load and save XHTML
    data and store the properties in the style="..." parameter of most
    nodes. The new CSS class loads and saves the CSS data easily - it is
    the major improvement in V4.2 apart from the support for right-to-left
    writing. The advantage of XHTML/CSS is that other HTML readers can
    understand it. In the beginning it was using XML + CSS2 but I found
    no application which hanbdled the CSS2 information good enough so I
    stayed with XHTML. The difference is mainly that in XHTML some nodes
    have use a predefined formatting - most important tables and lists.

    Julian Ziersch

    >I'm use WPRichtText.Finder.ReplaceAll('str1', str2), but i'm can't insert 2
    >lines in str2
    >
    >str2 := 'wptolls' + Chr(13) + 'This is my problem'
    >Result in wptollsThis is my problem

    The ReplaceAll does only replace in the same line of text. If a
    newline helps you use #10 insted of #13 - otherwiose you need to
    select the found text (SetSelPosLen(FoundPosition,FoundLength) and use
    SelectionAsString to replace it.

    I am trying to use the mergedataprovider gettext event, but can't compile
    because TWPMMInsertTextContents is not defined.

    I can't find this in the v4.2 source anywhere. What am I doing wrong? What
    unit is it declared in? (I can find plenty of places where it is used).

    A:
    Please add unit WPrtfIO to the uses

    I am trying to install wpdf2. I have just upgraded to wpt4.20. I uninstalled
    4.11 and installed 4.2. I changed the wpinc.inc file. I installed wpdf2. When
    I recompile wpt4.20 I get the error message

    [Fatal Error] WPPDFR1.pas(382): File not found: 'Types.dcu'

    I cannot find a file named Types.dcu on my computer.

    <...>

    I had the same problem... I found I could just comment out the "uses
    types.dcu" line and it compiles fine ... under Delphi 5 anyway.

    Stefano,

    We did built, but with EB4 (EB5 upgrade don´t seems to be a great advantage,
    since there is nothing new on the package besides DockingLibrary, and the
    same problems still remains.

    But we don´t have it as a separate package.. it´s part of an hugge
    application.

    What would you like to know...??

    It´s a MS Word mimic, and works like a charm (for the available wptools
    features)

    I use TB2K with TBX to mimic the "MS XP Task Bar", that maybe, with EB5 and
    its DockingLibrary could fit some of the features. But I still prefers TB2K
    and TBX package for this "Floating Task Bar" feature.

    Alessandro


    --
    Alessandro Fragnani de Morais

    >Could you please help me, I search how I can insert an OLE object (New and
    >from file if possible).

    Code
    procedure TWPWordForm.TBItem109Click(Sender: TObject);
    var
      obj : TWPObject;
    begin
      obj := TWPOOLEBox.Create(Self);
      TWPOOLEBox(obj).OLEContainer.InsertObjectDialog;
      obj.WidthTW  := 5000;
      obj.HeightTW := 3000;
      WPRichText1.TextObjects.Insert(obj);
    end;

    >when i save a rtf with an emmeded bmp or jpg, the picture is not visible in
    >word 2000 and wptools anymore. To save rtf file I am using
    >standart(TWPASave) wptools procedure.

    Please use the WriteObjectMode = ..RTF for exports to Word.

    >I have been handed an app a former co-worker was working on. I am fairly
    >new to C++ Builder & WPTools & need some help!!!
    >
    >How would I toggle the WPToolBar buttons programatically? For instance
    >toggling bold or underline from within the program rather than requiring
    >a mouse click?

    Please open unit WPRich and look through the procedure
    OnToolBarIconSelection. This is the code which is processed for all
    toolbar buttons and also for the actions.

    For example

    WPRichText1.Load;

    will load a file or

    WPRichText1.CurrAttr.AddStyle(afsBold) makes text bold.

    >Maybe it's called something else, but I'm not finding this ..
    >
    >I want the basic mailmerge, one record per page, ie each is a letter with
    >fields filled in.

    Use
    WPAll.FastAppendText(WPWork)
    and then FastSetPageBreak (except for the last record)

    See MailM demo.