Posts by ehimmer

    Would it be possible in a future release to expose FIncrement as a public property for a TWPValueEdit (part of WPUtil.pas)? I'd like euInch to increment by .05 (72) not .10 (144) and euTwips to increment by 10 not 1 without having to edit WPUtil on each WPTools update. It is currently hard coded in the SetUnit procedure.



    It is a TMS issue. I was just seeing if by chance you knew of any technique to force focus back to the editor after an action completed.

    However, TMS has already replied and duplicated the issue, and will be providing a fix in their next update. So all good I hope :)

    I ran into a problem using the TMS Toolbar and focus. I have contacted them on it, but thought I'd run it by you as well.

    If I have a button on the TMS TAdvToolbar with an action such as WPABullets1 assigned to it, it works fine and focus stays with the editor. However, with their TAdvDockPanel, if the toolbar won't fit on it, it shrinks down width-wise and the buttons can be invoked using the side option dropdown menu of the toolbar. If I then click the bullet button from the dropdown menu, focus does not stay with the editor but instead focus is placed on some totally unrelated panel. On buttons where I have my own actions set, I can force focus back to the editor after the respective dropdown button action is finished. Is something like that possible with your actions, like one of the events that occur due to an action completion?

    I can't find any info about the event OnCheckProtection. What is it used for, when does it trigger and how do I get it to trigger?

    I am trying to change the down state of a button based on if the cursor is on protected text. I tried to use the OnChangeCursorPos event, but it fails me, For example, if I select a word that is not protected, I click the button which adds protection. I then click on another word that is not protected. The OnChangeCursorPos fires where I do this:


    btnLockUnlock.Down := afsProtected in WPRichText1.CurrAttr.Style;

    but afsProtected in WPRichText1.CurrAttr.Style is still true until I move cursor/caret again. Simply clicking between protected and unprotected text works, it just doesn't seem to right after I added protection, as if unselecting of the word on the move is interfering somehow and pulls the wrong attribute. Or I should be doing something before doing the GetCharAttr in the event or after adding protection?

    This is why I was looking into what OnCheckProtection does, but I cannot find any documentation on it.

    I created a new project, so nothing but defaults except for the AcceptFiles option is now true in the WPRichText. I pre-loaded a shaded table with a transparent PNG in one cell. Created the PDF and it is not transparent. I then dragged that same PNG image I used in your demo, and dropped it into the other cell. PDF again created without transparency.

    I will send you the sample. I am at a loss as to what might be different between your demo and my basic sample app.

    OK, Instead of using the Insert Image option in your demo which did not give me the option for PNG images, I tried dragging the image into the table cell which accepted it. Creating the PDF worked fine as you said.

    Maybe it has something to do with linked images? Or perhaps I have some PDF creation setting set wrong. I'll dig into it more and let you know what I find.

    Sorry, I do not see a GDIPP switch in WPObj_Image. Could it be "USEGPP"? I tried disabling USEGPP and it made no difference.

    Also, how did you test it in your demo? I downloaded WPCubedWordprocessorDemo and could not find a way to insert a PNG image to test.

    To test, I created a one row two column table. I then shade the table cells and insert a linked PNG image into one of the cells. Print preview shows it correct, but then creating the PDF is where it is not transparent, i.e. the cell color does not come through the transparent parts of the image.

    Thanks for the info on the cursor width (I'll see what I can do about using the Windows configured width).

    One thing to note on the blinking is that the caret blinking duration is controlled by Windows 10, and they now stop it after 5 seconds by default:…few-seconds-on-windows-10

    And I hate that as do so many others! Not sure why Microsoft decided to do that and not give users an easy way to configure it. Feels like something has locked up or is busy doing something when it isn't, and as such makes it hard to find where the cursor is in some cases. Not your concern, just me venting. ;)

    Windows 10 allow a user to adjust the width of the text cursor (caret) in the Ease of Access settings, however, WPTools does not seem to honor that setting. Could this be changed or maybe point me to where in code I could change this? (yes, your text cursor is wider than some apps, but apparently some customers want it even thicker on smaller screen devices I guess)

    We have several customers complaining about this as well as where Windows 10 stops it from blinking after 5 seconds. There is a registry fix for the blinking, but I had no answer for the width.

    I may have to. Just frustrating that the standard dialog and finder approach worked fine before in WPT5 but doesn't now and I cant figure out why. I just want this project of mine to be done. Arg.

    In WPT5 I did not need to use SetFocus. I was just trying to figure out why I have to manually focus the WPRichText in WPT9 using the standard dialog. Still haven't figured that out yet. The manual focus only works after the standard dialog itself (not your OnSerchReplaceMessage event) reports that it didn't find anything (even thought there is a match). After that dialog, I can click in the WPRichText and select find, and it works until the next load of the WPRichText.

    I tried your new dialog, and that issue is not present which is good, but have other questions/problems:

    Why does TWPSearchReplaceDialog always start with the Replace checkbox set even though my options are all cleared? I might want to find, not replace:

    WPSearchReplaceDlg1.Options := [];

    I ended up replacing my first few test texts with blank when I thought I was just doing a find. But was lucky it didn't save because the replace didn't invoke the OnChange event, which is a problem in itself.

    When doing a replace, the Count parameter in the OnSearchRepalceMessage is always 0. What is this Count? I can't find anything in the documentation, sorry.

    Is there a way to autofill the search box? For example, if my text cursor is on a word, I'd like to just do a CRTL+F and the dialog pops up with that word (WPRichText1.CPWord) in the dialog.

    One last thing for future consideration in your dialogs...

    As I've mention in the past, it would be nice if you allow the programmer to decide where the dialog should show up. Currently it always shows up in the top left corner, which is not nice on a 4K 40" monitor when my app is a relatively small form in the middle of the monitor. Like the old baseball reference "out in left field" in the literal sense. ;)

    Thanks, I will check out the new dialog.

    FYI, I do not use TDBWPRichText, just the normal TWPRichText. My app does not lend itself to be able to use a TDBWPRichText. Depending on what the user is doing, I load a specific record from the database and need to analyze it before loading the TWPRichText. So for spell checking all the pertinent database records, I navigate through a TreeView and pull the corresponding record via a class object. I won't go into any more detail, but using TDBWPRichText is not an option.

    So, when clicking next, and there are no more matches, I do the next treeview item that can be searched on and load that specific record. I need and event to tell me that no more matches exist in the current WPRichText where I can then move to the next treeview item and begin again, seamlessly. The treeview items are a random order of objects that relate to database objects, and the user needs to see where they are in relation to the treeview.

    I did use Finder in WPT5 and it worked well. For WPT9 I even tried setting focus in code on the newly loaded WPRichText, but had the issue I mentioned in my previous post where I had to manually focus the WPRichText to get it to find next.

    I will definitely try out the new dialog for both Find and Replace. I hope I also find how to keep a total count of the replacements as I was able to do in WPT5 (not real important, but can useful to the user).

    Having trouble converting the Find and Replace dialogs.from WPT5 to WPT9 as they have changed. The only demo I found was the FindText demo, but it was not much help.

    • In WPT5, FindDialog had multiple parameters to be able to pass in the TFindOptions, now it doesn't. The ReplaceDialog had TReplaceOptions and TotalCount, now it doesn't, but I need a total count.
    • The old event OnTextNotFound is now OnSearchReplaceMessage.

    I need to be able to find and/or replace text within multiple WPRichTexts from a database that get loaded into the same WPRichText in sequence (and saved as needed when using replace), and keep a total count of how many words were replaced.

    Basically the same logic I used in WPT5 is not working in WPT9, The only changes were commenting out those parameters previously used in WPT5, and using that other event.

    What is happening is that it works up until it finds a match, i.e. loops loading each WPRichText out of the database just fine. Once it finds a WPRichText with a match, it highlights it, but clicking on find next just displays its own "text not found" msg even if there are more matches in the current WPRichText and does not invoke the OnSearchReplaceMessage event in order for me to move on to the next WPRichText.

    It is as if the find dialog is no longer hooked to the recently loaded WPRichText. If I then click in the currently loaded WPRichText, it then continues correctly until it loads a new RichText, where it then highlights the first match and gets "unhooked" again somehow. I'm thinking I'm missing something when reloading the WPRichText during a find that is currently in progress.


    1. Loads first/next WPRichText
    2. highlights the match if found else repeats step 1 because it invokes OnSearchReplaceMessage event
    3. click next
    4. displays its own "text not found", does not invoke the OnSearchReplaceMessage event
    5. I click inside the WPRichText
    6. Click next
    7. Highlights the match
    8. click next
    9. Highlights the next match if there is one, else goes to step 1 because it invokes OnSearchReplaceMessage event


    b) Nice. That will most likely come in handy when our customers create what we call RapidRemarks (reusable comments). Single paragraphs with attributes could potentially be used.

    c) Ahh, much better I think! I use LoadFromString and LoadFromStream elsewhere, so this makes it consistent. But still OK for appending? (which is what I'm doing here, not replacing). I'll find out.

    I traced it down to the exact statement which is stripping off the attributes of the last paragraph.

    dest.SelectionAsString := src.AsString;

    If I change it to this, it works:

    dest.SelectionAsString := src.AsANSIString('WPTOOLS');

    However, it gives me the warning "Implicit string cast from 'AnsiString' to 'String'

    How to properly avoid that warning?

    Seems I had changed that line during the initial re-write in order to avoid the warning. My bad.