Appearance and Text Formatting properties

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

DanielG
User
Posts: 34
Joined: Wed Oct 09, 2013 5:58 pm

Appearance and Text Formatting properties

Post by DanielG »

Hello,

When an annotation is selected, it is possible to show either an Appearance properties toolbar (fill color, stroke color, etc) or a Text Formatting properties toolbar (font name, font size, etc.). The way we are using the component, the correct toolbar is shown depending on how the user is editing the annotation.

My question is if it is possible to know which properties toolbar, Appearance or Text Formatting, is currently displayed? I'd like to be able to make either of the following two calls without causing an exception:

ApplyDefaultProperties
ApplyDefaultTextFormatting

If the Appearance toolbar is displayed, calling ApplyDefaultTextFormatting will thrown and exception. If the Text Formatting toolbar is displayed, calling ApplyDefaultProperties will throw an exception.

Thanks,
Daniel
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: Appearance and Text Formatting properties

Post by Vasyl - PDF-XChange »

Hi Daniel.

You may handle special events:

Code: Select all

int m_nTextEditorStarted = 0;
pdfViewer.SetProperty("Notifications.TextEditor.Filter", "All");
....
youreventhandler OnEvent(type, name, ..)
{
   if (type == PXCVA_OnNamedNotify AND name == "Notifications.TextEditor")
   {
       int eventType = 0;   
       pdfViewer.GetProperty("Notifications.TextEditor.Type", out eventType);
       if (eventType == 1) // begin
         m_nTextEditorStarted++;
       else if (eventType == 2) // end
         m_nTextEditorStarted--; 
   }
}

bool TextFormattingTbIsDisplayed() { return (m_nTextEditorStarted > 0); }
HTH
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
DanielG
User
Posts: 34
Joined: Wed Oct 09, 2013 5:58 pm

Re: Appearance and Text Formatting properties

Post by DanielG »

Hi Vasyl,

Thanks for the reply. I have tried what you suggested, but it seems that all calls to GetProperty('Notifications.TextEditor.Type', oleVariant, 0) return 0.

Here is my code:

fTextEditorStarted: integer;
fCoPDFXCview.SetProperty('Notifications.TextEditor.Filter', 'All', 0);
...
eventHandler OnEvent(type, name, ...)
var
vDataOut := OleVariant;
begin
if Type_ = PXCVA_OnNamedNotify then begin
if Name = 'Notifications.TextEditor' then begin
CoPDFXCview.GetProperty('Notifications.TextEditor.Type', vDataOut, 0);
if 1 = vDataOut then begin
inc(fTextEditorStarted);
end
else if 2 = vDataOut then begin
dec(fTextEditorStarted);
end;
end;
end;
end;
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: Appearance and Text Formatting properties

Post by Vasyl - PDF-XChange »

You are right, here is bug on our side - we will fix it in the next build. Currently you may use other events:

Code: Select all

 if (type == PXCVA_OnNamedNotify)
{
       if (name == "TextEditor::OnStart")
         m_nTextEditorStarted++;
       else if (name == "TextEditor::OnStop")
         m_nTextEditorStarted--;
}
HTH.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
DanielG
User
Posts: 34
Joined: Wed Oct 09, 2013 5:58 pm

Re: Appearance and Text Formatting properties

Post by DanielG »

Thanks Vasyl - that works!
:D
User avatar
Will - Tracker Supp
Site Admin
Posts: 6815
Joined: Mon Oct 15, 2012 9:21 pm

Re: Appearance and Text Formatting properties

Post by Will - Tracker Supp »

:)
If posting files to this forum, you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded.
Thank you.

Best regards

Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com