Newbie questions for begining with WPTools 7

  • Just purchased wptools 7 Pro. As a newbie (for this tool, not as a programer), I am troubled in getting acquainted in the inner details of this tool.

    Just being a newbie, perhaps I have a more autoritative position in that matter, so here are some opinions and questions about.

    1.) Newbies are who with more reason need a plain and instructive user manual, and, in my modest opinion, I am having trouble in to know what are the differences between TWPToolPanel and TWPToolBar, specially how the connection of every button with the actions work. But wait, what are the actions and the action list ?. I can not see any explanation of what I need to do if I want to add some code to a standard action, for example, adding my code to the "Save as" action.

    2.) Even a more simple question: If I want to make my own Toolbar, where can I see explained how to connect the buttons to actions.? Perhaps a demo program with the full set of buttons with the corresponding event code will be a very valuable time saving for beginning with.

    3.) If I want a more personalised Toolbar, which is my case, as I have learned until now, it seems that I must use TWPToolpanel, and in the StyleName property of the button choose the icon related to the function I need, but what about GroupIndex and StyleGroup. Where are they defined and what are they used for.

    4.) How can I insert separators between groups ?.

    5.) Perhaps other enthusiastic and/or generous users could colaborate in to make other set of icons to choose from, with other appearances different from the "official" ones.

    6.) Where can I see an example on how to send a document by email.

    7.) Where is explained if the export to PDF needs some other paid modules, or it could be done directly using WPTools7 pro.

    8.) How can I connect the status of the RTF editor to a status bar to display, for example, page number, line and column number, CAPS state, zoom view percent, etc.

    • Offizieller Beitrag

    1-5)

    The manual includes some instructive chapters. Did you find those? They show how to start with WPTools and Delphi XE.

    My apologies that we do not explain what Actions are and how to connect those to a toolbar. Actions are a standard concept of the VCL:

    Basically an Action is an invisible component which is attached to a button or TMenu Item. It can have a caption, hint and also an Image property. The Image property however is loaded from an attached Image list.

    WPTools supports "Standard Actions" - this means when you create a TActionlist you can click right and select WPTools Actions to be added. You can see the RichEdit example provided with Delphi as example.
    The TActionlist must be assigned to TWPRichText.ActionList to make the Actions work.

    There are powerful toolbar concepts out there (i.e. TMS) which include good toolbar classes. They also support different layout styles, separators and such. In the PDF there is a caption which talks about such GUI elements, ribbons.

    To begin with WPTools I strongly recommend to use our TWPToolbar. This is one of the oldest components in this set, it was there since 1996 and has been used in thousands of applications. This was the reason that WPTools 7 updates the concept to also runtime customization and ordering of the Buttons. (Separators are not yet supported) It can now also use higher quality glyphs than the ones which are loaded from the resource.

    The included Demo Projects Show how to use it. It is very simple.

    Did you find the new icon sets? They have been installed under Glyphs. The WPTools' license includes the use of this new icons. They must be loaded in the TWPImageList component though, the standard image list does not handle alpha channels well. TWPImageList stores the images in different sizes as singular PNG images as items in its own collection. The logic selects the images which fits best to the current button height.

    ---

    6) You need something like Indy for this. To retrieve a HTML string use AsANSIString('HTML').

    7) You need our product wPDF for PDF export from WPTools this. With it the PDF export is done with the assignment of the "Source" property and a call to "Export". wPDF is not a printer driver and can be easily distributed with the application.

    8) You can use the OnChangeSelection or OnChangeCursorPos event to update your statusbar. You can read properties such as CPPosition, CPLineNr etc.

  • Here again. Following your indications, I am using as a basis the WPMiniEdit module from the samples.
    As there is not a menu, I made one, adding WPDefActions7 and code from other examples using:

    FWPDefAct := TWPDefAct.Create(Self);
    // No, we use OnGetWPRichText!
    //WPRichText1.ActionList := FWPDefAct.StdActions;
    FWPDefAct.OnGetWPRichText := GetToolsEditor;
    Menu := FWPDefAct.MainMenu;

    This code is confusing for me, because of the comment "No, we use ONGetWPRichText", as I also want to modify some standard actions.
    To add my code to standard actions, do I need to add a TWPDefaultActions to the form, or I can use the StdActions from WPDefActions7 datamodule.
    So, if I want to modify, say, the "Save" menu, how is this done.

    Also I see that the menus in the group "View" are not implemented. To implement them, do I need to modify WPDefActions7 source, or there is another programatic way to do so.

    I can not see any property to add more space between buttons in the WPToolBar, do I need to modify the WPTbar source code, or there is another programatic way to do so.

    • Offizieller Beitrag

    Hi,

    The demo I had in mind was "A)_Mini_Delphi5_Editor" - there is also an XE variant. It basically uses this code:

    1) "No, we use OnGetWPRichText" means: We do not assign the actionlist from the FWPDefAct to the WPRichText because the FWPDefAct will ask through the event for the WPRichText object.

    2) If you want to modify the SaveAction you can implement a handler for the event OnToolbarIconSelect. Here you get a group and a number - for example how to do it, see unit WPCtrRich, where the default behaviour is implemented. Set tpy to none when you have porcessed the action.

    That works for actions and TWPToolbar.

    3) The View menu is implemnted, but please note that it modifies the upper editor only which may not be visible (resize the window and change its size)

    4) Seperators in TWPToolbar will come later.

    Please note - the DefActions are not very useful if you use the TWPToolbar - and vice versa.

  • Thank you wpsupport for your patience, I am learnig WPTools at the pace of your responses and experimenting with the demo code.

    * I remember your first response about separators, so now, what I mean is not a separator control but a property to have a gap between buttons to decrease the button density. That is, instead of having a gap of 1 pixel between buttons, use a default property for changing it to 4, 5 or 6.

    * Demo program A has an ActionList and WPImageList controls, but I can not see any modified property o event, and they are not linked to WPRichText, so what are they used for ?

    * I experimented with the following code. Is this a correct way to intercept menu actions

    * Can you show me in a few lines of code how is OnToolbarIconSelected implemented. Can I inherit the default behaviour, and add my own code as well to any event.

    * I can not see an icon or button to show "Save As" in the TWPToolbar.

    • Offizieller Beitrag
    Zitat

    * Demo program A has an ActionList and WPImageList controls, but I can not see any modified property o event, and they are not linked to WPRichText, so what are they used for ?

    The single action in the action list is "Configure Toolbar" which is used by the TWPToolbar. The TWPToolbar in WPTools 7 can also list and configure actions from a standard TActionlist.


    Instead of "mWPDefaultActions.XA_SaveAsExecute(Self);" please better call TWPRichText.SaveAs.


    Zitat

    * Can you show me in a few lines of code how is OnToolbarIconSelected implemented. Can I inherit the default behaviour, and add my own code as well to any event.

    Please see the WPTools unit WPCtrRich.pas and there

    procedure TWPCustomRichText.OnToolBarIconSelection(Sender: TObject;
    var Typ: TWpSelNr; const str: string; const group, num, index: Integer);


    Zitat

    * I can not see an icon or button to show "Save As" in the TWPToolbar.

    It is the floppy symbol - please note that you can configure the toolbar in the ide on double click.

    Julian

  • I see that all the main menus and most of the submenus in the MainMenu object are not translated, is it possible to link them to the WPLanguageControl XML data, to translate myself the menus usng the XML translation file.

    Insisting from my last reply: if the "Save As" button is the one with a floppy symbol, where is the Save button in the "Configure Toolbar".

    • Offizieller Beitrag

    The "Save" is like the "Close" button.


    This would be the XML strings for the menus in the DefaultAction module:

    Code
    <DefaultActions_MainMenu c_File1="&amp;File" c_New1="New" c_Open1="Load" c_CloseFile1="Close" c_Save1="Save" c_SaveAs1="Save As ..." c_Export1="Export ..." c_PageLayout1="Setup Page" h_PageLayout1="Page Setup" c_PrintPreview1="Preview" h_PrintPreview1="Preview" c_Print1="Print" h_Print1="Print" c_Print2="Printer Setup" h_Print2="Printer Setup" c_MailTo1="Mail To" c_Properties1="Properties" c_CloseApp1="Close Application" c_Edit1="&amp;Edit" c_Redo1="Redo" h_Redo1="Redo" c_Undo1="Undo" h_Undo1="Undo" c_Cut1="Cut" h_Cut1="Cut" c_Copy1="Copy" h_Copy1="Copy" c_Paste1="Paste" h_Paste1="Paste" c_Delete1="Delete" c_ParagraphFormat1="Paragraph Format" c_CharacterFormat1="Character Format" c_ext1="Del" h_ext1="Del" c_SelectAll1="Select" c_All1="Select All" h_All1="Select All" c_able1="Table" c_Search1="Find" h_Search1="Find" c_Replace1="Replace" h_Replace1="Replace" c_View1="&amp;View" c_Normal1="Normal" c_PageLayout2="Page Layout" c_Zoom1="Zoom" c_PageWidth1="Page Width" c_FullPage1="Full Page" c_DoublePage1="Double Page" c_N4001="500 %" c_N2001="200 %" c_N1001="100 %" c_N751="75 %" c_N501="50 %" c_N251="25 %" c_humbNails1="Thumbnails" c_ManageHeaderFooter1="Manage Header and Footer" c_ShowMailMergeFields="Fields Markers" c_ShowSpecialChars="Special Characters" c_ShowHorzRuler1="Horizontal Ruler" c_ShowVertRuler1="Vertical Ruler" c_ShowThumbNails1="Show Thumbnails" c_ShowGutter1="Show Gutter" c_Insert1="&amp;Insert" c_PageBreak1="Page Break" c_ColumnBreak1="Column Break" c_SectionBreak1="Section Break" c_Graphic1="Graphic" c_InsTextBox="Insert TextBox" c_Symbol1="Symbol" c_PageNumbers1="Numbers" c_Page="PageNumber" c_NextPage1="Number of Next Page" c_PriorPage1="Number or Previous Page" c_NumPages1="Page Count" c_Fields1="Fields" c_Date1="Date" c_ime1="Time" c_Named1="Field ..." c_Bookmark1="Bookmark" c_Hyperlink1="Hyperlink" c_MailmergeField1="Insert Mailmerge Field" c_InsertFormField1="Insert Form Field" c_Format1="F&amp;ormat" c_Font1="Font" c_Paragraph1="Paragraph" c_Border1="Border" c_abstops1="TabStops" c_Numbers1="Numbers..." c_ColumnsMenu1="Columns" c_ColumnsOff="Off" c_Col21="2" c_Col31="3" c_Col41="4" c_GraphicOptions1="Graphic Options" c_ascharacter2="as character" c_reltoparautowrapleftorright1="rel. to par - auto wrap left or right" c_reltoparwrapleftandright2="rel to par - wrap left and right" c_reltopagenowrappng2="rel. to page - no wrapping" c_reltopagewrapleftandright2="rel. to page - wrap left and right" c_Capitalisation1="Capitalisation" c_Lowercase="Lowercase" c_Uppercase="Uppercase" c_ExtrasMenu="Extras" c_Spellcheck1="Spell Check" c_SpellAsYouGo1="SpellAsYouGo" c_hesaurus1="Thesaurus" c_SpellCheckOptions1="Configure Spellcheck" c_ReportingMenu="&amp;Reporting" c_InsertField1="Insert Mailmerge Field" c_PropertyDialog1="Band Dialog" c_CreateReport1="Create Report" c_able2="&amp;Table" c_NewTable1="CreateTable" c_Insert2="Insert" c_Rows1="Insert Row" h_Rows1="Insert Row" c_Columns2="Insert Column" h_Columns2="Insert Column" c_Delete2="Delete" c_Row1="Delete Row" h_Row1="Delete Row" c_Column1="Delete Column" h_Column1="Delete Column" c_Select1="Select" c_able4="Table" c_Row2="Select Row" h_Row2="Select Row" c_Column2="Select Column" h_Column2="Select Column" c_SplitCell1="Split Cell" h_SplitCell1="Split Cell" c_SplitTable1="Split Table" c_N17="?" c_SelectLanguage1="Select Language" c_Info1="About WPTools" c_Info2="Info"/><DefaultActions_GraphicPopupMenu c_ascharacter1="as character" c_reltoparautowrap1="rel. to par - auto wrap left or right" c_reltoparwrapleftandright1="rel to par - wrap left and right" c_reltopagenowrappng1="rel. to page - no wrapping" c_reltopagewrapleftandright1="rel. to page - wrap left and right" c_underovertext1="under text"/>

    The whole XML data can be saved with code like this:

    Code
    WPToolsEditor.WPDefAct.SaveStrings;
      DataModule1.WPLanguageControl1.SaveToFile('s:\debug\allstr.xml');

    [/code]